org.mortbay.servlet
Class ProxyServlet

java.lang.Object
  extended by org.mortbay.servlet.ProxyServlet
All Implemented Interfaces:
javax.servlet.Servlet
Direct Known Subclasses:
ProxyServlet.Transparent

public class ProxyServlet
extends java.lang.Object
implements javax.servlet.Servlet

Proxy Servlet.

Forward requests to another server either as a standard web proxy (as defined by RFC2616) or as a transparent proxy.


Nested Class Summary
static class ProxyServlet.Transparent
          Transparent Proxy.
 
Field Summary
protected  javax.servlet.ServletConfig _config
           
protected  javax.servlet.ServletContext _context
           
protected  java.util.HashSet _DontProxyHeaders
           
 
Constructor Summary
ProxyServlet()
           
 
Method Summary
 void destroy()
           
 javax.servlet.ServletConfig getServletConfig()
           
 java.lang.String getServletInfo()
           
 void handleConnect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void init(javax.servlet.ServletConfig config)
           
protected  java.net.URL proxyHttpURL(java.lang.String scheme, java.lang.String serverName, int serverPort, java.lang.String uri)
          Resolve requested URL to the Proxied URL
 void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_DontProxyHeaders

protected java.util.HashSet _DontProxyHeaders

_config

protected javax.servlet.ServletConfig _config

_context

protected javax.servlet.ServletContext _context
Constructor Detail

ProxyServlet

public ProxyServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Throws:
javax.servlet.ServletException

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Specified by:
getServletConfig in interface javax.servlet.Servlet

service

public void service(javax.servlet.ServletRequest req,
                    javax.servlet.ServletResponse res)
             throws javax.servlet.ServletException,
                    java.io.IOException
Specified by:
service in interface javax.servlet.Servlet
Throws:
javax.servlet.ServletException
java.io.IOException

proxyHttpURL

protected java.net.URL proxyHttpURL(java.lang.String scheme,
                                    java.lang.String serverName,
                                    int serverPort,
                                    java.lang.String uri)
                             throws java.net.MalformedURLException
Resolve requested URL to the Proxied URL

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:
java.net.MalformedURLException

handleConnect

public void handleConnect(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
                   throws java.io.IOException
Throws:
java.io.IOException

getServletInfo

public java.lang.String getServletInfo()
Specified by:
getServletInfo in interface javax.servlet.Servlet

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.