-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris,

On 8/24/2011 10:56 AM, Mattmann, Chris A (388J) wrote:
> For example, let's say I have a web service located at:
> 
> http://myhost/books

Your REST guys are a fun bunch :)

> The web service is just backed by a Java Servlet

Okay.

> I get my JSON listings from the web service in the above example is
>  to pass a special request parameter called "category", and set
> its value equal to the requested category, like:
> 
> http://myhost/books?category=fiction

That's pretty standard.

> What I would like to be able to do is to set up, via configuration,
> the ability to map a new URL, say:
> 
> http://myhost/fictionbooks
> 
> To
> 
> http://myhost/books?category=fiction
> 
> In effect, creating a default URI mapping. Is there a way in Tomcat
>  to do this via configuration, and if not, I'm interested in 
> contributing it, and any recommendations on the best places to
> look to do so would be sincerely appreciated.

As Chuck points out, this is (somewhat) easily done using Tuckey's
urlrewrite, but you may find that you are writing /lots and lots/ of
mappings.

I think the real question is this: would you rather use query-string
semantics in your URLs, or would you rather use "path-info" (so-called
because it uses the "path info" of the request) semantics to
communicate with your server? I guess you could support both, but
people usually tend to pick one and stick with it.

If you want to completely change to path-info, a code-based solution
is probably better (either modifying your servlet(s) or writing a
Filter to make it look like everything is in the query string -- we
can help you with either of these techniques). If you just want to
pretend that you support path-info, then you are probably better off
using lots and lots of url-rewrite rules.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5VQmMACgkQ9CaO5/Lv0PBlngCdFMWCM3Kcf0lnO71ENwJgSHta
ID4AoJQIfqopMAgGK05Wc2CHs6QwUD8d
=Ezh3
-----END PGP SIGNATURE-----

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

Reply via email to