I'm using JAX-RS and I want to display the HTTP status and an error message.
Example: HTTP 204 No Content
Here is my code:
public Response getMessageById(@Context HttpServletRequest request,
@PathParam("idMessage") BigInteger idMessage){
if (idMessage== null){
return Response.status(HttpURLConnection.HTTP_NO_CONTENT)
.entity("No Content").build();
}
}
It displays No Content without the HTTP status.