Skip to main content

HTTP Status Codes

By default, a 200 (OK) status is automatically set as the HTTP status when a Java method executes successfully.

Other status codes can be generated by throwing a BasicHttpException with a specific HTTP status code, or calling HttpServletResponse.setStatus(int).

Non-OK (200) status codes are automatically triggered by the following conditions:

CodeDescriptionWhen triggered
401UnauthorizedA org.apache.juneau.rest.guard prevented the method from being executed
404Not FoundNo matching path patterns were found on any method
405Method Not ImplementedA path pattern matched but no Java methods were found for the HTTP method
406Not AcceptableA path pattern matched but no Java methods were found with a matching serializer for the Accept on the request
412Precondition FailedA path pattern matched but no Java methods were found that were not rejected by org.apache.juneau.rest.matcher
415Unsupported Media TypeA path pattern matched but no Java methods were found with a matching parser for the Content-Type on the request
500Internal Server ErrorThe Java method threw an exception other than BasicHttpException