org.eclipse.jetty.servlets
Class ProxyServlet

java.lang.Object
  extended by org.eclipse.jetty.servlets.ProxyServlet
All Implemented Interfaces:
Servlet
Direct Known Subclasses:
ProxyServlet.Transparent

public class ProxyServlet
extends Object
implements Servlet

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

This servlet needs the jetty-util and jetty-client classes to be available to the web application.

To facilitate JMX monitoring, the "HttpClient", it's "ThreadPool" and the "Logger" are set as context attributes prefixed with "org.eclipse.jetty.servlets."+name (unless otherwise set with attrPrefix). This attribute prefix is also used for the logger name.

The following init parameters may be used to configure the servlet:


Nested Class Summary
static class ProxyServlet.Transparent
          Transparent Proxy.
 
Field Summary
protected  ServletConfig _config
           
protected  ServletContext _context
           
protected  HashSet<String> _DontProxyHeaders
           
protected  Logger _log
           
protected  String _name
           
 
Constructor Summary
ProxyServlet()
           
 
Method Summary
 void destroy()
           
 ServletConfig getServletConfig()
           
 String getServletInfo()
           
 void handleConnect(HttpServletRequest request, HttpServletResponse response)
           
 void init(ServletConfig config)
           
protected  HttpURI proxyHttpURI(String scheme, String serverName, int serverPort, String uri)
           
 void service(ServletRequest req, ServletResponse res)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected Logger _log

_DontProxyHeaders

protected HashSet<String> _DontProxyHeaders

_config

protected ServletConfig _config

_context

protected ServletContext _context

_name

protected String _name
Constructor Detail

ProxyServlet

public ProxyServlet()
Method Detail

init

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

getServletConfig

public ServletConfig getServletConfig()
Specified by:
getServletConfig in interface Servlet

service

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

handleConnect

public void handleConnect(HttpServletRequest request,
                          HttpServletResponse response)
                   throws IOException
Throws:
IOException

proxyHttpURI

protected HttpURI proxyHttpURI(String scheme,
                               String serverName,
                               int serverPort,
                               String uri)
                        throws MalformedURLException
Throws:
MalformedURLException

getServletInfo

public String getServletInfo()
Specified by:
getServletInfo in interface Servlet

destroy

public void destroy()
Specified by:
destroy in interface Servlet


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