users@jersey.java.net

[Jersey] Re: Problems Reading javax.ws.rs.core.Response from POST

From: Mark Petrovic <mspetrovic_at_gmail.com>
Date: Thu, 30 Dec 2010 18:28:41 -0800

I think you need to set the response JAXB object with Response.create(...).entity(theEntity).build();



On Dec 30, 2010, at 6:14 PM, <jamesgc21_at_comcast.net> wrote:

> I just started implementing REST with JAX-RS this week. Working
> through the examples in the RESTful Java text by Burke.
>
> Successful in querying data from a PostgreSQL database using GET
> methods from an iOS client. Have also been able to create new records
> using POST, but can't seem to figure out how to read/parse the
> javax.ws.rs.core.Response from my POST method. Trying to read the
> response to verify if the POST (create) was successful.
>
> @POST
> @Consumes("application/xml")
> public Response createCustomer(Customer customer) {
> //code here to create a new Customer record...(this part is
> working)
> return Response.created(URI.create("/customers/" +
> customer.getId())).build();
> }
>
> When I read the response in my iOS client...nothing shows up. Assuming
> that the return value is XML. Do I need to change the return
> type...aka build/return an actual XML String?
>
> Any advice would be appreciated.