Dear all,

I have some trouble with rewrite-dispatch in resin 3.1.9 Professional
regarding the <query-param> condition.

Previously with resin 2.1, I was using a simple JSP page to perform some
kinds of redirections due to usage of frames. For example the URL:
http://host/redirect.jsp?to=06/06_01_02.html has loaded a page for let's
say a pricing option-1 in its main content with the outer frames as

Now, with resin 3.1 the structure of the web-app is changed and there is
a single page called "option-1.jsp" and I would like to rewrite requests
to that former "redirect.jsp" to the new page, but I have to consider
the query param for the most used invocations. I thought I can achieve
this with the following <rewrite-dispatch> block inside the <host> tag.
For a simple test case, I've configured it inside a <web-app> called

    <!-- Rewrite former redirect.jsp activities -->
    <moved-permanently regexp="^/redirect.jsp"
      <when query-param="to=06/06_01_02.html"/>

So I thought that a request to
http://host/rewrite-test/redirect.jsp?to=06/06_01_02.html should be
moved with 301 to http://host/rewrite-test/option-1.jsp due to the exact
match of the <when query-param="..."> condition. But it does not work,
so I've enabled 'finest' debug using

  <!-- Debug Logging   -->
  <log level="finest" path="WEB-INF/debug_${}.log"
       timestamp="[%H:%M:%S.%s] {%{thread}} "
       format="[${app.contextPath}] ${log.level} ${log.sourceClassName}
(${log.sourceMethodName}) ${log.message}">
    <logger name="com.caucho.server.rewrite" level="finest"/>
    <logger name="com.caucho.server.connection.Form" level="finest"/>

and got this output:

[18:49:27.309] {http--8080-1$11773344} [/rewrite-test] INFO
com.caucho.jsp.TldManager (initGlobal) Loading .tld files from global
[18:49:34.681] {http--8080-1$11773344} [/rewrite-test] FINEST
com.caucho.server.rewrite.RewriteDispatch (map) rewrite-dispatch check
uri '/redirect.jsp'
[18:49:34.681] {http--8080-1$11773344} [/rewrite-test] FINER
com.caucho.server.rewrite.AbstractRuleWithConditions (map) match .*
'/redirect.jsp' --> '/redirect.jsp'
[18:49:34.681] {http--8080-1$11773344} [/rewrite-test] FINE
com.caucho.server.connection.Form (parseQueryString) query:
[18:49:34.681] {http--8080-1$11773344} [/rewrite-test] FINER
com.caucho.server.rewrite.ConditionFilterChain (doFilter) null
^/redirect.jsp '/redirect.jsp' --> '/rewrite-test/option-1.jsp'

and that's what has been tracked by Firefox Live HTTP headers:

GET /rewrite-test/redirect.jsp?to=06/06_01_02.html HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
Gecko/2009042316 Firefox/3.0.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 200 OK
Server: Resin/3.1.9
Content-Type: text/html
Transfer-Encoding: chunked
Date: Wed, 27 May 2009 17:07:02 GMT

Am I doing something wrong here? For me it looks like the <query-param>
condition is not working in this case.
Thanks for any kind of hints or ideas.


resin-interest mailing list

Reply via email to