com.caucho.rewrite
Class AbstractRewriteFilter

java.lang.Object
  extended by com.caucho.rewrite.AbstractRewriteFilter
All Implemented Interfaces:
RewriteFilter
Direct Known Subclasses:
AddHeader, SetHeader, SetRequestSecure, SetVary

public abstract class AbstractRewriteFilter
extends java.lang.Object
implements RewriteFilter

Implements general extended behavior for rewrite filters like resin:SetHeader. RewriteFilters act like standard servlet filters, but are configured using Resin's rewrite syntax.

Abstract filters have a URL regexp pattern which only applies the filter to matching URLs. If the regexp is missing, all URLs will match.

Any rewrite/security predicate like IfUser or IfAddress can be used to restrict requests. Only requests that match all the predicates will be filtered.

The AbstractRewriteFilter can have child RewriteFilters and child servlet Filters. The children will only be added to the filter chain if the predicates match.


 <resin:SetHeader regexp="\.pdf$"
                     name="Cache-Control" value="max-age=15">
   <resin:IfUserInRole role="admin"/>
 <resin:SetHeader>
 


Constructor Summary
AbstractRewriteFilter()
           
 
Method Summary
 void add(Filter filter)
           
 void add(RequestPredicate predicate)
           
 void add(RewriteFilter filter)
           
protected  FilterChain createFilterChain(java.lang.String uri, java.lang.String queryString, FilterChain next)
           
 boolean isForward()
           
 boolean isInclude()
           
 boolean isRequest()
           
 FilterChain map(java.lang.String uri, java.lang.String queryString, FilterChain next)
          Creates a FilterChain for the action based on the uri and query string.
 void setRegexp(java.util.regex.Pattern regexp)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractRewriteFilter

public AbstractRewriteFilter()
Method Detail

setRegexp

public void setRegexp(java.util.regex.Pattern regexp)

isRequest

public boolean isRequest()
Specified by:
isRequest in interface RewriteFilter

isInclude

public boolean isInclude()
Specified by:
isInclude in interface RewriteFilter

isForward

public boolean isForward()
Specified by:
isForward in interface RewriteFilter

add

public void add(RequestPredicate predicate)

add

public void add(RewriteFilter filter)

add

public void add(Filter filter)
         throws ServletException
Throws:
ServletException

map

public FilterChain map(java.lang.String uri,
                       java.lang.String queryString,
                       FilterChain next)
                throws ServletException
Description copied from interface: RewriteFilter
Creates a FilterChain for the action based on the uri and query string.

Specified by:
map in interface RewriteFilter
Parameters:
uri - the request URI to match against
queryString - the request query string to match against
next - the next rewrite FilterChain dispatch
Throws:
ServletException

createFilterChain

protected FilterChain createFilterChain(java.lang.String uri,
                                        java.lang.String queryString,
                                        FilterChain next)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object