blob: 9ad7105748e73882f239808afb1a8e644f8027ce [file] [log] [blame]
<!--
/***************************************************************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
***************************************************************************************************************************/
-->
HTTP Status Codes
<p>
By default, a 200 (OK) status is automatically set as the HTTP status when a Java method executes
successfully.
</p>
<p>
Other status codes can be generated by throwing a {@link oajr.RestException} with a
specific HTTP status code, or calling {@link javax.servlet.http.HttpServletResponse#setStatus(int)}.
</p>
<p>
Non-OK (200) status codes are automatically triggered by the following conditions:
</p>
<table class='styled w800'>
<tr>
<th><l>Code</l></th>
<th><l>Description</l></th>
<th><l>When triggered</l></th>
</tr>
<tr>
<td><l>401</l></td>
<td>Unauthorized</td>
<td>A {@link oajr.RestGuard guard} prevented the method from being executed</td>
</tr>
<tr>
<td><l>404</l></td>
<td>Not Found</td>
<td>No matching path patterns were found on any method</td>
</tr>
<tr>
<td><l>405</l></td>
<td>Method Not Implemented</td>
<td>A path pattern matched, but no Java methods were found for the HTTP method</td>
</tr>
<tr>
<td><l>406</l></td>
<td>Not Acceptable</td>
<td>
A path pattern matched, but no Java methods were found with a matching serializer for the
<l>Accept</l> on the request
</td>
</tr>
<tr>
<td><l>412</l></td>
<td>Precondition Failed</td>
<td>
A path pattern matched, but no Java methods were found that were not rejected by
{@link oajr.RestMatcher matchers}
</td>
</tr>
<tr>
<td><l>415</l></td>
<td>Unsupported Media Type</td>
<td>
A path pattern matched, but no Java methods were found with a matching parser for the
<l>Content-Type</l> on the request
</td>
</tr>
<tr>
<td><l>500</l></td>
<td>Internal Server Error</td>
<td>The Java method threw an exception other than {@link oajr.RestException}</td>
</tr>
</table>