Hello list, Can you explain to me how to return a description with a client_error status in a PUT handler? Things are working in the GET handler, but for some reason i can not get it working in the put. In the client the error_code is available, but my description "Payload is not in JSON format" is not. The description from the GET is available.
public class MyServerResource extends ServerResource { @Override protected Representation get() { Representation representation = null; MediaType returnMediaType = getPreferredMediaType(); if (MediaType.APPLICATION_JSON.equals(returnMediaType)) { representation = getCSV(); } else { setStatus(Status.CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE, "Can only support application/json"); } return representation; } @Override protected Representation put(Representation representation) { // check if the requested mediatype is application/json if (MediaType.APPLICATION_JSON.equals(representation.getMediaType())) { JsonRepresentation jsonRepresentation = new JsonRepresentation(representation); if (jsonRepresentation == null) { setStatus(Status.CLIENT_ERROR_BAD_REQUEST, "Payload is not in JSON format"); } else { // other stuff } } return null; } } This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/emaildisclaimer ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2765366