peony2012 / urlrewritefilter

Automatically exported from code.google.com/p/urlrewritefilter
Other
0 stars 0 forks source link

OutBound rules are not working in Struts Application #170

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In web.xml i have following code as given below:
<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>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    </filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

2. In urlrewrite.xml i have following code as given below:
<rule>
        <from>^/test/status/$</from>
        <to type="redirect">%{context-path}/GetLocation</to>
    </rule>

    <outbound-rule>
        <from>/GetLocation</from>
        <to type="redirect">%{context-path}/test/status/</to>
    </outbound-rule>

What is the expected output? What do you see instead?
  On entering URL as http:/localhost:8080/[project-name]/test/status/ struts action GetLocation is getting executed. 

   Expected output is URL of browser should remain same after page is loaded.

   What I'm getting is after http:/localhost:8080/[project-name]/test/status/ is entered the URL in browser is changing to http:/localhost:8080/[project-name]/GetLocation i.e. OutBound-rules are not working as mentioned in urlrewrite.xml and URL is not getting masked

  Please look into this

What version of the product are you using? On what operating system?

   Currently using urlrewriter 4.0.3 (urlrewriter-4.0.3.jar) version in Struts application running on Apache tomcat 7 in windows

Please provide any additional information below.

   Log files tells execution as follows :
org.tuckey.web.filters.urlrewrite.utils.ServerNameMatcher DEBUG: looking for 
hostname match on current server name localhost
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: checking for status 
path on /ksbeta_2.0/test/status/
org.tuckey.web.filters.urlrewrite.UrlRewriter DEBUG: processing request for 
/test/status/
org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: Rule 0 run called with 
/test/status/
org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: matched "from"
org.tuckey.web.filters.urlrewrite.substitution.VariableReplacer DEBUG: variable 
%{context-path} type: context-path
org.tuckey.web.filters.urlrewrite.substitution.VariableReplacer DEBUG: resolved 
to: /ksbeta_2.0
org.tuckey.web.filters.urlrewrite.substitution.VariableReplacer DEBUG: replaced 
sb is /ksbeta_2.0/GetLocation
org.tuckey.web.filters.urlrewrite.RuleExecutionOutput DEBUG: needs to be 
redirected to /ksbeta_2.0/GetLocation
org.tuckey.web.filters.urlrewrite.utils.ServerNameMatcher DEBUG: looking for 
hostname match on current server name localhost
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: checking for status 
path on /ksbeta_2.0/GetLocation
org.tuckey.web.filters.urlrewrite.UrlRewriter DEBUG: processing request for 
/GetLocation
org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: Rule 0 run called with 
/GetLocation
org.tuckey.web.filters.urlrewrite.utils.ServerNameMatcher DEBUG: looking for 
hostname match on current server name localhost

Original issue reported on code.google.com by tejasshetty567@gmail.com on 1 Aug 2014 at 11:38