public class ResourceHandler extends HandlerWrapper
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.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, setServer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
doStop, dumpThis, getServer
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, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public 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
ContainerLifeCycle
doStart
in class AbstractHandler
Exception
public 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
MalformedURLException
protected Resource getResource(HttpServletRequest request) throws MalformedURLException
MalformedURLException
public String[] getWelcomeFiles()
public void setWelcomeFiles(String[] welcomeFiles)
protected Resource getWelcome(Resource directory) throws MalformedURLException, IOException
MalformedURLException
IOException
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, 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 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.IOException
ServletException
protected void doDirectory(HttpServletRequest request, HttpServletResponse response, Resource resource) throws IOException
IOException
protected void doResponseHeaders(HttpServletResponse response, Resource resource, String mimeType)
response
- resource
- mimeType
- Copyright © 1995-2015 Webtide. All Rights Reserved.