Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Servlet returning HTTP Response code

843842Apr 11 2008 — edited Apr 14 2008
Hi there, I've got a general question related to a project which uses Servlets.

My Servlets evaluates quite a lot of parameters (not only whether they are missing or empty, but also whether they make sense in the context of the application). As the Servlets aren't used by users in a web browser but rather by other software that connects to this servlet and retrieves information from it, I would like to return errors that occured (either because of missing/wrong parameters or because of errors that occured while processing the request) by sending an HTTP error code.

My question to you is whether it is allowed to simply use "arbitrary", "unused" error codes from the 500 range (e.g. 550 and up).

If this is not allowed, would it be allowed to simply return the normal 500 error code and then be able to specify what went wrong in the header itself (e.g. when calling the response.sendError(...) method), like appending the "internal" error code (which can be then be any number, of course) ?

Thanks,
NZ912
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 11 2008
Added on Apr 11 2008
3 comments
429 views