Class ResourceService

java.lang.Object
org.eclipse.jetty.server.ResourceService

public class ResourceService extends Object
Abstract resource service, used by DefaultServlet and ResourceHandler
  • Field Details

    • LOG

      private static final Logger LOG
    • ACCEPT_RANGES

      private static final PreEncodedHttpField ACCEPT_RANGES
    • _contentFactory

      private HttpContent.ContentFactory _contentFactory
    • _welcomeFactory

      private ResourceService.WelcomeFactory _welcomeFactory
    • _acceptRanges

      private boolean _acceptRanges
    • _dirAllowed

      private boolean _dirAllowed
    • _redirectWelcome

      private boolean _redirectWelcome
    • _precompressedFormats

      private CompressedContentFormat[] _precompressedFormats
    • _preferredEncodingOrder

      private String[] _preferredEncodingOrder
    • _preferredEncodingOrderCache

      private final Map<String,List<String>> _preferredEncodingOrderCache
    • _encodingCacheSize

      private int _encodingCacheSize
    • _pathInfoOnly

      private boolean _pathInfoOnly
    • _etags

      private boolean _etags
    • _cacheControl

      private HttpField _cacheControl
    • _gzipEquivalentFileExtensions

      private List<String> _gzipEquivalentFileExtensions
  • Constructor Details

    • ResourceService

      public ResourceService()
  • Method Details

    • getContentFactory

      public HttpContent.ContentFactory getContentFactory()
    • setContentFactory

      public void setContentFactory(HttpContent.ContentFactory contentFactory)
    • getWelcomeFactory

      public ResourceService.WelcomeFactory getWelcomeFactory()
    • setWelcomeFactory

      public void setWelcomeFactory(ResourceService.WelcomeFactory welcomeFactory)
    • isAcceptRanges

      public boolean isAcceptRanges()
    • setAcceptRanges

      public void setAcceptRanges(boolean acceptRanges)
    • isDirAllowed

      public boolean isDirAllowed()
    • setDirAllowed

      public void setDirAllowed(boolean dirAllowed)
    • isRedirectWelcome

      public boolean isRedirectWelcome()
    • setRedirectWelcome

      public void setRedirectWelcome(boolean redirectWelcome)
    • getPrecompressedFormats

      public CompressedContentFormat[] getPrecompressedFormats()
    • setPrecompressedFormats

      public void setPrecompressedFormats(CompressedContentFormat[] precompressedFormats)
    • setEncodingCacheSize

      public void setEncodingCacheSize(int encodingCacheSize)
    • getEncodingCacheSize

      public int getEncodingCacheSize()
    • isPathInfoOnly

      public boolean isPathInfoOnly()
    • setPathInfoOnly

      public void setPathInfoOnly(boolean pathInfoOnly)
    • isEtags

      public boolean isEtags()
    • setEtags

      public void setEtags(boolean etags)
    • getCacheControl

      public HttpField getCacheControl()
    • setCacheControl

      public void setCacheControl(HttpField cacheControl)
    • getGzipEquivalentFileExtensions

      public List<String> getGzipEquivalentFileExtensions()
    • setGzipEquivalentFileExtensions

      public void setGzipEquivalentFileExtensions(List<String> gzipEquivalentFileExtensions)
    • doGet

      public boolean doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
      Throws:
      javax.servlet.ServletException
      IOException
    • getPreferredEncodingOrder

      private List<String> getPreferredEncodingOrder(javax.servlet.http.HttpServletRequest request)
    • getBestPrecompressedContent

      private CompressedContentFormat getBestPrecompressedContent(List<String> preferredEncodings, Collection<CompressedContentFormat> availableFormats)
    • sendWelcome

      protected void sendWelcome(HttpContent content, String pathInContext, boolean endsWithSlash, boolean included, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
      Throws:
      javax.servlet.ServletException
      IOException
    • isGzippedContent

      protected boolean isGzippedContent(String path)
    • hasDefinedRange

      private boolean hasDefinedRange(Enumeration<String> reqRanges)
    • notFound

      protected void notFound(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
      Throws:
      IOException
    • sendStatus

      protected void sendStatus(javax.servlet.http.HttpServletResponse response, int status, Supplier<String> etag) throws IOException
      Throws:
      IOException
    • passConditionalHeaders

      protected boolean passConditionalHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, HttpContent content) throws IOException
      Throws:
      IOException
    • sendDirectory

      protected void sendDirectory(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Resource resource, String pathInContext) throws IOException
      Throws:
      IOException
    • sendData

      protected boolean sendData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean include, HttpContent content, Enumeration<String> reqRanges) throws IOException
      Throws:
      IOException
    • putHeaders

      protected void putHeaders(javax.servlet.http.HttpServletResponse response, HttpContent content, long contentLength)