tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: How do you handle 'rewrite queries' ?
Date Mon, 24 Aug 2009 14:37:43 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul,

Sorry, I just saw this message from while ago...

On 8/13/2009 8:02 AM, Paul Taylor wrote:
> 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&

Right: your path stops after /ws/1/release/. You'll have to take
additional steps if you want to incorporate the query string (everything
after the "?") into the new URL.

Check out the "use-query-string" setting.

> So, does anyone know why the ? causing an issue

It splits the URI into path and query string (which is not part of the
path). I think use-query-string will do what you want.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqSpbcACgkQ9CaO5/Lv0PAdPwCgwuHzqdHNGfgt2Em18OdnM9AN
y8gAnjJzk8TEdMosC/7aR2n/63xWyPVS
=ffuG
-----END PGP SIGNATURE-----

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


Mime
View raw message