From 0c0e8bf0c5b79d432df9d61aa4aa1386d7e28112 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Thu, 3 Dec 2015 00:10:45 -0800 Subject: [PATCH] Added more status codes and reason strings. --- HttpStatus.iml | 84 ------------------- HttpStatus.ipr | 23 +---- README.md | 36 +++++++- build.gradle | 5 -- .../erik/httpstatus/reasons.properties | 32 ++++++- 5 files changed, 67 insertions(+), 113 deletions(-) diff --git a/HttpStatus.iml b/HttpStatus.iml index f05d6c7..f9bb861 100644 --- a/HttpStatus.iml +++ b/HttpStatus.iml @@ -41,89 +41,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/HttpStatus.ipr b/HttpStatus.ipr index 19d0f7d..99a2859 100644 --- a/HttpStatus.ipr +++ b/HttpStatus.ipr @@ -227,26 +227,6 @@ - - - - - - - - - Android Lint - - - Java - - - Portability issuesJava - - - - - @@ -265,6 +245,9 @@ + + + diff --git a/README.md b/README.md index f827e5e..431048b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ or ```jsp <%@ page isErrorPage="true" import="net.thauvin.erik.httpstatus.Reasons" %> -<%= Reasons.getReasonPhrase(501) %> +<%= Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()) %> ``` would display on a [501 status code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2): @@ -36,7 +36,7 @@ Attribute | Description `statusCode` | The HTTP status error code. If not specified the current status code is used. | No `default` | The fallback value to output. | No -The reasons are defined as follows: +The reasons are defined in a [ResourceBundle](http://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html) properties as follows: Status Code | Reason ----------- | ------------------------------- @@ -51,13 +51,17 @@ Status Code | Reason `205` | Reset Content `206` | Partial Content `207` | Multi-Status +`208` | Already Reported +`226` | IM Used `300` | Multiple Choices `301` | Moved Permanently `302` | Moved Temporarily `303` | See Other `304` | Not Modified `305` | Use Proxy +`306` | Switch Proxy `307` | Temporary Redirect +`308` | Permanent Redirect `400` | Bad Request `401` | Unauthorized `402` | Payment Required @@ -76,15 +80,41 @@ Status Code | Reason `415` | Unsupported Media Type `416` | Requested Range Not Satisfiable `417` | Expectation Failed +`418` | I'm A Teapot `419` | Insufficient Space on Resource `420` | Method Failure +`421` | Misdirected Request `422` | Unprocessable Entity `423` | Locked `424` | Failed Dependency +`426` | Upgrade Required +`428` | Precondition Required +`429` | Too Many Requests +`431` | Request Header Fields Too Large +`440` | Login Timeout +`444` | No Response +`449` | Retry With +`450` | Blocked by Windows Parental Controls +`451` | Unavailable For Legal Reasons +`494` | Request Header Too Large +`495` | Cert Error +`496` | No Cert +`497` | HTTP to HTTPS +`498` | Token Expired/Invalid +`499` | Client Closed Request `500` | Internal Server Error `501` | Not Implemented `502` | Bad Gateway `503` | Service Unavailable `504` | Gateway Timeout `505` | HTTP Version Not Supported -`507` | Insufficient Storage \ No newline at end of file +`506` | Variant Also Negotiates +`507` | Insufficient Storage +`508` | Loop Detected +`509` | Bandwidth Limit Exceeded +`510` | Not Extended +`511` | Network Authentication Required +`520` | Unknown Error +`522` | Origin Connection Time-out +`598` | Network Read Timeout Error +`599` | Network Connect Timeout Error \ No newline at end of file diff --git a/build.gradle b/build.gradle index 83477fb..8880542 100644 --- a/build.gradle +++ b/build.gradle @@ -21,11 +21,6 @@ repositories { dependencies { compile 'servletapi:servlet-api:+' compile 'javax.servlet.jsp:jsp-api:+' - testCompile 'org.testng:testng:+' -} - -test { - useTestNG() } compileJava { diff --git a/src/main/resources/net/thauvin/erik/httpstatus/reasons.properties b/src/main/resources/net/thauvin/erik/httpstatus/reasons.properties index 851f992..8f99dac 100644 --- a/src/main/resources/net/thauvin/erik/httpstatus/reasons.properties +++ b/src/main/resources/net/thauvin/erik/httpstatus/reasons.properties @@ -9,13 +9,17 @@ 205=Reset Content 206=Partial Content 207=Multi-Status +208=Already Reported +226=IM Used 300=Multiple Choices 301=Moved Permanently 302=Moved Temporarily 303=See Other 304=Not Modified 305=Use Proxy +306=Switch Proxy 307=Temporary Redirect +308=Permanent Redirect 400=Bad Request 401=Unauthorized 402=Payment Required @@ -34,15 +38,41 @@ 415=Unsupported Media Type 416=Requested Range Not Satisfiable 417=Expectation Failed +418=I'm A Teapot 419=Insufficient Space on Resource 420=Method Failure +421=Misdirected Request 422=Unprocessable Entity 423=Locked 424=Failed Dependency +426=Upgrade Required +428=Precondition Required +429=Too Many Requests +431=Request Header Fields Too Large +440=Login Timeout +444=No Response +449=Retry With +450=Blocked by Windows Parental Controls +451=Unavailable For Legal Reasons +494=Request Header Too Large +495=Cert Error +496=No Cert +497=HTTP to HTTPS +498=Token Expired/Invalid +499=Client Closed Request 500=Internal Server Error 501=Not Implemented 502=Bad Gateway 503=Service Unavailable 504=Gateway Timeout 505=HTTP Version Not Supported -507=Insufficient Storage \ No newline at end of file +506=Variant Also Negotiates +507=Insufficient Storage +508=Loop Detected +509=Bandwidth Limit Exceeded +510=Not Extended +511=Network Authentication Required +520=Unknown Error +522=Origin Connection Time-out +598=Network Read Timeout Error +599=Network Connect Timeout Error \ No newline at end of file