public class ResourceHandler extends HandlerWrapper
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
_handler
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
Constructor and Description |
---|
ResourceHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
doDirectory(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Resource resource) |
protected void |
doResponseHeaders(javax.servlet.http.HttpServletResponse response,
Resource resource,
String mimeType)
Set the response headers.
|
void |
doStart() |
Resource |
getBaseResource() |
String |
getCacheControl() |
MimeTypes |
getMimeTypes() |
protected Resource |
getResource(javax.servlet.http.HttpServletRequest request) |
Resource |
getResource(String path) |
String |
getResourceBase() |
Resource |
getStylesheet() |
protected Resource |
getWelcome(Resource directory) |
String[] |
getWelcomeFiles() |
void |
handle(String target,
Request baseRequest,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.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, setServer
dump, expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
dumpThis, getServer
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage
addLifeCycleListener, getState, getState, 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 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
doStart
in class HandlerWrapper
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(javax.servlet.http.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, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.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 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.IOException
javax.servlet.ServletException
protected void doDirectory(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Resource resource) throws IOException
IOException
protected void doResponseHeaders(javax.servlet.http.HttpServletResponse response, Resource resource, String mimeType)
response
- resource
- mimeType
- Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.