com.mortbay.HTTP.Handler
Class ForwardHandler
java.lang.Object
|
+--com.mortbay.HTTP.Handler.NullHandler
|
+--com.mortbay.HTTP.Handler.ForwardHandler
- public class ForwardHandler
- extends NullHandler
Forward HttpHandler
This handler forwards a request onto another HttpServer.
It is configured with a PathMap of paths to URL instances.
The request is forwarded to the host and port of the URL with the matching
part of the request path translated to the path provided in the URL.
Forwarding is different to a redirect as the response is still passed
through this server and may be filtered or modified is some other fashion.
Proxy HTTP servers are supported.
Notes
ForwardHandler should not be placed after the ParamHandler unless it is
known that no form or query content will be forwarded. As ParamHandler
moves all form content and cookies to the parameters, these will be
duplicated in the query content of the forwarded request.
- Version:
- $Id: ForwardHandler.java,v 2.7 2000/01/17 15:30:28 gregw Exp $
- Author:
- Greg Wilkins
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ForwardHandler
public ForwardHandler(java.util.Properties properties)
throws java.io.IOException
- Construct from properties.
- Parameters:
properties
- Passed to setProperties
ForwardHandler
public ForwardHandler(PathMap forwardMap)
- Construct a ForwardHandler
- Parameters:
forwardMap
- Maps path to a URL
ForwardHandler
public ForwardHandler(PathMap forwardMap,
InetAddrPort proxy)
- Construct a ForwardHandler that uses a HTTP proxy.
- Parameters:
forwardMap
- Maps path to a URL
setProperties
public void setProperties(java.util.Properties properties)
throws java.io.IOException
- Configure from Properties.
Properties are assumed to be in the format of a PropertyTree
like:
ProxyAddrPort : 0.0.0.0:1234
FORWARD.name.PATHS : /pathSpec;/list%
FORWARD.name.URL : http:/forward/url
The Proxy address is optional.
- Overrides:
- setProperties in class NullHandler
- Parameters:
properties
- Configuration.
handle
public void handle(HttpRequest request,
HttpResponse response)
throws java.io.IOException
- Handle forward for requests.
- Overrides:
- handle in class NullHandler
- Tags copied from interface: HttpHandler
- Parameters:
request
- The HTTP requests to be handledresponse
- The HTTP response to be used.