An example of UrlRewrite

22 views
Skip to first unread message

shashikant

unread,
Nov 18, 2009, 4:53:57 AM11/18/09
to UrlRewrite
Hi All,

I am new to URLRewrite and looking to do something like this :

I have a URL :

https://abc.test.com/test?cnrt=TestCnrt&status=pass

this url needs to be shown as :

https://abc.test.com/test/pass/TestCnrt.html

when we click a link. (the url is relatively formed upto https://abc.test.com/test).


Please suggest a simple rule which i can add in the rewrite.xml .


Thanks and regards
Shashikant



Avlesh Singh

unread,
Nov 19, 2009, 4:29:45 AM11/19/09
to urlre...@googlegroups.com
Go through this - http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/index.html
You'll find nice illustrative samples here.

Cheers
Avlesh

shashikant

unread,
Nov 19, 2009, 12:09:16 PM11/19/09
to UrlRewrite
hi Avlesh,

Thanks for link.

I find none my rules are getting fired. I have put logger in debug
mode as :

<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>DEBUG</param-value>
</init-param>
</filter>

However no log is getting generated. (Tomcat server 4.1)

Regards

On Nov 19, 2:29 pm, Avlesh Singh <avl...@gmail.com> wrote:
> Go through this -http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/i...
> You'll find nice illustrative samples here.
>
> Cheers
> Avlesh
>

shashikant

unread,
Nov 19, 2009, 12:39:45 PM11/19/09
to UrlRewrite
I find there are 3-4 more filters which have /* in the url-pattern and
the URL-ReWriter filter is not being hit

please suggest if there is a workaound for this, as I cannot modify
the existing filters.

Avlesh Singh

unread,
Nov 19, 2009, 1:06:07 PM11/19/09
to urlre...@googlegroups.com
Try making URF as you first filter and see if it works. If it doesn't, post the web.xml snippet for filters configured in your web-app. You must have copied your urlrewrite.xml in WEB-INF/, right?

Cheers
Avlesh

shashikant

unread,
Nov 19, 2009, 3:09:33 PM11/19/09
to UrlRewrite
The web.xml has entries as :

<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>DEBUG</param-value>
</init-param>
</filter>
<filter>
<filter-name>ResponseSizeFilter</filter-name>
<filter-class>com.myapp.dcm.core.filters.ResponseSizeFilter</
filter-class>
</filter>

<filter>
<filter-name>AAFilter</filter-name>
<filter-class>com.myapp.dcm.core.filters.AAFilter</filter-class>
</filter>
<filter>
<filter-name>RequestControlFilter</filter-name>
<filter-class>com.myapp.dcm.core.filters.RequestControlFilter</
filter-class>
</filter>
<filter>
<filter-name>TimingFilter</filter-name>
<filter-class>com.myapp.dcm.core.filters.TimerFiler</filter-class>
</filter>

<filter>
<filter-name>EntryFilter</filter-name>
<filter-class>com.myapp.dcm.core.filters.EntryFilter</filter-
class>
</filter>

<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>EntryFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>TimingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>RequestControlFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Always the RequestControlFilter is getting picked up.



On Nov 19, 11:06 pm, Avlesh Singh <avl...@gmail.com> wrote:
> Try making URF as you first filter and see if it works. If it doesn't, post
> the web.xml snippet for filters configured in your web-app. You must have
> copied your urlrewrite.xml in WEB-INF/, right?
>
> Cheers
> Avlesh
>

shashikant

unread,
Nov 19, 2009, 4:51:09 PM11/19/09
to UrlRewrite
Upon debugging by adding the UrlRewrite source code i find the
following :

statusEnabledOnHosts is null. PLease let me know what this parameter
sets and how does it impact the application.

Thanks

Avlesh Singh

unread,
Nov 19, 2009, 9:16:22 PM11/19/09
to urlre...@googlegroups.com
statusEnabledOnHosts is null. PLease let me know what this parameter sets and how does it impact the application.
This parameter has nothing to do with regular rewriting. It is an optional parameter to configure a status servlet in your application which gives the more info on the rules configured in your webapp when you hit the URL - /rewrite-status

Looking at your filter chain the statement "Always the RequestControlFilter is getting picked up" does not make sense. You'll have to find out why URF is not invoked first.

Send a snippet from you urlrewrite.xml if the filter is not yet working properly.

Cheers
Avlesh
Reply all
Reply to author
Forward
0 new messages