public class ResourceHandler extends AbstractHandler
_string
Constructor and Description |
---|
ResourceHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
doResponseHeaders(HttpServletResponse response,
Resource resource,
String mimeType)
Set the response headers.
|
void |
doStart() |
Resource |
getBaseResource() |
String |
getCacheControl() |
MimeTypes |
getMimeTypes() |
protected Resource |
getResource(HttpServletRequest request) |
Resource |
getResource(String path) |
String |
getResourceBase() |
protected Resource |
getWelcome(Resource directory) |
String[] |
getWelcomeFiles() |
void |
handle(String target,
HttpServletRequest request,
HttpServletResponse response,
int dispatch)
Handle a request.
|
boolean |
isAliases() |
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 |
setMimeTypes(MimeTypes mimeTypes) |
void |
setResourceBase(String resourceBase) |
void |
setWelcomeFiles(String[] welcomeFiles) |
destroy, doStop, getServer, setServer, toString
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)
aliases
- True if aliases are supported.public void doStart() throws Exception
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 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, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
Handler
target
- The target of the request - either a URI or a name.request
- The request either as the Request
object or a wrapper of that request. The HttpConnection.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 HttpConnection.getCurrentConnection()
method can be used access the Response object if required.dispatch
- The dispatch mode: Handler.REQUEST
, Handler.FORWARD
, Handler.INCLUDE
, Handler.ERROR
IOException
ServletException
protected void doResponseHeaders(HttpServletResponse response, Resource resource, String mimeType)
response
- resource
- mimeType
- Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.