public class ResourceHandler extends HandlerWrapper
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.Listener_handler_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING| 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()
Start the managed lifecycle beans in the order they were added.
|
Resource |
getBaseResource() |
String |
getCacheControl() |
MimeTypes |
getMimeTypes() |
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 |
isAliases() |
boolean |
isDirectoriesListed()
Get the directory option.
|
boolean |
isEtags() |
void |
setAliases(boolean aliases)
Set if resource aliases (eg symlink, 8.3 names, case insensitivity) are allowed.
|
void |
setBaseResource(Resource base) |
void |
setCacheControl(String cacheControl) |
void |
setDirectoriesListed(boolean directory)
Set the directory.
|
void |
setEtags(boolean etags) |
void |
setMimeTypes(MimeTypes mimeTypes) |
void |
setResourceBase(String resourceBase) |
void |
setStylesheet(String stylesheet) |
void |
setWelcomeFiles(String[] welcomeFiles) |
destroy, doStop, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler, setServerdump, expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClassdumpThis, getServeraddBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanageaddLifeCycleListener, getState, getState, 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 isAliases()
public void setAliases(boolean aliases)
ContextHandler.isAliases() takes precedent.aliases - True if aliases are supported.public boolean isDirectoriesListed()
public void setDirectoriesListed(boolean directory)
directory - true if directories are listed.public boolean isEtags()
public void setEtags(boolean etags)
etags - True if ETag processing is donepublic void doStart()
throws Exception
AggregateLifeCycledoStart in class HandlerWrapperExceptionAbstractLifeCycle.doStart()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
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 AbstractHttpConnection.getCurrentConnection()
method can be used access the Request object if required.response - The response as the Response
object or a wrapper of that request. The AbstractHttpConnection.getCurrentConnection()
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-2013 Mort Bay Consulting. All Rights Reserved.