org.littleshoot.proxy
Class RegexHttpRequestFilter

java.lang.Object
  extended by org.littleshoot.proxy.RegexHttpRequestFilter
All Implemented Interfaces:
HttpRequestFilter

public class RegexHttpRequestFilter
extends Object
implements HttpRequestFilter

Request filter that uses regular expressions on the request host and/or the request path. If there is a match, it then passes on the request to a second filter that's passed in.


Method Summary
 void filter(org.jboss.netty.handler.codec.http.HttpRequest httpRequest)
          Makes any desired modifications to the request.
static RegexHttpRequestFilter newHostAndPathFilter(String hostRegex, String pathRegex, HttpRequestFilter filter)
          Creates a new filter that filters on the request host.
static RegexHttpRequestFilter newHostFilter(String hostRegex, HttpRequestFilter filter)
          Creates a new filter that filters on the request host.
static RegexHttpRequestFilter newPathFilter(String pathRegex, HttpRequestFilter filter)
          Creates a new filter that filters on the request path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newHostFilter

public static RegexHttpRequestFilter newHostFilter(String hostRegex,
                                                   HttpRequestFilter filter)
Creates a new filter that filters on the request host.

Parameters:
hostRegex - The regular expression for matching the host.
filter - The filter to delegate to if the host matches.
Returns:
The filter.

newPathFilter

public static RegexHttpRequestFilter newPathFilter(String pathRegex,
                                                   HttpRequestFilter filter)
Creates a new filter that filters on the request path.

Parameters:
pathRegex - The regular expression for matching the path.
filter - The filter to delegate to if the path matches.
Returns:
The filter.

newHostAndPathFilter

public static RegexHttpRequestFilter newHostAndPathFilter(String hostRegex,
                                                          String pathRegex,
                                                          HttpRequestFilter filter)
Creates a new filter that filters on the request host.

Parameters:
hostRegex - The regular expression for matching the host.
pathRegex - The regular expression for matching the path.
filter - The filter to delegate to if the host matches.
Returns:
The filter.

filter

public void filter(org.jboss.netty.handler.codec.http.HttpRequest httpRequest)
Description copied from interface: HttpRequestFilter
Makes any desired modifications to the request.

Specified by:
filter in interface HttpRequestFilter
Parameters:
httpRequest - The request.


Copyright © 2009-2013 LittleShoot. All Rights Reserved.