Class 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:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      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
    • Constructor Detail

      • 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 Detail

      • 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