public class ResourceHandler extends HandlerWrapper implements ResourceFactory, ResourceService.WelcomeFactory
AbstractHandler.ErrorDispatchHandlerAbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Constructor and Description |
|---|
ResourceHandler() |
ResourceHandler(ResourceService resourceService) |
| Modifier and Type | Method and Description |
|---|---|
void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
Resource |
getBaseResource() |
String |
getCacheControl() |
List<String> |
getGzipEquivalentFileExtensions() |
MimeTypes |
getMimeTypes() |
int |
getMinAsyncContentLength()
Deprecated.
|
int |
getMinMemoryMappedContentLength()
Deprecated.
|
CompressedContentFormat[] |
getPrecompressedFormats() |
Resource |
getResource(String path)
Get a resource for a path.
|
String |
getResourceBase() |
Resource |
getStylesheet() |
String |
getWelcomeFile(String pathInContext)
Finds a matching welcome file for the supplied
Resource. |
String[] |
getWelcomeFiles() |
void |
handle(String target,
Request baseRequest,
HttpServletRequest request,
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(String cacheControl) |
void |
setDirAllowed(boolean dirAllowed) |
void |
setDirectoriesListed(boolean directory)
Set the directory.
|
void |
setEtags(boolean etags) |
void |
setGzip(boolean gzip)
Deprecated.
|
void |
setGzipEquivalentFileExtensions(List<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(String resourceBase) |
void |
setStylesheet(String stylesheet) |
void |
setWelcomeFiles(String[] welcomeFiles) |
destroy, getHandler, getHandlers, insertHandler, setHandlerfindContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServergetServeraddBean, 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, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stopdumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, namedpublic ResourceHandler(ResourceService resourceService)
public ResourceHandler()
public String getWelcomeFile(String pathInContext)
ResourceService.WelcomeFactoryResource.getWelcomeFile in interface ResourceService.WelcomeFactorypathInContext - the path of the requestpublic void doStart()
throws Exception
ContainerLifeCycleExceptionpublic Resource getBaseResource()
public String getCacheControl()
public List<String> getGzipEquivalentFileExtensions()
public MimeTypes getMimeTypes()
@Deprecated public int getMinAsyncContentLength()
ServletResponse.getBufferSize() as the minimum length.@Deprecated public int getMinMemoryMappedContentLength()
public Resource getResource(String path)
ResourceFactorygetResource in interface ResourceFactorypath - The path to the resourcepublic String getResourceBase()
public Resource getStylesheet()
public String[] getWelcomeFiles()
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, 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.IOException - if unable to handle the request or response processingServletException - 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(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(List<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(String resourceBase)
resourceBase - The base resource as a string.public void setStylesheet(String stylesheet)
stylesheet - The location of the stylesheet to be used as a String.public void setWelcomeFiles(String[] welcomeFiles)
Copyright © 2010 - 2020 Adobe. All Rights Reserved