public class ResourceHandler extends HandlerWrapper
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener_handler| Constructor and Description |
|---|
ResourceHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doDirectory(HttpServletRequest request,
HttpServletResponse response,
Resource resource) |
protected void |
doResponseHeaders(HttpServletResponse response,
Resource resource,
String mimeType)
Set the response headers.
|
void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
Resource |
getBaseResource() |
String |
getCacheControl() |
MimeTypes |
getMimeTypes() |
int |
getMinAsyncContentLength()
Get the minimum content length for async handling.
|
int |
getMinMemoryMappedContentLength()
Get minimum memory mapped file content length.
|
protected Resource |
getResource(HttpServletRequest request) |
Resource |
getResource(String path) |
String |
getResourceBase() |
Resource |
getStylesheet() |
protected Resource |
getWelcome(Resource directory) |
String[] |
getWelcomeFiles() |
void |
handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
Handle a request.
|
boolean |
isDirectoriesListed()
Get the directory option.
|
boolean |
isEtags() |
void |
setBaseResource(Resource base) |
void |
setCacheControl(String cacheControl) |
void |
setDirectoriesListed(boolean directory)
Set the directory.
|
void |
setEtags(boolean etags) |
void |
setMimeTypes(MimeTypes mimeTypes) |
void |
setMinAsyncContentLength(int minAsyncContentLength)
Set the minimum content length for async handling.
|
void |
setMinMemoryMappedContentLength(int minMemoryMappedFileSize)
Set minimum memory mapped file content length.
|
void |
setResourceBase(String resourceBase) |
void |
setStylesheet(String stylesheet) |
void |
setWelcomeFiles(String[] welcomeFiles) |
destroy, expandChildren, getHandler, getHandlers, setHandler, setServerexpandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClassdoStop, dumpThis, getServeraddBean, 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, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic MimeTypes getMimeTypes()
public void setMimeTypes(MimeTypes mimeTypes)
public boolean isDirectoriesListed()
public void setDirectoriesListed(boolean directory)
directory - true if directories are listed.public int getMinMemoryMappedContentLength()
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 int getMinAsyncContentLength()
ServletResponse.getBufferSize() as the minimum length.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.public boolean isEtags()
public void setEtags(boolean etags)
etags - True if ETag processing is donepublic void doStart()
throws Exception
ContainerLifeCycledoStart in class AbstractHandlerExceptionpublic Resource getBaseResource()
public String getResourceBase()
public void setBaseResource(Resource base)
base - The resourceBase to set.public void setResourceBase(String resourceBase)
resourceBase - The base resource as a string.public Resource getStylesheet()
public void setStylesheet(String stylesheet)
stylesheet - The location of the stylesheet to be used as a String.public String getCacheControl()
public void setCacheControl(String cacheControl)
cacheControl - the cacheControl header to set on all static content.public Resource getResource(String path) throws MalformedURLException
MalformedURLExceptionprotected Resource getResource(HttpServletRequest request) throws MalformedURLException
MalformedURLExceptionpublic String[] getWelcomeFiles()
public void setWelcomeFiles(String[] welcomeFiles)
protected Resource getWelcome(Resource directory) throws MalformedURLException, IOException
MalformedURLExceptionIOExceptionpublic 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 HttpChannel.getCurrentHttpChannel()
method can be used access the Request object if required.response - The response as the Response
object or a wrapper of that request. The HttpChannel.getCurrentHttpChannel()
method can be used access the Response object if required.IOExceptionServletExceptionprotected void doDirectory(HttpServletRequest request, HttpServletResponse response, Resource resource) throws IOException
IOExceptionprotected void doResponseHeaders(HttpServletResponse response, Resource resource, String mimeType)
response - resource - mimeType - Copyright © 1995-2015 Webtide. All Rights Reserved.