Merge pull request #3252 from eclipse-vertx/missing-methods-from-rfcs

Missing methods from rfcs
This commit is contained in:
Paulo Lopes
2020-01-10 16:18:12 +01:00
committed by GitHub
3 changed files with 253 additions and 10 deletions

View File

@@ -20,55 +20,166 @@ import java.util.Objects;
* Represents an HTTP method.
*
* @author <a href="http://tfox.org">Tim Fox</a>
* @author <a href="mailto:plopes@redhat.com">Paulo Lopes</a>
*/
@VertxGen
public interface HttpMethod {
/**
* The {@code OPTIONS} method, this instance is interned and uniquely used.
* The RFC 2616 {@code OPTIONS} method, this instance is interned and uniquely used.
*/
HttpMethod OPTIONS = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.OPTIONS);
/**
* The {@code GET} method, this instance is interned and uniquely used.
* The RFC 2616 {@code GET} method, this instance is interned and uniquely used.
*/
HttpMethod GET = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.GET);
/**
* The {@code HEAD} method, this instance is interned and uniquely used.
* The RFC 2616 {@code HEAD} method, this instance is interned and uniquely used.
*/
HttpMethod HEAD = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.HEAD);
/**
* The {@code POST} method, this instance is interned and uniquely used.
* The {RFC 2616 @code POST} method, this instance is interned and uniquely used.
*/
HttpMethod POST = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.POST);
/**
* The {@code PUT} method, this instance is interned and uniquely used.
* The RFC 2616 {@code PUT} method, this instance is interned and uniquely used.
*/
HttpMethod PUT = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.PUT);
/**
* The {@code DELETE} method, this instance is interned and uniquely used.
* The RFC 2616 {@code DELETE} method, this instance is interned and uniquely used.
*/
HttpMethod DELETE = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.DELETE);
/**
* The {@code TRACE} method, this instance is interned and uniquely used.
* The RFC 2616 {@code TRACE} method, this instance is interned and uniquely used.
*/
HttpMethod TRACE = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.TRACE);
/**
* The {@code CONNECT} method, this instance is interned and uniquely used.
* The RFC 2616 {@code CONNECT} method, this instance is interned and uniquely used.
*/
HttpMethod CONNECT = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.CONNECT);
/**
* The {@code PATCH} method, this instance is interned and uniquely used.
* The RFC 5789 {@code PATCH} method, this instance is interned and uniquely used.
*/
HttpMethod PATCH = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.PATCH);
/**
* The RFC 2518/4918 {@code PROPFIND} method, this instance is interned and uniquely used.
*/
HttpMethod PROPFIND = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("PROPFIND"));
/**
* The RFC 2518/4918 {@code PROPPATCH} method, this instance is interned and uniquely used.
*/
HttpMethod PROPPATCH = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("PROPPATCH"));
/**
* The RFC 2518/4918 {@code MKCOL} method, this instance is interned and uniquely used.
*/
HttpMethod MKCOL = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("MKCOL"));
/**
* The RFC 2518/4918 {@code COPY} method, this instance is interned and uniquely used.
*/
HttpMethod COPY = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("COPY"));
/**
* The RFC 2518/4918 {@code MOVE} method, this instance is interned and uniquely used.
*/
HttpMethod MOVE = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("MOVE"));
/**
* The RFC 2518/4918 {@code LOCK} method, this instance is interned and uniquely used.
*/
HttpMethod LOCK = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("LOCK"));
/**
* The RFC 2518/4918 {@code UNLOCK} method, this instance is interned and uniquely used.
*/
HttpMethod UNLOCK = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("UNLOCK"));
/**
* The RFC 4791 {@code MKCALENDAR} method, this instance is interned and uniquely used.
*/
HttpMethod MKCALENDAR = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("MKCALENDAR"));
/**
* The RFC 3253 {@code VERSION_CONTROL} method, this instance is interned and uniquely used.
*/
HttpMethod VERSION_CONTROL = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("VERSION-CONTROL"));
/**
* The RFC 3253 {@code REPORT} method, this instance is interned and uniquely used.
*/
HttpMethod REPORT = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("REPORT"));
/**
* The RFC 3253 {@code CHECKOUT} method, this instance is interned and uniquely used.
*/
HttpMethod CHECKOUT = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("CHECKOUT"));
/**
* The RFC 3253 {@code CHECKIN} method, this instance is interned and uniquely used.
*/
HttpMethod CHECKIN = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("CHECKIN"));
/**
* The RFC 3253 {@code UNCHECKOUT} method, this instance is interned and uniquely used.
*/
HttpMethod UNCHECKOUT = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("UNCHECKOUT"));
/**
* The RFC 3253 {@code MKWORKSPACE} method, this instance is interned and uniquely used.
*/
HttpMethod MKWORKSPACE = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("MKWORKSPACE"));
/**
* The RFC 3253 {@code UPDATE} method, this instance is interned and uniquely used.
*/
HttpMethod UPDATE = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("UPDATE"));
/**
* The RFC 3253 {@code LABEL} method, this instance is interned and uniquely used.
*/
HttpMethod LABEL = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("LABEL"));
/**
* The RFC 3253 {@code MERGE} method, this instance is interned and uniquely used.
*/
HttpMethod MERGE = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("MERGE"));
/**
* The RFC 3253 {@code BASELINE_CONTROL} method, this instance is interned and uniquely used.
*/
HttpMethod BASELINE_CONTROL = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("BASELINE-CONTROL"));
/**
* The RFC 3253 {@code MKACTIVITY} method, this instance is interned and uniquely used.
*/
HttpMethod MKACTIVITY = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("MKACTIVITY"));
/**
* The RFC 3648 {@code ORDERPATCH} method, this instance is interned and uniquely used.
*/
HttpMethod ORDERPATCH = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("ORDERPATCH"));
/**
* The RFC 3744 {@code ACL} method, this instance is interned and uniquely used.
*/
HttpMethod ACL = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("ACL"));
/**
* The RFC 5323 {@code SEARCH} method, this instance is interned and uniquely used.
*/
HttpMethod SEARCH = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("SEARCH"));
/**
* @return the method name
*/
@@ -113,6 +224,50 @@ public interface HttpMethod {
return CONNECT;
case "PATCH":
return PATCH;
case "PROPFIND":
return PROPFIND;
case "PROPPATCH":
return PROPPATCH;
case "MKCOL":
return MKCOL;
case "COPY":
return COPY;
case "MOVE":
return MOVE;
case "LOCK":
return LOCK;
case "UNLOCK":
return UNLOCK;
case "MKCALENDAR":
return MKCALENDAR;
case "VERSION-CONTROL":
return VERSION_CONTROL;
case "REPORT":
return REPORT;
case "CHECKOUT":
return CHECKOUT;
case "CHECKIN":
return CHECKIN;
case "UNCHECKOUT":
return UNCHECKOUT;
case "MKWORKSPACE":
return MKWORKSPACE;
case "UPDATE":
return UPDATE;
case "LABEL":
return LABEL;
case "MERGE":
return MERGE;
case "BASELINE-CONTROL":
return BASELINE_CONTROL;
case "MKACTIVITY":
return MKACTIVITY;
case "ORDERPATCH":
return ORDERPATCH;
case "ACL":
return ACL;
case "SEARCH":
return SEARCH;
default:
return new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf(value));
}

View File

@@ -64,6 +64,50 @@ public class HttpMethodImpl implements HttpMethod {
return CONNECT;
case "PATCH":
return PATCH;
case "PROPFIND":
return PROPFIND;
case "PROPPATCH":
return PROPPATCH;
case "MKCOL":
return MKCOL;
case "COPY":
return COPY;
case "MOVE":
return MOVE;
case "LOCK":
return LOCK;
case "UNLOCK":
return UNLOCK;
case "MKCALENDAR":
return MKCALENDAR;
case "VERSION-CONTROL":
return VERSION_CONTROL;
case "REPORT":
return REPORT;
case "CHECKOUT":
return CHECKOUT;
case "CHECKIN":
return CHECKIN;
case "UNCHECKOUT":
return UNCHECKOUT;
case "MKWORKSPACE":
return MKWORKSPACE;
case "UPDATE":
return UPDATE;
case "LABEL":
return LABEL;
case "MERGE":
return MERGE;
case "BASELINE-CONTROL":
return BASELINE_CONTROL;
case "MKACTIVITY":
return MKACTIVITY;
case "ORDERPATCH":
return ORDERPATCH;
case "ACL":
return ACL;
case "SEARCH":
return SEARCH;
default:
return new HttpMethodImpl(sMethod);
}

View File

@@ -34,6 +34,28 @@ public class HttpMethodTest {
assertEquals("OPTIONS", HttpMethod.OPTIONS.name());
assertEquals("PATCH", HttpMethod.PATCH.name());
assertEquals("TRACE", HttpMethod.TRACE.name());
assertEquals("PROPFIND", HttpMethod.PROPFIND.name());
assertEquals("PROPPATCH", HttpMethod.PROPPATCH.name());
assertEquals("MKCOL", HttpMethod.MKCOL.name());
assertEquals("COPY", HttpMethod.COPY.name());
assertEquals("MOVE", HttpMethod.MOVE.name());
assertEquals("LOCK", HttpMethod.LOCK.name());
assertEquals("UNLOCK", HttpMethod.UNLOCK.name());
assertEquals("MKCALENDAR", HttpMethod.MKCALENDAR.name());
assertEquals("VERSION-CONTROL", HttpMethod.VERSION_CONTROL.name());
assertEquals("REPORT", HttpMethod.REPORT.name());
assertEquals("CHECKOUT", HttpMethod.CHECKOUT.name());
assertEquals("CHECKIN", HttpMethod.CHECKIN.name());
assertEquals("UNCHECKOUT", HttpMethod.UNCHECKOUT.name());
assertEquals("MKWORKSPACE", HttpMethod.MKWORKSPACE.name());
assertEquals("UPDATE", HttpMethod.UPDATE.name());
assertEquals("LABEL", HttpMethod.LABEL.name());
assertEquals("MERGE", HttpMethod.MERGE.name());
assertEquals("BASELINE-CONTROL", HttpMethod.BASELINE_CONTROL.name());
assertEquals("MKACTIVITY", HttpMethod.MKACTIVITY.name());
assertEquals("ORDERPATCH", HttpMethod.ORDERPATCH.name());
assertEquals("ACL", HttpMethod.ACL.name());
assertEquals("SEARCH", HttpMethod.SEARCH.name());
}
@Test
@@ -47,7 +69,29 @@ public class HttpMethodTest {
HttpMethod.DELETE,
HttpMethod.OPTIONS,
HttpMethod.PATCH,
HttpMethod.TRACE
HttpMethod.TRACE,
HttpMethod.PROPFIND,
HttpMethod.PROPPATCH,
HttpMethod.MKCOL,
HttpMethod.COPY,
HttpMethod.MOVE,
HttpMethod.LOCK,
HttpMethod.UNLOCK,
HttpMethod.MKCALENDAR,
HttpMethod.VERSION_CONTROL,
HttpMethod.REPORT,
HttpMethod.CHECKOUT,
HttpMethod.CHECKIN,
HttpMethod.UNCHECKOUT,
HttpMethod.MKWORKSPACE,
HttpMethod.UPDATE,
HttpMethod.LABEL,
HttpMethod.MERGE,
HttpMethod.BASELINE_CONTROL,
HttpMethod.MKACTIVITY,
HttpMethod.ORDERPATCH,
HttpMethod.ACL,
HttpMethod.SEARCH
)) {
assertSame(HttpMethod.valueOf(method.name()), method);
assertSame(method.name(), method.toString());