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 20:45:03 GMT
Yes.  I assumed you were putting the rewrite in A.war.

On Sep 30, 2008, at 3:41 PM, Mohit Anchlia wrote:

> So does it mean even if the URL is abc/a it will still be routed to
> the abc/b servlet even though Urlrewrite.xml rule is inside B.war. I
> am confused in the sense that for tomcat to know if it has to route
> that request to abc/b wouldn't the URLrewrite need to occur somewhere
> outside of B.war?
>
> On Tue, Sep 30, 2008 at 11:07 AM, Ken Bowen <kbowen@als.com> wrote:
>> Below...
>>
>> On Sep 30, 2008, at 1:58 PM, Mohit Anchlia wrote:
>>
>>> I think I don't really understand how it works. So if my request
>>> abc.com/a doesn't even get to B.war i.e abc.com/b then how would
>>> having filters in web.xml help.
>>
>> request abc.com/a  "doesn't get to B.war"  BECAUSE it is changed to
>> abc.com/b.
>>
>>>
>>> Also, is adding just <rule> not enough? Why do we also need to add a
>>> filter.
>>
>> You need the filter to apply the rule to the incoming request to  
>> convert as
>> you desire.
>>
>>>
>>> On Tue, Sep 30, 2008 at 10:48 AM, Ken Bowen <kbowen@als.com> wrote:
>>>>
>>>> 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
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
> ---------------------------------------------------------------------
> 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