mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
Add HttpMethod.values() returning an un-modifiable list of HTTP methods known by the declaring interface
This commit is contained in:
@@ -14,6 +14,7 @@ package io.vertx.core.http;
|
||||
import io.vertx.codegen.annotations.VertxGen;
|
||||
import io.vertx.core.http.impl.HttpMethodImpl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -180,6 +181,8 @@ public interface HttpMethod {
|
||||
*/
|
||||
HttpMethod SEARCH = new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf("SEARCH"));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the method name
|
||||
*/
|
||||
@@ -272,4 +275,11 @@ public interface HttpMethod {
|
||||
return new HttpMethodImpl(io.netty.handler.codec.http.HttpMethod.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an un-modifiable list of known HTTP methods
|
||||
*/
|
||||
static List<HttpMethod> values() {
|
||||
return HttpMethodImpl.ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,47 @@ package io.vertx.core.http.impl;
|
||||
|
||||
import io.vertx.core.http.HttpMethod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class HttpMethodImpl implements HttpMethod {
|
||||
|
||||
public static final List<HttpMethod> ALL = Collections.unmodifiableList(Arrays.asList(
|
||||
HttpMethod.OPTIONS,
|
||||
HttpMethod.GET,
|
||||
HttpMethod.HEAD,
|
||||
HttpMethod.POST,
|
||||
HttpMethod.PUT,
|
||||
HttpMethod.DELETE,
|
||||
HttpMethod.TRACE,
|
||||
HttpMethod.CONNECT,
|
||||
HttpMethod.PATCH,
|
||||
HttpMethod.PROPFIND,
|
||||
HttpMethod.PROPPATCH,
|
||||
HttpMethod.MKCOL,
|
||||
HttpMethod.COPY,
|
||||
HttpMethod.MOVE,
|
||||
HttpMethod.LOCK,
|
||||
HttpMethod.UNLOCK,
|
||||
HttpMethod.MKCALENDAR,
|
||||
HttpMethod.VERSION_CONTROL,
|
||||
HttpMethod.REPORT,
|
||||
HttpMethod.CHECKIN,
|
||||
HttpMethod.CHECKOUT,
|
||||
HttpMethod.UNCHECKOUT,
|
||||
HttpMethod.MKWORKSPACE,
|
||||
HttpMethod.UPDATE,
|
||||
HttpMethod.LABEL,
|
||||
HttpMethod.MERGE,
|
||||
HttpMethod.BASELINE_CONTROL,
|
||||
HttpMethod.MKACTIVITY,
|
||||
HttpMethod.ORDERPATCH,
|
||||
HttpMethod.ACL,
|
||||
HttpMethod.SEARCH
|
||||
));
|
||||
|
||||
public static io.netty.handler.codec.http.HttpMethod toNetty(HttpMethod method) {
|
||||
if (method instanceof HttpMethodImpl) {
|
||||
return ((HttpMethodImpl) method).nettyMethod;
|
||||
|
||||
Reference in New Issue
Block a user