users@jersey.java.net

[Jersey] Re: How to debug 404 response from jersey server

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Wed, 28 Sep 2011 15:23:40 -0400

Answering my own question...

I forgot that the @Path on the allEventsGet() method s relative to the
@Path on the class.

So it should be:

@Path("/rest/events")
@Produces("application/atom+xml")
public class MyResource {

     @Path(*"all"*)
     @GET
     @Produces("application/atom+xml")
     public Response allEventsGet() {
         ...
     }
}

Doh!

On 09/28/2011 02:57 PM, Farrukh Najmi wrote:
>
> Looking at jersey server code its clear that log messages will not be
> useful.
>
> What is the best way to debug the cause of a jersey 404 response from
> a jersey server?
>
> Here is some info:
>
> * server base URI: http://localhost:9090
> * servlet context: /server
> * resource path: /rest/events/all
>
>
> Here is my root resource class which is found by jersey server:
>
> @Path("/rest/events")
> @Produces("application/atom+xml")
> public class MyResource {
>
> @Path("/rest/events/all")
> @GET
> @Produces("application/atom+xml")
> public Response allEventsGet() {
> ...
> }
> }
>
> Here is the jersey client code:
>
> Client c = Client.create();
> WebResource webResource = c.resource(server.BASE_URI +
> "/server/rest/events/all");
> String s =
> webResource.accept("application/atom+xml").get(String.class);
>
> Here is the request logged by LoggingFilter:
>
> 1 > GET http://localhost:9090/server/rest/events/all
>
> Here is the response logged by LoggingFilter:
>
> INFO: 1 * Server out-bound response
> 1 < 404
> 1 <
>
> TIA for your help.

-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com