net.sf.j2ep
Class ProxyFilter

java.lang.Object
  extended by net.sf.j2ep.ProxyFilter

public class ProxyFilter
extends java.lang.Object

A reverse proxy using a set of Rules to identify which resource to proxy. At first the rule chain is traversed trying to find a matching rule. When the rule is found it is given the option to rewrite the URL. The rewritten URL is then sent to a Server creating a Response Handler that can be used to process the response with streams and headers. The rules and servers are created dynamically and are specified in the XML data file. This allows the proxy to be easily extended by creating new rules and new servers.

Author:
Anders Nyman

Constructor Summary
ProxyFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
          Implementation of a reverse-proxy.
 void init(FilterConfig filterConfig)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyFilter

public ProxyFilter()
Method Detail

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain filterChain)
              throws java.io.IOException,
                     ServletException
Implementation of a reverse-proxy. All request go through here. This is the main class where are handling starts.

Throws:
java.io.IOException
ServletException
See Also:
javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)

init

public void init(FilterConfig filterConfig)
          throws ServletException
Throws:
ServletException
See Also:
Called upon initialization, Will create the ConfigParser and get the RuleChain back. Will also configure the httpclient.

destroy

public void destroy()
See Also:
Called when this filter is destroyed. Releases the fields.