Handler, HandlerContainer, ResourceService.WelcomeFactory, Container, Destroyable, Dumpable, LifeCycle, ResourceFactorypublic class ResourceHandler extends HandlerWrapper implements ResourceFactory, ResourceService.WelcomeFactory
AbstractHandler.ErrorDispatchHandlerAbstractLifeCycle.AbstractLifeCycleListenerContainer.InheritedListener, Container.ListenerLifeCycle.ListenerFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING_handler| Constructor | Description |
|---|---|
ResourceHandler() |
|
ResourceHandler(ResourceService resourceService) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
doStart() |
|
Resource |
getBaseResource() |
|
java.lang.String |
getCacheControl() |
|
java.util.List<java.lang.String> |
getGzipEquivalentFileExtensions() |
|
MimeTypes |
getMimeTypes() |
|
int |
getMinAsyncContentLength() |
Deprecated.
|
int |
getMinMemoryMappedContentLength() |
Deprecated.
|
CompressedContentFormat[] |
getPrecompressedFormats() |
|
Resource |
getResource(java.lang.String path) |
|
java.lang.String |
getResourceBase() |
|
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(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(MimeTypes mimeTypes) |
|
void |
setMinAsyncContentLength(int minAsyncContentLength) |
Deprecated.
|
void |
setMinMemoryMappedContentLength(int minMemoryMappedFileSize) |
Deprecated.
|
void |
setPathInfoOnly(boolean pathInfoOnly) |
|
void |
setPrecompressedFormats(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, getServerexpandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServeraddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopaddBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansdestroy, expandChildren, getHandler, getHandlers, insertHandler, setHandleraddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stoppublic ResourceHandler(ResourceService resourceService)
public ResourceHandler()
public java.lang.String getWelcomeFile(java.lang.String pathInContext)
ResourceService.WelcomeFactoryResource.getWelcomeFile in interface ResourceService.WelcomeFactorypathInContext - the path of the requestpublic void doStart()
throws java.lang.Exception
doStart in class AbstractHandlerjava.lang.Exceptionpublic Resource getBaseResource()
public java.lang.String getCacheControl()
public java.util.List<java.lang.String> getGzipEquivalentFileExtensions()
public MimeTypes getMimeTypes()
@Deprecated public int getMinAsyncContentLength()
ServletResponse.getBufferSize() as the minimum length.@Deprecated public int getMinMemoryMappedContentLength()
public Resource getResource(java.lang.String path)
getResource in interface ResourceFactorypublic java.lang.String getResourceBase()
public 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
Handlerhandle in interface Handlerhandle in class HandlerWrappertarget - 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 CompressedContentFormat[] getPrecompressedFormats()
public boolean isPathInfoOnly()
public boolean isRedirectWelcome()
public void setAcceptRanges(boolean acceptRanges)
acceptRanges - If true, range requests and responses are supportedpublic void setBaseResource(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(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(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.
redirection is always used if the ResourceHandler is not scoped by
a ContextHandlerpublic 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.