users@jersey.java.net

[Jersey] Best way to diagnose a 400 error on POST

From: Jason Erickson <jason_at_jasonerickson.com>
Date: Thu, 9 Dec 2010 21:10:16 -0800

Hi. I have a REST method defined thus:
        @POST
        @Consumes(MediaType.APPLICATION_JSON)
        public Response addObservationSession(ObservationSession session, @Context UriInfo uriInfo) throws URISyntaxException
        {
                .. do some stuff
                return Response.created(new URI("/" + session.getId())).build();
        }

This is giving me a 400 error when I call it. Clearly it doesn't like my JSON string, but it's hard for me to tell what's wrong with it (or if it's not the string, maybe it's the header or who knows). I can't put a breakpoint in my code because it never gets to my code. What's the best way to get a clue?