Package org.eclipse.jgit.lfs.server.fs
Class FileLfsServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.eclipse.jgit.lfs.server.fs.FileLfsServlet
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
@WebServlet(asyncSupported=true)
public class FileLfsServlet
extends javax.servlet.http.HttpServlet
Servlet supporting upload and download of large objects as defined by the
GitHub Large File Storage extension API extending git to allow separate
storage of large files
(https://github.com/github/git-lfs/tree/master/docs/api).
- Since:
- 4.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FileLfsRepository
private static final long
private final long
-
Constructor Summary
ConstructorsConstructorDescriptionFileLfsServlet
(FileLfsRepository repository, long timeout) Constructor for FileLfsServlet. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doGet
(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) Handle object downloadsprotected void
doPut
(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) Handle object uploadsprotected AnyLongObjectId
getObjectToTransfer
(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) Retrieve object id from requestprotected static void
Send an error response.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doTrace, getLastModified, service, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
repository
-
timeout
private final long timeout
-
-
Constructor Details
-
FileLfsServlet
Constructor for FileLfsServlet.
- Parameters:
repository
- the repository storing the large objectstimeout
- timeout for object upload / download in milliseconds
-
-
Method Details
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws javax.servlet.ServletException, IOException Handle object downloads- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
getObjectToTransfer
protected AnyLongObjectId getObjectToTransfer(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws IOException Retrieve object id from request- Parameters:
req
- servlet requestrsp
- servlet response- Returns:
- object id, or
null
if the object id could not be retrieved - Throws:
IOException
- if an I/O error occurs- Since:
- 4.6
-
doPut
protected void doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws javax.servlet.ServletException, IOException Handle object uploads- Overrides:
doPut
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
sendError
protected static void sendError(javax.servlet.http.HttpServletResponse rsp, int status, String message) throws IOException Send an error response.- Parameters:
rsp
- the servlet responsestatus
- HTTP status codemessage
- error message- Throws:
IOException
- on failure to send the response- Since:
- 4.6
-