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 FileLfsRepositoryprivate static final longprivate final long -
Constructor Summary
ConstructorsConstructorDescriptionFileLfsServlet(FileLfsRepository repository, long timeout) Constructor for FileLfsServlet. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) Handle object downloadsprotected voiddoPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) Handle object uploadsprotected AnyLongObjectIdgetObjectToTransfer(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) Retrieve object id from requestprotected static voidSend an error response.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doTrace, getLastModified, service, serviceMethods 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:
doGetin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
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
nullif 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:
doPutin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
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
-