http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&feed=atom&action=history
Web Server: Custom URL Rewrite Rule Tutorial - Revision history
2024-03-28T08:43:44Z
Revision history for this page on the wiki
MediaWiki 1.18.0
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=306&oldid=prev
Ferg: moved Resin: Web Server: Custom URL Rewrite Rule Tutorial to Web Server: Custom URL Rewrite Rule Tutorial
2012-01-28T00:00:00Z
<p>moved <a href="/Resin:_Web_Server:_Custom_URL_Rewrite_Rule_Tutorial" class="mw-redirect" title="Resin: Web Server: Custom URL Rewrite Rule Tutorial">Resin: Web Server: Custom URL Rewrite Rule Tutorial</a> to <a href="/Web_Server:_Custom_URL_Rewrite_Rule_Tutorial" title="Web Server: Custom URL Rewrite Rule Tutorial">Web Server: Custom URL Rewrite Rule Tutorial</a></p>
<table class='diff diff-contentalign-left'>
<tr valign='top'>
<td colspan='1' style="background-color: white; color:black;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black;">Revision as of 00:00, 28 January 2012</td>
</tr></table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=284&oldid=prev
Ferg: moved Resin: Web Server: Custom URL Rewrite Rule to Resin: Web Server: Custom URL Rewrite Rule Tutorial
2012-01-27T00:00:00Z
<p>moved <a href="/Resin:_Web_Server:_Custom_URL_Rewrite_Rule" class="mw-redirect" title="Resin: Web Server: Custom URL Rewrite Rule">Resin: Web Server: Custom URL Rewrite Rule</a> to <a href="/Resin:_Web_Server:_Custom_URL_Rewrite_Rule_Tutorial" class="mw-redirect" title="Resin: Web Server: Custom URL Rewrite Rule Tutorial">Resin: Web Server: Custom URL Rewrite Rule Tutorial</a></p>
<table class='diff diff-contentalign-left'>
<tr valign='top'>
<td colspan='1' style="background-color: white; color:black;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black;">Revision as of 00:00, 27 January 2012</td>
</tr></table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=283&oldid=prev
Ferg at 00:00, 27 January 2012
2012-01-27T00:00:00Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 00:00, 27 January 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{Config}} {{WebServer}} {{Cookbook}}</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{Config}} {{WebServer}} {{Cookbook}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del class="diffchange diffchange-inline">If you want to </del>take control of URL processing, you can create a custom Resin rewrite rule.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">To </ins>take control of <ins class="diffchange diffchange-inline">Resin Web Server </ins>URL processing, you can create a custom Resin rewrite rule.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Just like Resin's &lt;resin:Forward> tag, your custom rule can match on a URL<del class="diffchange diffchange-inline">, and </del>even <del class="diffchange diffchange-inline">have </del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Just like Resin's <ins class="diffchange diffchange-inline">built-in </ins>&lt;resin:Forward> <ins class="diffchange diffchange-inline">rewrite </ins>tag, your custom rule can match on a URL<ins class="diffchange diffchange-inline">. It can </ins>even <ins class="diffchange diffchange-inline">use </ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>rewrite predicates like Resin's &lt;resin:IfSecure> or &lt;resin:IfHeader> or &lt;resin:IfFileExists>.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>rewrite predicates like Resin's &lt;resin:IfSecure> or &lt;resin:IfHeader> or &lt;resin:IfFileExists>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
</table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=281&oldid=prev
Ferg: moved Resin: Web Server: Custom Rewrite Rule to Resin: Web Server: Custom URL Rewrite Rule
2012-01-27T00:00:00Z
<p>moved <a href="/Resin:_Web_Server:_Custom_Rewrite_Rule" class="mw-redirect" title="Resin: Web Server: Custom Rewrite Rule">Resin: Web Server: Custom Rewrite Rule</a> to <a href="/Resin:_Web_Server:_Custom_URL_Rewrite_Rule" class="mw-redirect" title="Resin: Web Server: Custom URL Rewrite Rule">Resin: Web Server: Custom URL Rewrite Rule</a></p>
<table class='diff diff-contentalign-left'>
<tr valign='top'>
<td colspan='1' style="background-color: white; color:black;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black;">Revision as of 00:00, 27 January 2012</td>
</tr></table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=189&oldid=prev
Ferg: moved Resin: Application Server: Custom Rewrite Rule to Resin: Web Server: Custom Rewrite Rule
2012-01-26T00:00:00Z
<p>moved <a href="/Resin:_Application_Server:_Custom_Rewrite_Rule" class="mw-redirect" title="Resin: Application Server: Custom Rewrite Rule">Resin: Application Server: Custom Rewrite Rule</a> to <a href="/Resin:_Web_Server:_Custom_Rewrite_Rule" class="mw-redirect" title="Resin: Web Server: Custom Rewrite Rule">Resin: Web Server: Custom Rewrite Rule</a></p>
<table class='diff diff-contentalign-left'>
<tr valign='top'>
<td colspan='1' style="background-color: white; color:black;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black;">Revision as of 00:00, 26 January 2012</td>
</tr></table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=188&oldid=prev
Ferg at 00:00, 25 January 2012
2012-01-25T00:00:00Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 00:00, 25 January 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 17:</td>
<td colspan="2" class="diff-lineno">Line 17:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>To use your rule, you'll create an instance in the <web-app> using the standard CDI XML syntax.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>To use your rule, you'll create an instance in the <web-app> using the standard CDI XML syntax.</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">The XML tag name "MyDebugRewrite" is your class name. The XML namespace "urn:java:org.example.mypkg" is your</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">class package. Resin will create your MyDebugRewrite class, call the setters for "regexp" and "target" and</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">add it as a new rewrite rule.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== WEB-INF/resin-web.xml ===</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== WEB-INF/resin-web.xml ===</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 29:</td>
<td colspan="2" class="diff-lineno">Line 33:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== The FilterChain Action ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== The FilterChain Action ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del class="diffchange diffchange-inline">=== qa/MyDebugFilterChain</del>.<del class="diffchange diffchange-inline">java ===</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">The action for a rewrite rule is a standard Java Servlet FilterChain, implementing</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">javax.servlet.FilterChain. Because Resin executes it just like a normal filter,</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">you can do anything in your action that you can do in a filter. In this example,</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">we just print the request URL and the rewrite target</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>  package <del class="diffchange diffchange-inline">qa</del>;</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">Since not all rewrite rules need a target, the target is optional. For example, the</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">resin:NotFound rule doesn't have a target. The example include the target to show</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">how it can be used.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">=== org/example/mypkg/MyDebugFilterChain.java ===</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>  package <ins class="diffchange diffchange-inline">org.example.mypkg</ins>;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import javax.servlet.*;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import javax.servlet.*;</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 37:</td>
<td colspan="2" class="diff-lineno">Line 50:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import java.io.*;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import java.io.*;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>  public class <del class="diffchange diffchange-inline">TestFilterChain </del>implements FilterChain {</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>  public class <ins class="diffchange diffchange-inline">MyDebugFilterChain </ins>implements FilterChain {</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   private String _target;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   private String _target;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>   public <del class="diffchange diffchange-inline">TestFilterChain</del>(String target)</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>   public <ins class="diffchange diffchange-inline">MyDebugFilterChain</ins>(String target)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   {</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   {</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     _target = target;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     _target = target;</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 59:</td>
<td colspan="2" class="diff-lineno">Line 72:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== The Rewrite Rule ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== The Rewrite Rule ==</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">The example rewrite rule itself simply creates the MyDebugFilterChain action,</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">allowing the AbstractTargetDispatchRule to handle the URL matching and any predicates.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">It's possible to override the parent behavior, for example if you want to add more</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">complex requirements or complicated rewriting. (For example, for A/B testing.)</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Since the default behavior supports rewrite predicates like &lt;resin:IfSecure> and</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">embedded filters, your custom rewrite rule will get those behavior automatically.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== MyDebugRewrite.java ===</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== MyDebugRewrite.java ===</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>  package <del class="diffchange diffchange-inline">qa</del>;</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>  package <ins class="diffchange diffchange-inline">org.example.mypkg</ins>;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import javax.servlet.*;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import javax.servlet.*;</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 68:</td>
<td colspan="2" class="diff-lineno">Line 89:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import com.caucho.rewrite.*;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import com.caucho.rewrite.*;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>  public class <del class="diffchange diffchange-inline">Test </del>extends AbstractTargetDispatchRule</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>  public class <ins class="diffchange diffchange-inline">MyDebugRewrite </ins>extends AbstractTargetDispatchRule</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  {</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  {</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   @Override</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   @Override</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 77:</td>
<td colspan="2" class="diff-lineno">Line 98:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>                                     FilterChain next)</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>                                     FilterChain next)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   {</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>     return new <del class="diffchange diffchange-inline">TestFilterChain</del>(target);</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>     return new <ins class="diffchange diffchange-inline">MyDebugFilterChain</ins>(target);</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  }</div></td></tr>
</table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=187&oldid=prev
Ferg at 00:00, 25 January 2012
2012-01-25T00:00:00Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 00:00, 25 January 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 26:</td>
<td colspan="2" class="diff-lineno">Line 26:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  </web-app></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  </web-app></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">== The FilterChain Action ==</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== qa/MyDebugFilterChain.java ===</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== qa/MyDebugFilterChain.java ===</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 55:</td>
<td colspan="2" class="diff-lineno">Line 57:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>   }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  }</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">== The Rewrite Rule ==</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== MyDebugRewrite.java ===</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== MyDebugRewrite.java ===</div></td></tr>
</table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=186&oldid=prev
Ferg at 00:00, 25 January 2012
2012-01-25T00:00:00Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 00:00, 25 January 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{Config}} {{WebServer}} {{Cookbook}}</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{Config}} {{WebServer}} {{Cookbook}}</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">If you want to take control of URL processing, you can create a custom Resin rewrite rule.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Just like Resin's &lt;resin:Forward> tag, your custom rule can match on a URL, and even have </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">rewrite predicates like Resin's &lt;resin:IfSecure> or &lt;resin:IfHeader> or &lt;resin:IfFileExists>.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">A rewrite rule has two components: </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">* the action, which is a servlet javax.servlet.FilterChain</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">* the rule itself, which implements com.caucho.rewrite.DispatchRule</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Once you write the action and the rule, you can use it in your WEB-INF/resin-web.xml just like any other rewrite rule.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">In this example, we'll create a trivial rewrite rule that just displays the request URI and the target URI.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">== Using the rewrite rule in the resin-web.xml ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">To use your rule, you'll create an instance in the <web-app> using the standard CDI XML syntax.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== WEB-INF/resin-web.xml ===</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>=== WEB-INF/resin-web.xml ===</div></td></tr>
</table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=185&oldid=prev
Ferg at 00:00, 25 January 2012
2012-01-25T00:00:00Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 00:00, 25 January 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{Config}} {{WebServer}} {{Cookbook}}</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{Config}} {{WebServer}} {{Cookbook}}</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">=== WEB-INF/resin-web.xml ===</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  <web-app xmlns="<nowiki>http://caucho.com/ns/resin</nowiki>"</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  <web-app xmlns="<nowiki>http://caucho.com/ns/resin</nowiki>"</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 8:</td>
<td colspan="2" class="diff-lineno">Line 10:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  </web-app></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  </web-app></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>=== MyDebugFilterChain.java ===</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>=== <ins class="diffchange diffchange-inline">qa/</ins>MyDebugFilterChain.java ===</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  package qa;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  package qa;</div></td></tr>
</table>
Ferg
http://wiki4.caucho.com/index.php?title=Web_Server:_Custom_URL_Rewrite_Rule_Tutorial&diff=184&oldid=prev
Ferg at 00:00, 25 January 2012
2012-01-25T00:00:00Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 00:00, 25 January 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 40:</td>
<td colspan="2" class="diff-lineno">Line 40:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  package qa;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  package qa;</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div> </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline"> </ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import javax.servlet.*;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import javax.servlet.*;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import javax.servlet.http.*;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  import javax.servlet.http.*;</div></td></tr>
</table>
Ferg