Related issue: NETTY-259 (Add constants and enums for HTTP PATCH method)
* Added HttpMethod.PATCH * Added HttpHeaders.Names.ACCEPT_PATCH * Added all known HTTP response code to HttpResponseStatus
This commit is contained in:
parent
d87408936f
commit
feac8bb5fa
@ -56,6 +56,10 @@ public final class HttpHeaders {
|
|||||||
* {@code "Accept-Ranges"}
|
* {@code "Accept-Ranges"}
|
||||||
*/
|
*/
|
||||||
public static final String ACCEPT_RANGES= "Accept-Ranges";
|
public static final String ACCEPT_RANGES= "Accept-Ranges";
|
||||||
|
/**
|
||||||
|
* {@code "Accept-Patch"}
|
||||||
|
*/
|
||||||
|
public static final String ACCEPT_PATCH= "Accept-Patch";
|
||||||
/**
|
/**
|
||||||
* {@code "Age"}
|
* {@code "Age"}
|
||||||
*/
|
*/
|
||||||
|
@ -61,6 +61,12 @@ public class HttpMethod implements Comparable<HttpMethod> {
|
|||||||
*/
|
*/
|
||||||
public static final HttpMethod PUT = new HttpMethod("PUT");
|
public static final HttpMethod PUT = new HttpMethod("PUT");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The PATCH method requests that a set of changes described in the
|
||||||
|
* request entity be applied to the resource identified by the Request-URI.
|
||||||
|
*/
|
||||||
|
public static final HttpMethod PATCH = new HttpMethod("PATCH");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The DELETE method requests that the origin server delete the resource identified by the Request-URI.
|
* The DELETE method requests that the origin server delete the resource identified by the Request-URI.
|
||||||
*/
|
*/
|
||||||
@ -85,6 +91,7 @@ public class HttpMethod implements Comparable<HttpMethod> {
|
|||||||
methodMap.put(HEAD.toString(), HEAD);
|
methodMap.put(HEAD.toString(), HEAD);
|
||||||
methodMap.put(POST.toString(), POST);
|
methodMap.put(POST.toString(), POST);
|
||||||
methodMap.put(PUT.toString(), PUT);
|
methodMap.put(PUT.toString(), PUT);
|
||||||
|
methodMap.put(PATCH.toString(), PATCH);
|
||||||
methodMap.put(DELETE.toString(), DELETE);
|
methodMap.put(DELETE.toString(), DELETE);
|
||||||
methodMap.put(TRACE.toString(), TRACE);
|
methodMap.put(TRACE.toString(), TRACE);
|
||||||
methodMap.put(CONNECT.toString(), CONNECT);
|
methodMap.put(CONNECT.toString(), CONNECT);
|
||||||
|
@ -39,6 +39,11 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
*/
|
*/
|
||||||
public static final HttpResponseStatus SWITCHING_PROTOCOLS = new HttpResponseStatus(101, "Switching Protocols");
|
public static final HttpResponseStatus SWITCHING_PROTOCOLS = new HttpResponseStatus(101, "Switching Protocols");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 102 Processing (WebDAV, RFC2518)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus PROCESSING = new HttpResponseStatus(102, "Processing");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 200 OK
|
* 200 OK
|
||||||
*/
|
*/
|
||||||
@ -55,7 +60,7 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
public static final HttpResponseStatus ACCEPTED = new HttpResponseStatus(202, "Accepted");
|
public static final HttpResponseStatus ACCEPTED = new HttpResponseStatus(202, "Accepted");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 203 Non-Authoritative Information
|
* 203 Non-Authoritative Information (since HTTP/1.1)
|
||||||
*/
|
*/
|
||||||
public static final HttpResponseStatus NON_AUTHORITATIVE_INFORMATION = new HttpResponseStatus(203, "Non-Authoritative Information");
|
public static final HttpResponseStatus NON_AUTHORITATIVE_INFORMATION = new HttpResponseStatus(203, "Non-Authoritative Information");
|
||||||
|
|
||||||
@ -74,6 +79,11 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
*/
|
*/
|
||||||
public static final HttpResponseStatus PARTIAL_CONTENT = new HttpResponseStatus(206, "Partial Content");
|
public static final HttpResponseStatus PARTIAL_CONTENT = new HttpResponseStatus(206, "Partial Content");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 207 Multi-Status (WebDAV, RFC2518)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus MULTI_STATUS = new HttpResponseStatus(207, "Multi-Status");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 300 Multiple Choices
|
* 300 Multiple Choices
|
||||||
*/
|
*/
|
||||||
@ -90,7 +100,7 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
public static final HttpResponseStatus FOUND = new HttpResponseStatus(302, "Found");
|
public static final HttpResponseStatus FOUND = new HttpResponseStatus(302, "Found");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 303 See Other
|
* 303 See Other (since HTTP/1.1)
|
||||||
*/
|
*/
|
||||||
public static final HttpResponseStatus SEE_OTHER = new HttpResponseStatus(303, "See Other");
|
public static final HttpResponseStatus SEE_OTHER = new HttpResponseStatus(303, "See Other");
|
||||||
|
|
||||||
@ -100,12 +110,12 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
public static final HttpResponseStatus NOT_MODIFIED = new HttpResponseStatus(304, "Not Modified");
|
public static final HttpResponseStatus NOT_MODIFIED = new HttpResponseStatus(304, "Not Modified");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 305 Use Proxy
|
* 305 Use Proxy (since HTTP/1.1)
|
||||||
*/
|
*/
|
||||||
public static final HttpResponseStatus USE_PROXY = new HttpResponseStatus(305, "Use Proxy");
|
public static final HttpResponseStatus USE_PROXY = new HttpResponseStatus(305, "Use Proxy");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 307 Temporary Redirect
|
* 307 Temporary Redirect (since HTTP/1.1)
|
||||||
*/
|
*/
|
||||||
public static final HttpResponseStatus TEMPORARY_REDIRECT = new HttpResponseStatus(307, "Temporary Redirect");
|
public static final HttpResponseStatus TEMPORARY_REDIRECT = new HttpResponseStatus(307, "Temporary Redirect");
|
||||||
|
|
||||||
@ -199,6 +209,31 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
*/
|
*/
|
||||||
public static final HttpResponseStatus EXPECTATION_FAILED = new HttpResponseStatus(417, "Expectation Failed");
|
public static final HttpResponseStatus EXPECTATION_FAILED = new HttpResponseStatus(417, "Expectation Failed");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 422 Unprocessable Entity (WebDAV, RFC4918)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus UNPROCESSABLE_ENTITY = new HttpResponseStatus(422, "Unprocessable Entity");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 423 Locked (WebDAV, RFC4918)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus LOCKED = new HttpResponseStatus(423, "Locked");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 424 Failed Dependency (WebDAV, RFC4918)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus FAILED_DEPENDENCY = new HttpResponseStatus(424, "Failed Dependency");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 425 Unordered Collection (WebDAV, RFC3648)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus UNORDERED_COLLECTION = new HttpResponseStatus(425, "Unordered Collection");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 426 Upgrade Required (RFC2817)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus UPGRADE_REQUIRED = new HttpResponseStatus(426, "Upgrade Required");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 500 Internal Server Error
|
* 500 Internal Server Error
|
||||||
*/
|
*/
|
||||||
@ -229,6 +264,21 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
*/
|
*/
|
||||||
public static final HttpResponseStatus HTTP_VERSION_NOT_SUPPORTED = new HttpResponseStatus(505, "HTTP Version Not Supported");
|
public static final HttpResponseStatus HTTP_VERSION_NOT_SUPPORTED = new HttpResponseStatus(505, "HTTP Version Not Supported");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 506 Variant Also Negotiates (RFC2295)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus VARIANT_ALSO_NEGOTIATES = new HttpResponseStatus(506, "Variant Also Negotiates");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 507 Insufficient Storage (WebDAV, RFC4918)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus INSUFFICIENT_STORAGE = new HttpResponseStatus(507, "Insufficient Storage");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 510 Not Extended (RFC2774)
|
||||||
|
*/
|
||||||
|
public static final HttpResponseStatus NOT_EXTENDED = new HttpResponseStatus(510, "Not Extended");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link HttpResponseStatus} represented by the specified code.
|
* Returns the {@link HttpResponseStatus} represented by the specified code.
|
||||||
* If the specified code is a standard HTTP status code, a cached instance
|
* If the specified code is a standard HTTP status code, a cached instance
|
||||||
@ -240,6 +290,8 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
return CONTINUE;
|
return CONTINUE;
|
||||||
case 101:
|
case 101:
|
||||||
return SWITCHING_PROTOCOLS;
|
return SWITCHING_PROTOCOLS;
|
||||||
|
case 102:
|
||||||
|
return PROCESSING;
|
||||||
case 200:
|
case 200:
|
||||||
return OK;
|
return OK;
|
||||||
case 201:
|
case 201:
|
||||||
@ -254,6 +306,8 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
return RESET_CONTENT;
|
return RESET_CONTENT;
|
||||||
case 206:
|
case 206:
|
||||||
return PARTIAL_CONTENT;
|
return PARTIAL_CONTENT;
|
||||||
|
case 207:
|
||||||
|
return MULTI_STATUS;
|
||||||
case 300:
|
case 300:
|
||||||
return MULTIPLE_CHOICES;
|
return MULTIPLE_CHOICES;
|
||||||
case 301:
|
case 301:
|
||||||
@ -304,6 +358,16 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
return REQUESTED_RANGE_NOT_SATISFIABLE;
|
return REQUESTED_RANGE_NOT_SATISFIABLE;
|
||||||
case 417:
|
case 417:
|
||||||
return EXPECTATION_FAILED;
|
return EXPECTATION_FAILED;
|
||||||
|
case 422:
|
||||||
|
return UNPROCESSABLE_ENTITY;
|
||||||
|
case 423:
|
||||||
|
return LOCKED;
|
||||||
|
case 424:
|
||||||
|
return FAILED_DEPENDENCY;
|
||||||
|
case 425:
|
||||||
|
return UNORDERED_COLLECTION;
|
||||||
|
case 426:
|
||||||
|
return UPGRADE_REQUIRED;
|
||||||
case 500:
|
case 500:
|
||||||
return INTERNAL_SERVER_ERROR;
|
return INTERNAL_SERVER_ERROR;
|
||||||
case 501:
|
case 501:
|
||||||
@ -316,6 +380,12 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
return GATEWAY_TIMEOUT;
|
return GATEWAY_TIMEOUT;
|
||||||
case 505:
|
case 505:
|
||||||
return HTTP_VERSION_NOT_SUPPORTED;
|
return HTTP_VERSION_NOT_SUPPORTED;
|
||||||
|
case 506:
|
||||||
|
return VARIANT_ALSO_NEGOTIATES;
|
||||||
|
case 507:
|
||||||
|
return INSUFFICIENT_STORAGE;
|
||||||
|
case 510:
|
||||||
|
return NOT_EXTENDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String reasonPhrase;
|
final String reasonPhrase;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user