org.mortbay.http.handler
Class ForwardHandler
- HttpHandler, LifeCycle, Serializable
public class ForwardHandler
Forward Request Handler.
Forwards a request to a new URI. Experimental - use with caution.
void | addForward(String pathSpecInContext, String newPath) - Add a forward mapping.
|
void | handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) - Handle a request.
|
void | setHandleQueries(boolean b) - Set the Handler up to cope with forwards to paths that contain query
elements (e.g.
|
void | setRootForward(String newPath) - Add a forward mapping for root path.
|
ForwardHandler
public ForwardHandler()
Constructor.
ForwardHandler
public ForwardHandler(String rootForward)
Constructor.
addForward
public void addForward(String pathSpecInContext,
String newPath)
Add a forward mapping.
pathSpecInContext
- The path to forward fromnewPath
- The path to forward to.
handle
public void handle(String pathInContext,
String pathParams,
HttpRequest request,
HttpResponse response)
throws HttpException,
IOException
Handle a request.
Note that Handlers are tried in order until one has handled the
request. i.e. until request.isHandled() returns true.
In broad terms this means, either a response has been commited
or request.setHandled(true) has been called.
- handle in interface HttpHandler
pathInContext
- The context pathpathParams
- Path parameters such as encoded Session IDrequest
- The HttpRequest requestresponse
- The HttpResponse response
setHandleQueries
public void setHandleQueries(boolean b)
Set the Handler up to cope with forwards to paths that contain query
elements (e.g. "/blah"->"/foo?a=b").
setRootForward
public void setRootForward(String newPath)
Add a forward mapping for root path.
This allows a forward for exactly / which is the default
path in a pathSpec.
newPath
- The path to forward to.
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.