tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Taylor <paul_t...@fastmail.fm>
Subject Re: How do you handle 'rewrite queries' ?
Date Thu, 13 Aug 2009 12:02:41 GMT
Christopher Schultz wrote:
> If you're looking for URL rewriting in Java, you need go no further than
> http://tuckey.org/urlrewrite/
>   
So I had a look at urlrewrite, when you first mentioned it I didnt 
realise you could plug it in as a filter, and it seems to be what I need
> I'm not sure you really need rewriting, since you could just map
> /ws/type/ to the same servlet that handles requests to /
>
>   
Hi, yes I do need rewrite because I need to be able to change a query like
http://localhost:8080/ws/1/release/?query=fred&fmt=xml
to
http://localhost:8080/type=release&query=fred&fmt=xml
 
Release can also be artist,title ectera, the thing is it needs to be 
converted to the value of a parameter called type.


But I create this rule in urlrewrite.xml:

<rule>
    <from>^/ws/1/(.*)/(.*)$</from>
    <to type="redirect">/type=$1&amp;$2</to>
</rule>

it converts the query to
http://localhost:8080/type=release&

I enabled debugging when I look at the localhist log , it says
               Rule 0 run called with /ws/1/release/
              matched "from"
              needs to be redirected to /type=release&

it seems it never receives anything after the the last backslash

If I pass the following query (note no ? after last backslash)
http://localhost:8080/ws/1/release/query=fred&fmt=xml
it converts query to
http://localhost:8080/type=release&query=fred&fmt=xml

and debugging shows
             Rule 0 run called with /ws/1/release/query=fred&fmt=xml
             matched "from"
             needs to be redirected to /type=release&query=fred&fmt=xml

So, does anyone know why the ? causing an issue

thanks for your help Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message