tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Bowen <kbo...@als.com>
Subject Re: Url rewrite
Date Tue, 30 Sep 2008 17:48:33 GMT
Something like the following might be helpful for your web.xml:

   <filter>
     <filter-name>UrlRewriteFilter</filter-name>
     <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</ 
filter-class>
<!--
     <init-param>
         <param-name>logLevel</param-name>
         <param-value>sysout:DEBUG</param-value>
     </init-param>
-->
   </filter>

   <filter-mapping>
     <filter-name>UrlRewriteFilter</filter-name>
     <url-pattern>/*</url-pattern>
     <dispatcher>FORWARD</dispatcher>
     <dispatcher>REQUEST</dispatcher>
   </filter-mapping>

If you uncomment the "init-param" items above, youll get debug output.

And of course you'll need a file "urlrewrite.xml" in your WEB-INF to
express the rules you want.   One of my projects has rules that
look like this:

<rule>
         <from>^/ContactUs$</from>
         <to type="forward">/ContactUs.do</to>
</rule>
<outbound-rule>
     <from>^/ContactUs.do$</from>
     <to>/ContactUs</to>
</outbound-rule>

My own experience is that tuckey rewrite is very fast.

--Ken


On Sep 30, 2008, at 1:35 PM, Mohit Anchlia wrote:

> I am using Tomcat 5.5 and I need to change the URL for eg: abc.com/A
> to abc.com/B. I read about UrlRewrite at tuckey.org as suggested by
> this user group. So as I understand I need to do
> the following:
>
> 1. In my servlet B.war file I need to edit web.xml and add the
> following at the top:
>
>       <filter>
>          <filter-name>UrlRewriteFilter</filter-name>
>          <filter-
> class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-
> class>
>       </filter>
>       <filter-mapping>
>          <filter-name>UrlRewriteFilter</filter-name>
>          <url-pattern>/*</url-pattern>
>       </filter-mapping>
> 2. Redploy
>
> My question is if I put it in B.war in web.xml then how will this work
> because abc.com/A will not be routed to B servlet. Since it will not
> be routed then how and where will the translation occur?
>
> Is there any performance overhead of using UrlRewrite?
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message