HttpStatus/docs/README.html

655 lines
28 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>HttpStatus JSP Tag Library</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="github-pandoc.css" />
</head>
<body>
<h1 id="httpstatus-jsp-tag-library">HttpStatus JSP Tag Library</h1>
<p><a href="https://github.com/ethauvin/httpstatus/releases/latest"><img src="https://img.shields.io/github/release/ethauvin/httpstatus.svg" alt="Release" /></a> <a href="https://search.maven.org/search?q=g:%22net.thauvin.erik.httpstatus%22%20AND%20a:%22httpstatus%22"><img src="https://img.shields.io/maven-central/v/net.thauvin.erik.httpstatus/httpstatus.svg?label=maven%20central" alt="Maven Central" /></a><br />
<a href="http://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" alt="License (3-Clause BSD)" /></a> <a href="https://snyk.io/test/github/ethauvin/httpstatus?targetFile=build.gradle"><img src="https://snyk.io/test/github/ethauvin/httpstatus/badge.svg?targetFile=build.gradle" alt="Known Vulnerabilities" /></a> <a href="https://sonarcloud.io/dashboard?id=ethauvin_HttpStatus"><img src="https://sonarcloud.io/api/project_badges/measure?project=ethauvin_HttpStatus&amp;metric=alert_status" alt="Quality Gate Status" /></a><br />
<a href="https://github.com/ethauvin/httpstatus/actions/workflows/gradle.yml"><img src="https://github.com/ethauvin/httpstatus/actions/workflows/gradle.yml/badge.svg" alt="GitHub CI" /></a> <a href="https://ci.appveyor.com/project/ethauvin/httpstatus"><img src="https://ci.appveyor.com/api/projects/status/w5j4kul3w2rkigxb?svg=true" alt="Build status" /></a> <a href="https://circleci.com/gh/ethauvin/HttpStatus/tree/master"><img src="https://circleci.com/gh/ethauvin/HttpStatus/tree/master.svg?style=shield" alt="CircleCI" /></a></p>
<p>A simple <a href="http://www.oracle.com/technetwork/java/javaee/jsp/index.html">JSP</a> Tag Library to display the <a href="#hscode">code</a>, <a href="#hsreason">reason</a>, <a href="#hscode">cause</a> and/or <a href="#hsmessage">message</a> for <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP status codes</a> in JSP error pages.</p>
<p>For example:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true"></a><span class="bu">&lt;%@ page</span><span class="ot"> isErrorPage</span>=<span class="st">&quot;true&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true"></a><span class="bu">&lt;%@ taglib</span><span class="ot"> prefix</span>=<span class="st">&quot;hs&quot;</span><span class="ot"> uri</span>=<span class="st">&quot;http://erik.thauvin.net/taglibs/httpstatus&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true"></a>&lt;html&gt;&lt;head&gt;</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true"></a>&lt;title&gt;<span class="kw">&lt;hs:code/&gt;</span> <span class="kw">&lt;hs:reason</span><span class="ot"> default</span>=<span class="dt">&quot;Server Error&quot;</span><span class="kw">/&gt;</span>&lt;/title&gt;</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true"></a>&lt;/head&gt;</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true"></a>&lt;h1&gt;<span class="kw">&lt;hs:reason</span><span class="ot"> default</span>=<span class="dt">&quot;Server Error&quot;</span><span class="kw">/&gt;</span>&lt;/h1&gt;</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true"></a>Cause: &lt;pre&gt;<span class="kw">&lt;hs:cause</span><span class="ot"> default</span>=<span class="dt">&quot;Unable to complete your request.&quot;</span><span class="kw">/&gt;</span>&lt;/pre&gt;</span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true"></a>Message: &lt;pre&gt;<span class="kw">&lt;hs:message</span><span class="ot"> default</span>=<span class="dt">&quot;A server error has occured.&quot;</span><span class="kw">/&gt;</span>&lt;/pre&gt;</span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true"></a>...</span></code></pre></div>
<p>or</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true"></a><span class="bu">&lt;%@ page</span><span class="ot"> isErrorPage</span>=<span class="st">&quot;true&quot;</span><span class="ot"> import</span>=<span class="st">&quot;net.thauvin.erik.httpstatus.Reasons&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true"></a><span class="pp">&lt;%=</span> Reasons.<span class="fu">getReasonPhrase</span>(pageContext.<span class="fu">getErrorData</span>().<span class="fu">getStatusCode</span>()) <span class="pp">%&gt;</span></span></code></pre></div>
<p>would display on a <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2">501 status code</a>:</p>
<pre><code>Not Implemented
</code></pre>
<h2 id="usage-with-gradle-or-maven">Usage with <a href="https://gradle.org/">Gradle</a> or <a href="http://maven.apache.org/">Maven</a></h2>
<p>Include the following in your <code>build.gradle</code> file:</p>
<pre class="gradle"><code>dependencies {
implementation &#39;net.thauvin.erik.httpstatus:httpstatus:1.0.6&#39;
}
</code></pre>
<p>or as a Maven artifact:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode xml"><code class="sourceCode xml"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true"></a><span class="kw">&lt;dependency&gt;</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true"></a> <span class="kw">&lt;groupId&gt;</span>net.thauvin.erik.httpstatus<span class="kw">&lt;/groupId&gt;</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true"></a> <span class="kw">&lt;artifactId&gt;</span>httpstatus<span class="kw">&lt;/artifactId&gt;</span></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true"></a> <span class="kw">&lt;version&gt;</span>1.0.6<span class="kw">&lt;/version&gt;</span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true"></a><span class="kw">&lt;/dependency&gt;</span></span></code></pre></div>
<h2 id="hscause">hs:cause</h2>
<p>The <code>&lt;hs:cause/&gt;</code> tag displays the cause of current HTTP status code, if any. A shorthand for:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true"></a><span class="pp">&lt;%=</span> pageContext.<span class="fu">getErrorData</span>().<span class="fu">getThrowable</span>().<span class="fu">getCause</span>().<span class="fu">getLocalizedMessage</span>() <span class="pp">%&gt;</span></span></code></pre></div>
<p>Optional attributes are:</p>
<table>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>default</code></td>
<td>The fallback value to output, if no cause is available.</td>
</tr>
<tr class="even">
<td><code>escapeXml</code></td>
<td>Converts &lt;, &gt;, &amp;, ', " to their corresponding <a href="http://dev.w3.org/html5/html-author/charref">entity codes</a>. Value is <code>true</code> by default.</td>
</tr>
</tbody>
</table>
<h2 id="hscode">hs:code</h2>
<p>The <code>&lt;hs:code/&gt;</code> tag displays the current HTTP status code, if any. A shorthand for:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true"></a><span class="pp">&lt;%=</span> pageContext.<span class="fu">getErrorData</span>().<span class="fu">getStatusCode</span>() <span class="pp">%&gt;</span></span></code></pre></div>
<h2 id="hsmessage">hs:message</h2>
<p>The <code>&lt;hs:message/&gt;</code> tag displays the current error message, if any. A shorthand for:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true"></a><span class="pp">&lt;%=</span> request.<span class="fu">getAttribute</span>(<span class="st">&quot;javax.servlet.error.message&quot;</span>) <span class="pp">%&gt;</span></span></code></pre></div>
<p>Optional attributes are:</p>
<table>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>default</code></td>
<td>The fallback value to output, if no error message is available.</td>
</tr>
<tr class="even">
<td><code>escapeXml</code></td>
<td>Converts &lt;, &gt;, &amp;, ', " to their corresponding <a href="http://dev.w3.org/html5/html-author/charref">entity codes</a>. Value is <code>true</code> by default.</td>
</tr>
</tbody>
</table>
<h2 id="hsreason">hs:reason</h2>
<p>The <code>&lt;hs:reason/&gt;</code> tag displays the reason for a HTTP status code, if any. Optional attributes are:</p>
<table>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>code</code></td>
<td>The HTTP status error code. If not specified the current status code is used.</td>
</tr>
<tr class="even">
<td><code>default</code></td>
<td>The fallback value to output, if no reason is available.</td>
</tr>
<tr class="odd">
<td><code>escapeXml</code></td>
<td>Converts &lt;, &gt;, &amp;, ', " to their corresponding <a href="http://dev.w3.org/html5/html-author/charref">entity codes</a>. Value is <code>true</code> by default.</td>
</tr>
</tbody>
</table>
<h2 id="statuscode-bean">StatusCode Bean</h2>
<p>The <code>StatusCode</code> bean can be used to check the class of the status code error. For example, using the JSTL:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true"></a><span class="bu">&lt;%@ taglib</span><span class="ot"> prefix</span>=<span class="st">&quot;hs&quot;</span><span class="ot"> uri</span>=<span class="st">&quot;http://erik.thauvin.net/taglibs/httpstatus&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true"></a><span class="bu">&lt;%@ taglib</span><span class="ot"> prefix</span>=<span class="st">&quot;c&quot;</span><span class="ot"> uri</span>=<span class="st">&quot;http://java.sun.com/jsp/jstl/core&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true"></a></span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true"></a><span class="bu">&lt;jsp:useBean</span><span class="ot"> id</span>=<span class="st">&quot;statusCode&quot;</span><span class="ot"> class</span>=<span class="st">&quot;net.thauvin.erik.httpstatus.StatusCode&quot;</span><span class="bu">/&gt;</span></span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true"></a><span class="kw">&lt;c:set</span><span class="ot"> target</span>=<span class="dt">&quot;</span><span class="pp">${</span>statusCode<span class="pp">}</span><span class="dt">&quot;</span><span class="ot"> property</span>=<span class="dt">&quot;code&quot;</span><span class="kw">&gt;&lt;hs:code/&gt;&lt;/c:set&gt;</span></span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true"></a><span class="kw">&lt;c:choose&gt;</span></span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true"></a> <span class="kw">&lt;c:when</span><span class="ot"> test</span>=<span class="dt">&quot;</span><span class="pp">${</span>statusCode.<span class="fu">isClientError</span>()<span class="pp">}</span><span class="dt">&quot;</span><span class="kw">&gt;</span></span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true"></a> An error occurred on your side. (<span class="kw">&lt;hs:reason/&gt;</span>)</span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true"></a> <span class="kw">&lt;/c:when&gt;</span></span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true"></a> <span class="kw">&lt;c:otherwise&gt;</span></span>
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true"></a> An error occurred on our side. (<span class="kw">&lt;hs:message/&gt;</span>)</span>
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true"></a> <span class="kw">&lt;/c:otherwise&gt;</span></span>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true"></a><span class="kw">&lt;/c:choose&gt;</span></span></code></pre></div>
<p>or in a Servlet:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode java"><code class="sourceCode java"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true"></a><span class="kw">import</span><span class="im"> net.thauvin.erik.httpstatus.StatusCode;</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true"></a></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true"></a><span class="co">// ---</span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true"></a></span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true"></a>StatusCode statusCode = <span class="kw">new</span> <span class="fu">StatusCode</span>((<span class="bu">Integer</span>) request.<span class="fu">getAttribute</span>(<span class="st">&quot;javax.servlet.error.status_code&quot;</span>));</span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true"></a><span class="kw">if</span> (statusCode.<span class="fu">isError</span>()) {</span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true"></a> <span class="kw">if</span> (statusCode.<span class="fu">isServerError</span>()) {</span>
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true"></a> <span class="bu">String</span> reason = statusCode.<span class="fu">getReason</span>();</span>
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true"></a> } <span class="kw">else</span> {</span>
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true"></a> <span class="co">// ...</span></span>
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true"></a> }</span>
<span id="cb10-12"><a href="#cb10-12" aria-hidden="true"></a>}</span></code></pre></div>
<p>The <code>StatusCode</code> bean methods are:</p>
<table>
<thead>
<tr class="header">
<th>Method</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>getReason</code></td>
<td>Returns the reason for the status code (eg: <code>Internal Server Error</code>)</td>
</tr>
<tr class="even">
<td><code>isClientError</code></td>
<td>Checks if the status code is a client error.</td>
</tr>
<tr class="odd">
<td><code>isError</code></td>
<td>Checks if the status code is a server or client error.</td>
</tr>
<tr class="even">
<td><code>isInfo</code></td>
<td>Checks if the status code is informational.</td>
</tr>
<tr class="odd">
<td><code>isRedirect</code></td>
<td>Checks if the status code is a redirect.</td>
</tr>
<tr class="even">
<td><code>isServerError</code></td>
<td>Checks if the status code is a server error.</td>
</tr>
<tr class="odd">
<td><code>isSuccess</code></td>
<td>Checks if the status code is a success. (<code>OK</code>)</td>
</tr>
<tr class="even">
<td><code>isValid</code></td>
<td>Checks if the status code is valid.</td>
</tr>
</tbody>
</table>
<h2 id="reasons">Reasons</h2>
<p>The reasons are defined in a <a href="http://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html">ResourceBundle</a> properties as follows:</p>
<table>
<thead>
<tr class="header">
<th>Status Code</th>
<th>Reason</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>100</code></td>
<td>Continue</td>
</tr>
<tr class="even">
<td><code>101</code></td>
<td>Switching Protocols</td>
</tr>
<tr class="odd">
<td><code>102</code></td>
<td>Processing</td>
</tr>
<tr class="even">
<td><code>103</code></td>
<td>Early Hints</td>
</tr>
<tr class="odd">
<td><code>200</code></td>
<td>OK</td>
</tr>
<tr class="even">
<td><code>201</code></td>
<td>Created</td>
</tr>
<tr class="odd">
<td><code>202</code></td>
<td>Accepted</td>
</tr>
<tr class="even">
<td><code>203</code></td>
<td>Non-Authoritative Information</td>
</tr>
<tr class="odd">
<td><code>204</code></td>
<td>No Content</td>
</tr>
<tr class="even">
<td><code>205</code></td>
<td>Reset Content</td>
</tr>
<tr class="odd">
<td><code>206</code></td>
<td>Partial Content</td>
</tr>
<tr class="even">
<td><code>207</code></td>
<td>Multi-Status</td>
</tr>
<tr class="odd">
<td><code>208</code></td>
<td>Already Reported</td>
</tr>
<tr class="even">
<td><code>218</code></td>
<td>This is fine</td>
</tr>
<tr class="odd">
<td><code>226</code></td>
<td>IM Used</td>
</tr>
<tr class="even">
<td><code>300</code></td>
<td>Multiple Choices</td>
</tr>
<tr class="odd">
<td><code>301</code></td>
<td>Moved Permanently</td>
</tr>
<tr class="even">
<td><code>302</code></td>
<td>Found/Moved Temporarily</td>
</tr>
<tr class="odd">
<td><code>303</code></td>
<td>See Other</td>
</tr>
<tr class="even">
<td><code>304</code></td>
<td>Not Modified</td>
</tr>
<tr class="odd">
<td><code>305</code></td>
<td>Use Proxy</td>
</tr>
<tr class="even">
<td><code>306</code></td>
<td>Switch Proxy</td>
</tr>
<tr class="odd">
<td><code>307</code></td>
<td>Temporary Redirect</td>
</tr>
<tr class="even">
<td><code>308</code></td>
<td>Permanent Redirect</td>
</tr>
<tr class="odd">
<td><code>400</code></td>
<td>Bad Request</td>
</tr>
<tr class="even">
<td><code>401</code></td>
<td>Unauthorized</td>
</tr>
<tr class="odd">
<td><code>402</code></td>
<td>Payment Required</td>
</tr>
<tr class="even">
<td><code>403</code></td>
<td>Forbidden</td>
</tr>
<tr class="odd">
<td><code>404</code></td>
<td>Not Found</td>
</tr>
<tr class="even">
<td><code>405</code></td>
<td>Method Not Allowed</td>
</tr>
<tr class="odd">
<td><code>406</code></td>
<td>Not Acceptable</td>
</tr>
<tr class="even">
<td><code>407</code></td>
<td>Proxy Authentication Required</td>
</tr>
<tr class="odd">
<td><code>408</code></td>
<td>Request Timeout</td>
</tr>
<tr class="even">
<td><code>409</code></td>
<td>Conflict</td>
</tr>
<tr class="odd">
<td><code>410</code></td>
<td>Gone</td>
</tr>
<tr class="even">
<td><code>411</code></td>
<td>Length Required</td>
</tr>
<tr class="odd">
<td><code>412</code></td>
<td>Precondition Failed</td>
</tr>
<tr class="even">
<td><code>413</code></td>
<td>Request Entity/Payload Too Large</td>
</tr>
<tr class="odd">
<td><code>414</code></td>
<td>Request-URI Too Long</td>
</tr>
<tr class="even">
<td><code>415</code></td>
<td>Unsupported Media Type</td>
</tr>
<tr class="odd">
<td><code>416</code></td>
<td>Requested Range Not Satisfiable</td>
</tr>
<tr class="even">
<td><code>417</code></td>
<td>Expectation Failed</td>
</tr>
<tr class="odd">
<td><code>418</code></td>
<td>I'm A Teapot</td>
</tr>
<tr class="even">
<td><code>419</code></td>
<td>Insufficient Space on Resource</td>
</tr>
<tr class="odd">
<td><code>420</code></td>
<td>Method Failure</td>
</tr>
<tr class="even">
<td><code>421</code></td>
<td>Misdirected Request</td>
</tr>
<tr class="odd">
<td><code>422</code></td>
<td>Unprocessable Entity</td>
</tr>
<tr class="even">
<td><code>423</code></td>
<td>Locked</td>
</tr>
<tr class="odd">
<td><code>424</code></td>
<td>Failed Dependency</td>
</tr>
<tr class="even">
<td><code>426</code></td>
<td>Upgrade Required</td>
</tr>
<tr class="odd">
<td><code>428</code></td>
<td>Precondition Required</td>
</tr>
<tr class="even">
<td><code>429</code></td>
<td>Too Many Requests</td>
</tr>
<tr class="odd">
<td><code>430</code></td>
<td>Request Header Fields Too Large</td>
</tr>
<tr class="even">
<td><code>431</code></td>
<td>Request Header Fields Too Large</td>
</tr>
<tr class="odd">
<td><code>440</code></td>
<td>Login Timeout</td>
</tr>
<tr class="even">
<td><code>444</code></td>
<td>No Response</td>
</tr>
<tr class="odd">
<td><code>449</code></td>
<td>Retry With</td>
</tr>
<tr class="even">
<td><code>450</code></td>
<td>Blocked by Windows Parental Controls</td>
</tr>
<tr class="odd">
<td><code>451</code></td>
<td>Unavailable For Legal Reasons</td>
</tr>
<tr class="even">
<td><code>460</code></td>
<td>Client Closed Connection Before Load Balancer Idle Timeout</td>
</tr>
<tr class="odd">
<td><code>463</code></td>
<td>X-Forwarded-For Header with More than 30 IP Addresses</td>
</tr>
<tr class="even">
<td><code>494</code></td>
<td>Request Header Too Large</td>
</tr>
<tr class="odd">
<td><code>495</code></td>
<td>SSL Certificate Error</td>
</tr>
<tr class="even">
<td><code>496</code></td>
<td>No SSL Certificate</td>
</tr>
<tr class="odd">
<td><code>497</code></td>
<td>HTTP Request Sent to HTTPS Port</td>
</tr>
<tr class="even">
<td><code>498</code></td>
<td>Token Expired/Invalid</td>
</tr>
<tr class="odd">
<td><code>499</code></td>
<td>Client Closed Request</td>
</tr>
<tr class="even">
<td><code>500</code></td>
<td>Internal Server Error</td>
</tr>
<tr class="odd">
<td><code>501</code></td>
<td>Not Implemented</td>
</tr>
<tr class="even">
<td><code>502</code></td>
<td>Bad Gateway</td>
</tr>
<tr class="odd">
<td><code>503</code></td>
<td>Service Unavailable</td>
</tr>
<tr class="even">
<td><code>504</code></td>
<td>Gateway Timeout</td>
</tr>
<tr class="odd">
<td><code>505</code></td>
<td>HTTP Version Not Supported</td>
</tr>
<tr class="even">
<td><code>506</code></td>
<td>Variant Also Negotiates</td>
</tr>
<tr class="odd">
<td><code>507</code></td>
<td>Insufficient Storage</td>
</tr>
<tr class="even">
<td><code>508</code></td>
<td>Loop Detected</td>
</tr>
<tr class="odd">
<td><code>509</code></td>
<td>Bandwidth Limit Exceeded</td>
</tr>
<tr class="even">
<td><code>510</code></td>
<td>Not Extended</td>
</tr>
<tr class="odd">
<td><code>511</code></td>
<td>Network Authentication Required</td>
</tr>
<tr class="even">
<td><code>520</code></td>
<td>Unknown Error</td>
</tr>
<tr class="odd">
<td><code>521</code></td>
<td>Web Server Is Down</td>
</tr>
<tr class="even">
<td><code>522</code></td>
<td>Origin Connection Time-out</td>
</tr>
<tr class="odd">
<td><code>523</code></td>
<td>Origin Is Unreachable</td>
</tr>
<tr class="even">
<td><code>524</code></td>
<td>A Timeout Occurred</td>
</tr>
<tr class="odd">
<td><code>525</code></td>
<td>SSL Handshake Failed</td>
</tr>
<tr class="even">
<td><code>526</code></td>
<td>Invalid SSL Certificate</td>
</tr>
<tr class="odd">
<td><code>527</code></td>
<td>Railgun Error</td>
</tr>
<tr class="even">
<td><code>529</code></td>
<td>Site is overloaded</td>
</tr>
<tr class="odd">
<td><code>530</code></td>
<td>Site is frozen</td>
</tr>
<tr class="even">
<td><code>598</code></td>
<td>Network Read Timeout Error</td>
</tr>
<tr class="odd">
<td><code>599</code></td>
<td>Network Connect Timeout Error</td>
</tr>
</tbody>
</table>
<h2 id="command-line-usage">Command Line Usage</h2>
<p>You can query the reason phrase for status codes as follows:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true"></a>$ <span class="ex">java</span> -jar httpstatus-1.0.6.jar 404 500</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true"></a><span class="ex">404</span>: Not Found</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true"></a><span class="ex">500</span>: Internal Server Error</span></code></pre></div>
<p>If no status code is specified, all will be printed:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true"></a>$ <span class="ex">java</span> -jar httpstatus-1.0.6.jar</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true"></a><span class="ex">100</span>: Continue</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true"></a><span class="ex">101</span>: Switching Protocols</span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true"></a><span class="ex">102</span>: Processing</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true"></a><span class="ex">103</span>: Early Hints</span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true"></a><span class="ex">200</span>: OK</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true"></a><span class="ex">201</span>: Created</span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true"></a><span class="ex">202</span>: Accepted</span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true"></a><span class="ex">203</span>: Non-Authoritative Information</span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true"></a><span class="ex">204</span>: No Content</span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true"></a><span class="ex">205</span>: Reset Content</span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true"></a><span class="ex">206</span>: Partial Content</span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true"></a><span class="ex">207</span>: Multi-Status</span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true"></a><span class="ex">208</span>: Already Reported</span>
<span id="cb12-15"><a href="#cb12-15" aria-hidden="true"></a><span class="ex">226</span>: IM Used</span>
<span id="cb12-16"><a href="#cb12-16" aria-hidden="true"></a><span class="ex">...</span></span></code></pre></div>
</body>
</html>