Handler
, HandlerContainer
, ResourceService.WelcomeFactory
, org.eclipse.jetty.util.component.Destroyable
, org.eclipse.jetty.util.component.LifeCycle
, org.eclipse.jetty.util.resource.ResourceFactory
public class ResourceHandler extends HandlerWrapper implements org.eclipse.jetty.util.resource.ResourceFactory, ResourceService.WelcomeFactory
AbstractHandler.ErrorDispatchHandler
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
_handler
Constructor | Description |
---|---|
ResourceHandler() |
|
ResourceHandler(ResourceService resourceService) |
Modifier and Type | Method | Description |
---|---|---|
void |
doStart() |
|
org.eclipse.jetty.util.resource.Resource |
getBaseResource() |
|
java.lang.String |
getCacheControl() |
|
java.util.List<java.lang.String> |
getGzipEquivalentFileExtensions() |
|
org.eclipse.jetty.http.MimeTypes |
getMimeTypes() |
|
int |
getMinAsyncContentLength() |
Deprecated.
|
int |
getMinMemoryMappedContentLength() |
Deprecated.
|
org.eclipse.jetty.http.CompressedContentFormat[] |
getPrecompressedFormats() |
|
org.eclipse.jetty.util.resource.Resource |
getResource(java.lang.String path) |
|
java.lang.String |
getResourceBase() |
|
org.eclipse.jetty.util.resource.Resource |
getStylesheet() |
|
java.lang.String |
getWelcomeFile(java.lang.String pathInContext) |
Finds a matching welcome file for the supplied
Resource . |
java.lang.String[] |
getWelcomeFiles() |
|
void |
handle(java.lang.String target,
Request baseRequest,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
Handle a request.
|
boolean |
isAcceptRanges() |
|
boolean |
isDirAllowed() |
|
boolean |
isDirectoriesListed() |
Get the directory option.
|
boolean |
isEtags() |
|
boolean |
isGzip() |
Deprecated.
|
boolean |
isPathInfoOnly() |
|
boolean |
isRedirectWelcome() |
|
void |
setAcceptRanges(boolean acceptRanges) |
|
void |
setBaseResource(org.eclipse.jetty.util.resource.Resource base) |
|
void |
setCacheControl(java.lang.String cacheControl) |
|
void |
setDirAllowed(boolean dirAllowed) |
|
void |
setDirectoriesListed(boolean directory) |
Set the directory.
|
void |
setEtags(boolean etags) |
|
void |
setGzip(boolean gzip) |
Deprecated.
|
void |
setGzipEquivalentFileExtensions(java.util.List<java.lang.String> gzipEquivalentFileExtensions) |
|
void |
setMimeTypes(org.eclipse.jetty.http.MimeTypes mimeTypes) |
|
void |
setMinAsyncContentLength(int minAsyncContentLength) |
Deprecated.
|
void |
setMinMemoryMappedContentLength(int minMemoryMappedFileSize) |
Deprecated.
|
void |
setPathInfoOnly(boolean pathInfoOnly) |
|
void |
setPrecompressedFormats(org.eclipse.jetty.http.CompressedContentFormat[] precompressedFormats) |
|
void |
setRedirectWelcome(boolean redirectWelcome) |
|
void |
setResourceBase(java.lang.String resourceBase) |
|
void |
setStylesheet(java.lang.String stylesheet) |
|
void |
setWelcomeFiles(java.lang.String[] welcomeFiles) |
doError, doStop, dumpThis, getServer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServer
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
addBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
destroy, expandChildren, getHandler, getHandlers, insertHandler, setHandler
public ResourceHandler(ResourceService resourceService)
public ResourceHandler()
public java.lang.String getWelcomeFile(java.lang.String pathInContext)
ResourceService.WelcomeFactory
Resource
.getWelcomeFile
in interface ResourceService.WelcomeFactory
pathInContext
- the path of the requestpublic void doStart() throws java.lang.Exception
doStart
in class AbstractHandler
java.lang.Exception
public org.eclipse.jetty.util.resource.Resource getBaseResource()
public java.lang.String getCacheControl()
public java.util.List<java.lang.String> getGzipEquivalentFileExtensions()
public org.eclipse.jetty.http.MimeTypes getMimeTypes()
@Deprecated public int getMinAsyncContentLength()
ServletResponse.getBufferSize()
as the minimum length.@Deprecated public int getMinMemoryMappedContentLength()
public org.eclipse.jetty.util.resource.Resource getResource(java.lang.String path)
getResource
in interface org.eclipse.jetty.util.resource.ResourceFactory
public java.lang.String getResourceBase()
public org.eclipse.jetty.util.resource.Resource getStylesheet()
public java.lang.String[] getWelcomeFiles()
public void handle(java.lang.String target, Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
Handler
handle
in interface Handler
handle
in class HandlerWrapper
target
- The target of the request - either a URI or a name.baseRequest
- The original unwrapped request object.request
- The request either as the Request
object or a wrapper of that request. The
HttpConnection.getCurrentConnection()
.getHttpChannel()
.getRequest()
method can be used access the Request object if required.response
- The response as the Response
object or a wrapper of that request. The
HttpConnection.getCurrentConnection()
.getHttpChannel()
.getResponse()
method can be used access the Response object if required.java.io.IOException
- if unable to handle the request or response processingjavax.servlet.ServletException
- if unable to handle the request or response due to underlying servlet issuepublic boolean isAcceptRanges()
public boolean isDirAllowed()
public boolean isDirectoriesListed()
public boolean isEtags()
@Deprecated public boolean isGzip()
public org.eclipse.jetty.http.CompressedContentFormat[] getPrecompressedFormats()
public boolean isPathInfoOnly()
public boolean isRedirectWelcome()
public void setAcceptRanges(boolean acceptRanges)
acceptRanges
- If true, range requests and responses are supportedpublic void setBaseResource(org.eclipse.jetty.util.resource.Resource base)
base
- The resourceBase to server content from. If null the
context resource base is used.public void setCacheControl(java.lang.String cacheControl)
cacheControl
- the cacheControl header to set on all static content.public void setDirAllowed(boolean dirAllowed)
dirAllowed
- If true, directory listings are returned if no welcome file is found. Else 403 Forbidden.public void setDirectoriesListed(boolean directory)
directory
- true if directories are listed.public void setEtags(boolean etags)
etags
- True if ETag processing is done@Deprecated public void setGzip(boolean gzip)
gzip
- If set to true, then static content will be served as gzip content encoded if a matching resource is found ending with ".gz"public void setGzipEquivalentFileExtensions(java.util.List<java.lang.String> gzipEquivalentFileExtensions)
gzipEquivalentFileExtensions
- file extensions that signify that a file is gzip compressed. Eg ".svgz"public void setPrecompressedFormats(org.eclipse.jetty.http.CompressedContentFormat[] precompressedFormats)
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.public void setMimeTypes(org.eclipse.jetty.http.MimeTypes mimeTypes)
@Deprecated public void setMinAsyncContentLength(int minAsyncContentLength)
minAsyncContentLength
- The minimum size in bytes of the content before asynchronous handling is used, or -1 for no async handling or 0 for using
ServletResponse.getBufferSize()
as the minimum length.@Deprecated public void setMinMemoryMappedContentLength(int minMemoryMappedFileSize)
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.public void setPathInfoOnly(boolean pathInfoOnly)
pathInfoOnly
- true, only the path info will be applied to the resourceBasepublic void setRedirectWelcome(boolean redirectWelcome)
redirectWelcome
- If true, welcome files are redirected rather than forwarded to.public void setResourceBase(java.lang.String resourceBase)
resourceBase
- The base resource as a string.public void setStylesheet(java.lang.String stylesheet)
stylesheet
- The location of the stylesheet to be used as a String.public void setWelcomeFiles(java.lang.String[] welcomeFiles)
Copyright © 1995–2018 Webtide. All rights reserved.