开发者

Need help in URL rewrite Spring framework J2EE using Tuckey Filter

开发者 https://www.devze.com 2023-02-12 03:46 出处:网络
Im using a J2ee application with spring framework 2.0 on a apache tomcat 5.5. I have used URL mapping to change the extension from .jsp to .htm. I have an URL which looks like this localhost:8080/pr

Im using a J2ee application with spring framework 2.0 on a apache tomcat 5.5.

I have used URL mapping to change the extension from .jsp to .htm. I have an URL which looks like this localhost:8080/promotion.htm?cid=12345.

I want to change it to localhost:8080/12345

Can someone please help me out in writing a rule which will perform the required rewrite in urlrewrite.xml using tuckey URL rewrite filter

This is what I have mentioned in web.xml

<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewri开发者_StackOverflow社区te Filter</filter-class> </filter>

All I need is the URL to change to http://localhost:8080/12345. I do not want any redirection to happen. All I need is a clean URL so that the URL looks neat. I have tried quite a lot of rules myself but to no success.

How can this be done?


After a long time with no replies/comments I achieved this myself with the following rule in the urlrewrite.xml

 <rule>
 <from>/([a-zA-Z0-9]{1,}$)</from>
    <to >/promotion.htm?cid=$1</to>
</rule>


More info here:
http://www.tuckey.org/urlrewrite/manual/3.0/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号