users@jersey.java.net

Re: What does it take to recognize a hierarchy formatted URI?

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 27 Mar 2008 18:32:00 -0400

On Mar 27, 2008, at 6:04 AM, William Brogden wrote:
>
> Using the steps in
> https://jersey.dev.java.net/use/getting-started.html
>
> I used NetBeans 6.0 to create a simple Restful Web Service
> using the Singleton Pattern. I put some simple debugging
> String return in the getHtml() method. Deployment to
> Tomcat 6.0.14
>
> Doing a GET with this query formatted URI
> http://localhost:8080/MetaPhone2/resources/lookup?word=varmit
> works as expected.
>
> Using this hierarchy formatted GET
> http://localhost:8080/MetaPhone2/resources/lookup/word/varmit
>
> results in a 404 not found response.
>
> What do I have to do to get it to map a hierarchy formatted GET
> to the "lookup" path?
>
> Casual inspection of the Jersey 0.6ea examples show pleny of
> hierarchy formatted URIs in use.
>
Can you send the source code of the resource class.

I think you'd want something like:

@Path("lookup/word/{word}")
public class WordLookup {

   @GET
   String getHtml(@PathParam("word") String word) {
     return lookupWord(word);
   }
}

Marc.
> Bill
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.