Java Restful Service: Incorrect HTTP error for xml requests



Controller looks like this:



@GET
@Path("/entity/{entityId}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response findMyEntityById(
@PathParam("entityId") String id)
{
EntityRequest req = new EntityRequest();
//similar stuff and sends the response back
return response;
}


If I hit same rest url as POST request, it should return a HTTP 405 error.

This scenario is working fine for JSON requests but when I change request header to xml Accept:application/xml and Content-Type:application/xml, controller comes back with HTTP-500 error.


No comments:

Post a Comment