KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm working on a RESTful web service in Java. I need a good way to send error messages to the client if something's wrong. According to the Javadoc , HttpServletResponse.setStatus(int status, String message) is deprecated "due to ambiguous meaning of the message parameter." Is there a preferred way to set the status message or " reason phrase " of the response? The sendError(int, String) method doesn't do it. Edit : To clarify, I want to modify the HTTP status line, i.e. "HTTP/1.1 404 Not Found" , not the body content. Specifically, I'd like to send responses like "HTTP/1.1 400 Missing customerNumber parameter" . Or I want to modify the HTTP status line to say something like 227 IM Used - in other words: an HTTP Status Description different from what the web-server would know to send.
Tags (comma-separated)
Save Edits
Cancel