On 24/08/2011 21:21, Mattmann, Chris A (388J) wrote:
> Thanks Chris for the advice.

Or people use an MVC framework of some sort to map URLs to methods.


p



> Cheers,
> Chris
> 
> On Aug 24, 2011, at 11:26 AM, Christopher Schultz wrote:
> 
> 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
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> 
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Chris Mattmann, Ph.D.
> Senior Computer Scientist
> NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
> Office: 171-266B, Mailstop: 171-246
> Email: chris.a.mattm...@nasa.gov
> WWW:   http://sunset.usc.edu/~mattmann/
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Adjunct Assistant Professor, Computer Science Department
> University of Southern California, Los Angeles, CA 90089 USA
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to