org.mortbay.servlet
Class ProxyServlet.Transparent
java.lang.Object
org.mortbay.servlet.ProxyServlet
org.mortbay.servlet.ProxyServlet.Transparent
- All Implemented Interfaces:
- Servlet
- Enclosing class:
- ProxyServlet
public static class ProxyServlet.Transparent
- extends ProxyServlet
Transparent Proxy.
This convenience extension to AsyncProxyServlet configures the servlet
as a transparent proxy. The servlet is configured with init parameter:
- ProxyTo - a URI like http://host:80/context to which the request is proxied.
- Prefix - a URI prefix that is striped from the start of the forwarded URI.
For example, if a request was received at /foo/bar and the ProxyTo was http://host:80/context
and the Prefix was /foo, then the request would be proxied to http://host:80/context/bar
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProxyServlet.Transparent
public ProxyServlet.Transparent()
ProxyServlet.Transparent
public ProxyServlet.Transparent(String prefix,
String server,
int port)
init
public void init(ServletConfig config)
throws ServletException
- Specified by:
init
in interface Servlet
- Overrides:
init
in class ProxyServlet
- Throws:
ServletException
proxyHttpURL
protected URL proxyHttpURL(String scheme,
String serverName,
int serverPort,
String uri)
throws MalformedURLException
- Description copied from class:
ProxyServlet
- Resolve requested URL to the Proxied URL
- Overrides:
proxyHttpURL
in class ProxyServlet
- Parameters:
scheme
- The scheme of the received request.serverName
- The server encoded in the received request(which
may be from an absolute URL in the request line).serverPort
- The server port of the received request (which
may be from an absolute URL in the request line).uri
- The URI of the received request.
- Returns:
- The URL to which the request should be proxied.
- Throws:
MalformedURLException
Copyright © 1995-2009 Mort Bay Consulting. All Rights Reserved.