Class ResourceFileServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class ResourceFileServlet
    extends javax.servlet.http.HttpServlet
    ResourceFileServlet is a copy of org.mortbay.jetty.servlet.DefaultServlet that has been trimmed down to only support the subset of features that we want to take advantage of (e.g. no gzipping, no chunked encoding, no buffering, etc.). A number of Jetty-specific optimizations and assumptions have also been removed (e.g. use of custom header manipulation API's, use of ByteArrayBuffer instead of Strings, etc.).

    A few remaining Jetty-centric details remain, such as use of the ContextHandler.Context class, and Jetty-specific request attributes, but these are specific cases where there is no servlet-engine-neutral API available. This class also uses Jetty's Resource class as a convenience, but could be converted to use ServletContext.getResource(String) instead.

    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doGet​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Retrieve the static resource file indicated.
      protected void doPost​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      protected void doTrace​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      void init()
      Initialize the servlet by extracting some useful configuration data from the current ServletContext.
      protected boolean isProtectedPath​(String target)  
      • Methods inherited from class javax.servlet.http.HttpServlet

        doDelete, doHead, doOptions, doPut, getLastModified, service, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
    • Constructor Detail

      • ResourceFileServlet

        public ResourceFileServlet()
    • Method Detail

      • init

        public void init()
                  throws javax.servlet.ServletException
        Initialize the servlet by extracting some useful configuration data from the current ServletContext.
        Overrides:
        init in class javax.servlet.GenericServlet
        Throws:
        javax.servlet.ServletException
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException
        Retrieve the static resource file indicated.
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doPost

        protected void doPost​(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws javax.servlet.ServletException,
                              IOException
        Overrides:
        doPost in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doTrace

        protected void doTrace​(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws javax.servlet.ServletException,
                               IOException
        Overrides:
        doTrace in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • isProtectedPath

        protected boolean isProtectedPath​(String target)