Top Description Fields Constructors Methods
org.springframework.web.bind.annotation

public final Enum RequestMethod

extends Enum<RequestMethod>
Class Inheritance
Imports
org.springframework.http.HttpMethod, org.springframework.lang.Nullable, org.springframework.util.Assert

Enumeration of HTTP request methods. Intended for use with the RequestMapping#method() attribute of the RequestMapping annotation.

Note that, by default, org.springframework.web.servlet.DispatcherServlet supports GET, HEAD, POST, PUT, PATCH, and DELETE only. DispatcherServlet will process TRACE and OPTIONS with the default HttpServlet behavior unless explicitly told to dispatch those request types as well: Check out the "dispatchOptionsRequest" and "dispatchTraceRequest" properties, switching them to "true" if necessary.

Author
Juergen Hoeller
Since
2.5
See Also
RequestMapping, org.springframework.web.servlet.DispatcherServlet#setDispatchOptionsRequest, org.springframework.web.servlet.DispatcherServlet#setDispatchTraceRequest

Field Summary

Modifier and TypeField and Description
public static final RequestMethod
public static final RequestMethod
public static final RequestMethod
public static final RequestMethod
public static final RequestMethod
public static final RequestMethod
public static final RequestMethod
public static final RequestMethod

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public HttpMethod

Returns:

the http method for this request method
asHttpMethod
()

Return the HttpMethod corresponding to this RequestMethod.

public static RequestMethod

Returns:

the corresponding RequestMethod, or null if not found
resolve
(String
the method value as a String
method
)

Resolve the given method value to an RequestMethod enum value.

public static RequestMethod

Returns:

the corresponding RequestMethod, or null if not found
resolve
(HttpMethod
the http method object
httpMethod
)

Resolve the given HttpMethod to a RequestMethod enum value.

public static RequestMethod
public static RequestMethod[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DELETEback to summary
public static final RequestMethod DELETE
GETback to summary
public static final RequestMethod GET
OPTIONSback to summary
public static final RequestMethod OPTIONS
PATCHback to summary
public static final RequestMethod PATCH
POSTback to summary
public static final RequestMethod POST
PUTback to summary
public static final RequestMethod PUT
TRACEback to summary
public static final RequestMethod TRACE

Constructor Detail

RequestMethodback to summary
private RequestMethod()

Method Detail

asHttpMethodback to summary
public HttpMethod asHttpMethod()

Return the HttpMethod corresponding to this RequestMethod.

Returns:HttpMethod

the http method for this request method

Since
6.0.6
resolveback to summary
public static RequestMethod resolve(String method)

Resolve the given method value to an RequestMethod enum value. Returns null if method has no corresponding value.

Parameters
method:String

the method value as a String

Returns:RequestMethod

the corresponding RequestMethod, or null if not found

Annotations
@Nullable
Since
6.0.6
resolveback to summary
public static RequestMethod resolve(HttpMethod httpMethod)

Resolve the given HttpMethod to a RequestMethod enum value. Returns null if httpMethod has no corresponding value.

Parameters
httpMethod:HttpMethod

the http method object

Returns:RequestMethod

the corresponding RequestMethod, or null if not found

Annotations
@Nullable
Since
6.0.6
valueOfback to summary
public static RequestMethod valueOf(String name)
valuesback to summary
public static RequestMethod[] values()