com.caucho.rewrite
Interface DispatchRule

All Known Implementing Classes:
AbstractDispatchRule, AbstractRegexpDispatchRule, AbstractTargetDispatchRule, Dispatch, FastCgiProxy, Forbidden, Forward, HttpProxy, Location, MovedPermanently, NotFound, Redirect, RedirectSecure, Rewrite, SendError, WelcomeFile

public interface DispatchRule

URL rewriting and request dispatching based on URL and query string, configured in the resin-web.xml. Basically, a replacement for mod_rewrite capabilities in Resin.

DispatchRules generally have a regular expression and a target (defined in AbstractTargetDispatchRule). They have optional RequestPredicate conditions to check request headers, so dispatching can be browser-specific.

Custom DispatchRules can be made by extending AbstractTargetDispatchRule and implementing the createDispatch method.

 <web-app xmlns="http://caucho.com/ns/resin"
             xmlns:resin="urn:java:com.caucho.resin">

   <resin:Dispatch regexp="\.(php|jpg|gif|js|css)"/>

   <resin:Dispatch regexp="^" target="/index.php"/>

 </web-app>
 


Method Summary
 boolean isForward()
           
 boolean isInclude()
           
 boolean isRequest()
           
 FilterChain map(DispatcherType type, java.lang.String uri, java.lang.String queryString, FilterChain next, FilterChain tail)
          Creates a FilterChain for the action based on the uri and query string.
 java.lang.String rewriteUri(java.lang.String uri, java.lang.String queryString)
          Rewrites the URI for further processing.
 

Method Detail

isRequest

boolean isRequest()

isInclude

boolean isInclude()

isForward

boolean isForward()

rewriteUri

java.lang.String rewriteUri(java.lang.String uri,
                            java.lang.String queryString)
Rewrites the URI for further processing. Rules following the current one will use the new URI.


map

FilterChain map(DispatcherType type,
                java.lang.String uri,
                java.lang.String queryString,
                FilterChain next,
                FilterChain tail)
                throws ServletException
Creates a FilterChain for the action based on the uri and query string. Matching requests will use tail, and mismatching requests will use next. tail is the plain servlet/filter chain without any rewriting. next is the next rewrite dispatch

Parameters:
uri - the request URI to match against
queryString - the request query string to match against
next - the next rewrite FilterChain dispatch
tail - the plain servlet/filter chain for a match
Throws:
ServletException