Package org.eclipse.jetty.servlet
Class DefaultServlet
- java.lang.Object
 - 
- javax.servlet.GenericServlet
 - 
- javax.servlet.http.HttpServlet
 - 
- org.eclipse.jetty.servlet.DefaultServlet
 
 
 
 
- 
- All Implemented Interfaces:
 java.io.Serializable,Servlet,ServletConfig,ResourceService.WelcomeFactory,ResourceFactory
@Deprecated(since="2021-05-27") public class DefaultServlet extends HttpServlet implements ResourceFactory, ResourceService.WelcomeFactory
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.The default servlet.This servlet, normally mapped to /, provides the handling for static content, OPTION and TRACE methods for the context. The following initParameters are supported, these can be set either on the servlet itself or as ServletContext initParameters with a prefix of org.eclipse.jetty.servlet.Default. :
acceptRanges If true, range requests and responses are supported dirAllowed If true, directory listings are returned if no welcome file is found. Else 403 Forbidden. welcomeServlets If true, attempt to dispatch to welcome files that are servlets, but only after no matching static resources could be found. If false, then a welcome file must exist on disk. If "exact", then exact servlet matches are supported without an existing file. Default is true. This must be false if you want directory listings, but have index.jsp in your welcome file list. redirectWelcome If true, welcome files are redirected rather than forwarded to. gzip If set to true, then static content will be served as gzip content encoded if a matching resource is found ending with ".gz" (default false) (deprecated: use precompressed) precompressed If set to a comma separated list of encoding types (that may be listed in a requests Accept-Encoding header) to file extension mappings to look for and serve. For example: "br=.br,gzip=.gz,bzip2=.bz". If set to a boolean True, then a default set of compressed formats will be used, otherwise no precompressed formats. resourceBase Set to replace the context resource base resourceCache If set, this is a context attribute name, which the servlet will use to look for a shared ResourceCache instance. relativeResourceBase Set with a pathname relative to the base of the servlet context root. Useful for only serving static content out of only specific subdirectories. pathInfoOnly If true, only the path info will be applied to the resourceBase stylesheet Set with the location of an optional stylesheet that will be used to decorate the directory listing html. etags If True, weak etags will be generated and handled. maxCacheSize The maximum total size of the cache or 0 for no cache. maxCachedFileSize The maximum size of a file to cache maxCachedFiles The maximum number of files to cache useFileMappedBuffer If set to true, it will use mapped file buffer to serve static content when using NIO connector. Setting this value to false means that a direct buffer will be used instead of a mapped file buffer. This is set to false by default by this class, but may be overridden by eg webdefault.xml cacheControl If set, all static content will have this value set as the cache-control header. otherGzipFileExtensions Other file extensions that signify that a file is already compressed. Eg ".svgz" encodingHeaderCacheSize Max entries in a cache of ACCEPT-ENCODING headers.- See Also:
 - Serialized Form
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONTEXT_INITDeprecated. 
- 
Constructor Summary
Constructors Constructor Description DefaultServlet()Deprecated.DefaultServlet(ResourceService resourceService)Deprecated. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddestroy()Deprecated.Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.java.lang.StringgetInitParameter(java.lang.String name)Deprecated.Returns aStringcontaining the value of the named initialization parameter, ornullif the parameter does not exist.ResourcegetResource(java.lang.String pathInContext)Deprecated.get Resource to serve.java.lang.StringgetWelcomeFile(java.lang.String pathInContext)Deprecated.Finds a matching welcome file for the suppliedResource.voidinit()Deprecated.A convenience method which can be overridden so that there's no need to callsuper.init(config).- 
Methods inherited from class javax.servlet.http.HttpServlet
service 
- 
Methods inherited from class javax.servlet.GenericServlet
getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log 
 - 
 
 - 
 
- 
- 
Field Detail
- 
CONTEXT_INIT
public static final java.lang.String CONTEXT_INIT
Deprecated.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Constructor Detail
- 
DefaultServlet
public DefaultServlet(ResourceService resourceService)
Deprecated. 
- 
DefaultServlet
public DefaultServlet()
Deprecated. 
 - 
 
- 
Method Detail
- 
init
public void init() throws UnavailableExceptionDeprecated.Description copied from class:GenericServletA convenience method which can be overridden so that there's no need to callsuper.init(config).Instead of overriding
GenericServlet.init(ServletConfig), simply override this method and it will be called byGenericServlet.init(ServletConfig config). TheServletConfigobject can still be retrieved viaGenericServlet.getServletConfig().- Overrides:
 initin classGenericServlet- Throws:
 UnavailableException
 
- 
getInitParameter
public java.lang.String getInitParameter(java.lang.String name)
Deprecated.Description copied from class:GenericServletReturns aStringcontaining the value of the named initialization parameter, ornullif the parameter does not exist. SeeServletConfig.getInitParameter(java.lang.String).This method is supplied for convenience. It gets the value of the named parameter from the servlet's
ServletConfigobject.- Specified by:
 getInitParameterin interfaceServletConfig- Overrides:
 getInitParameterin classGenericServlet- Parameters:
 name- aStringspecifying the name of the initialization parameter- Returns:
 - String a 
Stringcontaining the value of the initialization parameter 
 
- 
getResource
public Resource getResource(java.lang.String pathInContext)
Deprecated.get Resource to serve. Map a path to a resource. The default implementation calls HttpContext.getResource but derived servlets may provide their own mapping.- Specified by:
 getResourcein interfaceResourceFactory- Parameters:
 pathInContext- The path to find a resource for.- Returns:
 - The resource to serve.
 
 
- 
destroy
public void destroy()
Deprecated.Description copied from class:GenericServletCalled by the servlet container to indicate to a servlet that the servlet is being taken out of service. SeeServlet.destroy().- Specified by:
 destroyin interfaceServlet- Overrides:
 destroyin classGenericServlet
 
- 
getWelcomeFile
public java.lang.String getWelcomeFile(java.lang.String pathInContext)
Deprecated.Description copied from interface:ResourceService.WelcomeFactoryFinds a matching welcome file for the suppliedResource.- Specified by:
 getWelcomeFilein interfaceResourceService.WelcomeFactory- Parameters:
 pathInContext- the path of the request- Returns:
 - The path of the matching welcome file in context or null.
 
 
 - 
 
 -