Package org.eclipse.jetty.server.handler
Class ResourceHandler
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.eclipse.jetty.server.handler.AbstractHandlerContainer
org.eclipse.jetty.server.handler.HandlerWrapper
org.eclipse.jetty.server.handler.ResourceHandler
- All Implemented Interfaces:
Handler
,HandlerContainer
,ResourceService.WelcomeFactory
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,ResourceFactory
@Deprecated(since="2021-05-27")
public class ResourceHandler
extends HandlerWrapper
implements ResourceFactory, ResourceService.WelcomeFactory
Deprecated.
The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
Resource Handler.
This handle will serve static content and handle If-Modified-Since headers. No caching is done. Requests for resources that do not exist are let pass (Eg no
404's).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.server.handler.AbstractHandler
AbstractHandler.ErrorDispatchHandler
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
doStart()
Deprecated.Deprecated.Deprecated.static Resource
Deprecated.Deprecated.Deprecated.int
Deprecated.int
Deprecated.Deprecated.getResource
(String path) Deprecated.Get a resource for a path.Deprecated.Deprecated.getWelcomeFile
(String pathInContext) Deprecated.Finds a matching welcome file for the suppliedResource
.String[]
Deprecated.void
handle
(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) Deprecated.Handle a request.boolean
Deprecated.boolean
Deprecated.boolean
Deprecated.Get the directory option.boolean
isEtags()
Deprecated.boolean
isGzip()
Deprecated.boolean
Deprecated.boolean
Deprecated.void
setAcceptRanges
(boolean acceptRanges) Deprecated.void
setBaseResource
(Resource base) Deprecated.void
setCacheControl
(String cacheControl) Deprecated.void
setDirAllowed
(boolean dirAllowed) Deprecated.void
setDirectoriesListed
(boolean directory) Deprecated.Set the directory.void
setEtags
(boolean etags) Deprecated.void
setGzip
(boolean gzip) Deprecated.void
setGzipEquivalentFileExtensions
(List<String> gzipEquivalentFileExtensions) Deprecated.void
setMimeTypes
(MimeTypes mimeTypes) Deprecated.void
setMinAsyncContentLength
(int minAsyncContentLength) Deprecated.void
setMinMemoryMappedContentLength
(int minMemoryMappedFileSize) Deprecated.void
setPathInfoOnly
(boolean pathInfoOnly) Deprecated.void
setPrecompressedFormats
(CompressedContentFormat[] precompressedFormats) Deprecated.void
setRedirectWelcome
(boolean redirectWelcome) Deprecated.void
setResourceBase
(String resourceBase) Deprecated.void
setStylesheet
(String stylesheet) Deprecated.void
setWelcomeFiles
(String[] welcomeFiles) Deprecated.Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
destroy, getHandler, getHandlers, insertHandler, setHandler
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer
findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServer
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
getServer
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Constructor Details
-
ResourceHandler
Deprecated. -
ResourceHandler
public ResourceHandler()Deprecated.
-
-
Method Details
-
getWelcomeFile
Deprecated.Description copied from interface:ResourceService.WelcomeFactory
Finds a matching welcome file for the suppliedResource
.- Specified by:
getWelcomeFile
in interfaceResourceService.WelcomeFactory
- Parameters:
pathInContext
- the path of the request- Returns:
- The path of the matching welcome file in context or null.
-
doStart
Deprecated.- Throws:
Exception
-
getBaseResource
Deprecated.- Returns:
- Returns the resourceBase.
-
getCacheControl
Deprecated.- Returns:
- the cacheControl header to set on all static content.
-
getGzipEquivalentFileExtensions
Deprecated.- Returns:
- file extensions that signify that a file is gzip compressed. Eg ".svgz"
-
getMimeTypes
Deprecated. -
getMinAsyncContentLength
Deprecated.Get the minimum content length for async handling.- Returns:
- The minimum size in bytes of the content before asynchronous handling is used, or -1 for no async handling or 0 (default) for using
ServletResponse.getBufferSize()
as the minimum length.
-
getMinMemoryMappedContentLength
Deprecated.Get minimum memory mapped file content length.- Returns:
- the minimum size in bytes of a file resource that will be served using a memory mapped buffer, or -1 (default) for no memory mapped buffers.
-
getResource
Deprecated.Description copied from interface:ResourceFactory
Get a resource for a path.- Specified by:
getResource
in interfaceResourceFactory
- Parameters:
path
- The path to the resource- Returns:
- The resource or null
-
getResourceBase
Deprecated.- Returns:
- Returns the base resource as a string.
-
getStylesheet
Deprecated.- Returns:
- Returns the stylesheet as a Resource.
-
getDefaultStylesheet
Deprecated. -
getWelcomeFiles
Deprecated. -
handle
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException Deprecated.Description copied from interface:Handler
Handle a request.- Specified by:
handle
in interfaceHandler
- Overrides:
handle
in classHandlerWrapper
- Parameters:
target
- The target of the request - either a URI or a name.baseRequest
- The original unwrapped request object.request
- The request either as theRequest
object or a wrapper of that request. The
method can be used access the Request object if required.HttpConnection.getCurrentConnection()
.getHttpChannel()
.getRequest()
response
- The response as theResponse
object or a wrapper of that request. The
method can be used access the Response object if required.HttpConnection.getCurrentConnection()
.getHttpChannel()
.getResponse()
- Throws:
IOException
- if unable to handle the request or response processingServletException
- if unable to handle the request or response due to underlying servlet issue
-
isAcceptRanges
public boolean isAcceptRanges()Deprecated.- Returns:
- If true, range requests and responses are supported
-
isDirAllowed
public boolean isDirAllowed()Deprecated.- Returns:
- If true, directory listings are returned if no welcome file is found. Else 403 Forbidden.
-
isDirectoriesListed
public boolean isDirectoriesListed()Deprecated.Get the directory option.- Returns:
- true if directories are listed.
-
isEtags
public boolean isEtags()Deprecated.- Returns:
- True if ETag processing is done
-
isGzip
Deprecated.- Returns:
- If set to true, then static content will be served as gzip content encoded if a matching resource is found ending with ".gz"
-
getPrecompressedFormats
Deprecated.- Returns:
- Precompressed resources formats that can be used to serve compressed variant of resources.
-
isPathInfoOnly
public boolean isPathInfoOnly()Deprecated.- Returns:
- true, only the path info will be applied to the resourceBase
-
isRedirectWelcome
public boolean isRedirectWelcome()Deprecated.- Returns:
- If true, welcome files are redirected rather than forwarded to.
-
setAcceptRanges
public void setAcceptRanges(boolean acceptRanges) Deprecated.- Parameters:
acceptRanges
- If true, range requests and responses are supported
-
setBaseResource
Deprecated.- Parameters:
base
- The resourceBase to server content from. If null the context resource base is used.
-
setCacheControl
Deprecated.- Parameters:
cacheControl
- the cacheControl header to set on all static content.
-
setDirAllowed
public void setDirAllowed(boolean dirAllowed) Deprecated.- Parameters:
dirAllowed
- If true, directory listings are returned if no welcome file is found. Else 403 Forbidden.
-
setDirectoriesListed
public void setDirectoriesListed(boolean directory) Deprecated.Set the directory.- Parameters:
directory
- true if directories are listed.
-
setEtags
public void setEtags(boolean etags) Deprecated.- Parameters:
etags
- True if ETag processing is done
-
setGzip
Deprecated.- Parameters:
gzip
- If set to true, then static content will be served as gzip content encoded if a matching resource is found ending with ".gz"
-
setGzipEquivalentFileExtensions
Deprecated.- Parameters:
gzipEquivalentFileExtensions
- file extensions that signify that a file is gzip compressed. Eg ".svgz"
-
setPrecompressedFormats
Deprecated.- Parameters:
precompressedFormats
- The list of precompresed formats to serve in encoded format if matching resource found. For example serve gzip encoded file if ".gz" suffixed resource is found.
-
setMimeTypes
Deprecated. -
setMinAsyncContentLength
Deprecated.Set the minimum content length for async handling.- Parameters:
minAsyncContentLength
- The minimum size in bytes of the content before asynchronous handling is used, or -1 for no async handling or 0 for usingServletResponse.getBufferSize()
as the minimum length.
-
setMinMemoryMappedContentLength
Deprecated.Set minimum memory mapped file content length.- Parameters:
minMemoryMappedFileSize
- the minimum size in bytes of a file resource that will be served using a memory mapped buffer, or -1 for no memory mapped buffers.
-
setPathInfoOnly
public void setPathInfoOnly(boolean pathInfoOnly) Deprecated.- Parameters:
pathInfoOnly
- true, only the path info will be applied to the resourceBase
-
setRedirectWelcome
public void setRedirectWelcome(boolean redirectWelcome) Deprecated.- Parameters:
redirectWelcome
- If true, welcome files are redirected rather than forwarded to. redirection is always used if the ResourceHandler is not scoped by a ContextHandler
-
setResourceBase
Deprecated.- Parameters:
resourceBase
- The base resource as a string.
-
setStylesheet
Deprecated.- Parameters:
stylesheet
- The location of the stylesheet to be used as a String.
-
setWelcomeFiles
Deprecated.
-