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

    Fields
    Modifier and Type
    Field
    Description
    private final FileLfsRepository
     
    private static final long
     
    private final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    FileLfsServlet(FileLfsRepository repository, long timeout)
    Constructor for FileLfsServlet.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp)
    Handle object downloads
    protected void
    doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp)
    Handle object uploads
    protected AnyLongObjectId
    getObjectToTransfer(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp)
    Retrieve object id from request
    protected static void
    sendError(javax.servlet.http.HttpServletResponse rsp, int status, String message)
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • FileLfsServlet

      public FileLfsServlet(FileLfsRepository repository, long timeout)

      Constructor for FileLfsServlet.

      Parameters:
      repository - the repository storing the large objects
      timeout - 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 class javax.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 request
      rsp - 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 class javax.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 response
      status - HTTP status code
      message - error message
      Throws:
      IOException - on failure to send the response
      Since:
      4.6