سؤال

I thought that tuckey-urlrewrite-filter would rewrite the URL in the backend. So like if I typed in the address bar http://localhost:8080/TEST/some/yo I expect that address to stay in the address bar but in the backend for Tomcat to process it as if I had typed http://localhost:8080/TEST/jspinwebinftest/?param=yo But instead its redirecting to http://localhost:8080/TEST/jspinwebinftest/?param=yo and showing that in address bar.

How can I get it to only rewrite the URL in the backend? Here is my urlrewrite.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite
    PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
    "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<urlrewrite>
    <rule>
       <from>^/some/(.*)$</from>
       <to type="redirect">/TEST/jspinwebinftest/?param=$1</to>
    </rule>
</urlrewrite>
هل كانت مفيدة؟

المحلول

I found the answer. Pretty simple actually. I needed to remove the type="redirect" that was on the example XML at the tuckey website. And I found that when redirecting, you have to add your context app in the to tag, but when not redirecting, you should not:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite
    PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
    "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<urlrewrite>
    <rule>
       <from>^/some/(.*)$</from>
       <to>/jspinwebinftest/?param=$1</to>
    </rule>
</urlrewrite>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top