Any method to get constant for HTTP GET, POST, PUT, DELETE? [duplicate]

If you are using Spring, you have this enum org.springframework.web.bind.annotation.RequestMethod

public enum RequestMethod {
  GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
}

EDIT : Here is the complete list of constants values in Java 6 You can see that some of those are available in the class HttpMethod but it contains less values than RequestMethod.

public @interface HttpMethod {
  java.lang.String GET = "GET";
  java.lang.String POST = "POST";
  java.lang.String PUT = "PUT";
  java.lang.String DELETE = "DELETE";
  java.lang.String HEAD = "HEAD";
  java.lang.String OPTIONS = "OPTIONS";

  java.lang.String value();
}

Leave a Comment