users@jersey.java.net

Re: [Jersey] non-GET methods not working

From: Richard Bailey <rbailey_at_gatech.edu>
Date: Mon, 23 Mar 2009 19:10:26 -0400

Agh.

I was having this problem the other day and thought a glassfish restart fixed it (but wasn't sure) so I didn't look too closely at this error message... that said I just noticed that the buried HTTP response code was 404, not 405. In this case I just left out an item in my path. Sorry guys, thanks for the help (and dose of humility!)

=)
-Richard

Richard Bailey wrote:
> At some point I had working methods for GET/POST/PUT/DELETE but I found
> out when going back and implementing some unit tests that my non-GET
> methods are no longer working.
>
> As far as I know I haven't made any config changes but whenever a make a
> PUT/POST/DELETE request I get this as the response:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>GlassFish/v3
> - Error report</title><style type="text/css"><!--H1
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
> H2
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
> H3
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
> BODY
> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
> B
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
> P
> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
> {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP
> Status 404 - </h1><hr/><p><b>type</b> Status
> report</p><p><b>message</b></p><p><b>description</b>The requested
> resource () is not available.</p><hr/><h3>GlassFish/v3</h3></body></html>
>
> the particular class that lives in looks like this [0]. When I make the
> request there is no output to the netbeans "Output / GlassFish V3
> Prelude" terminal. I'm using Jersey v1.0.2 on GlassFish V3; v1.0.2 is
> required because of some JAXB fix we needed to have incorporated and
> that was the internet-suggested approach to picking it up).
>
> I'd very much appreciate any thoughts as to why I might be seeing this.
> I've searched the archives but haven't found anything that has gotten me
> back on track.
>
> Thanks,
> -Richard
>
>
> [0] class implementation:
> @Path("/users/")
> public class UsersResource {
> @Context
> private UriInfo uriInfo;
> @Context
> private HttpHeaders headers;
>
> @GET
> @Produces({"application/xml", "application/json"})
> public WatchDetailsConverter get() { ... }
>
> @Path("{username}/")
> @GET
> @Produces({"application/xml", "application/json"})
> public WatchDetailConverter getWatchedUser(@PathParam("username")
> String watchedUsername) {...}
>
> @Path("{username}/")
> @POST
> @Produces({"application/xml", "application/json"})
> public ErrorConverter requestToWatch(
> @PathParam("username") String watchedUsername,
> @QueryParam("accuracy") @DefaultValue("0") int acc) {...}
>
> @Path("{username}/")
> @DELETE
> @Produces({"application/xml", "application/json"})
> public ErrorConverter deleteWatchedUser(@PathParam("username") String
> watchedUser) {...}
>
>
> @Path("{username}/location/")
> @GET
> @Produces({"application/xml", "application/json"})
> public WaiUserlocationsConverter
> getWatchedUserLocation(@PathParam("username") String watchedUser) {...}
> }