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:
Code | Description | When triggered |
---|---|---|
401 | Unauthorized | A org.apache.juneau.rest.guard prevented the method from being executed |
404 | Not Found | No matching path patterns were found on any method |
405 | Method Not Implemented | A path pattern matched but no Java methods were found for the HTTP method |
406 | Not Acceptable | A path pattern matched but no Java methods were found with a matching serializer for the Accept on the request |
412 | Precondition Failed | A path pattern matched but no Java methods were found that were not rejected by org.apache.juneau.rest.matcher |
415 | Unsupported Media Type | A path pattern matched but no Java methods were found with a matching parser for the Content-Type on the request |
500 | Internal Server Error | The Java method threw an exception other than BasicHttpException |