Response response = null;
if (...)
{
...
response = Response.created(message).entity(message).build();
}
else
{
response = Response.status(Status.CONFLICT).entity("Message failed to be added.").build();
throw new WebApplicationException(response);
}
return response;
The client code which calls this is like so:
ClientResponse response = resource.post(ClientResponse.class);
if (response.getStatus() >= 400)
{
throw new UniformInterfaceException(response);
}
My expectations are that in the case of an error the message would be printed to the client's console, but instead it prints: "POST http://localhost:808...jaxrs/messages/ returned a response status of 409." I have tried various things (including head scratching) and have been unsuccessful in finding out why it doesn't work as it should.
Does anyone know how to get this to work?


Sign In
Create Account

Back to top









