Package org.springframework.http
Class HttpMethod
java.lang.Object
org.springframework.http.HttpMethod
- All Implemented Interfaces:
Serializable
,Comparable<HttpMethod>
Represents an HTTP request method. Intended for use
with
ClientHttpRequest
and RestTemplate
.- Since:
- 3.0
- Author:
- Arjen Poutsma, Juergen Hoeller
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HttpMethod
The HTTP methodDELETE
.static final HttpMethod
The HTTP methodGET
.static final HttpMethod
The HTTP methodHEAD
.static final HttpMethod
The HTTP methodOPTIONS
.static final HttpMethod
The HTTP methodPATCH
.static final HttpMethod
The HTTP methodPOST
.static final HttpMethod
The HTTP methodPUT
.static final HttpMethod
The HTTP methodTRACE
. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(HttpMethod other) boolean
int
hashCode()
boolean
Determine whether thisHttpMethod
matches the given method value.name()
Return the name of this method, e.g.static HttpMethod
Deprecated, for removal: This API element is subject to removal in a future version.toString()
static HttpMethod
Return anHttpMethod
object for the given value.static HttpMethod[]
values()
Returns an array containing the standard HTTP methods.
-
Field Details
-
GET
The HTTP methodGET
.- See Also:
-
HEAD
The HTTP methodHEAD
.- See Also:
-
POST
The HTTP methodPOST
.- See Also:
-
PUT
The HTTP methodPUT
.- See Also:
-
PATCH
The HTTP methodPATCH
.- See Also:
-
DELETE
The HTTP methodDELETE
.- See Also:
-
OPTIONS
The HTTP methodOPTIONS
.- See Also:
-
TRACE
The HTTP methodTRACE
.- See Also:
-
-
Method Details
-
values
-
valueOf
Return anHttpMethod
object for the given value.- Parameters:
method
- the method value as a String- Returns:
- the corresponding
HttpMethod
-
resolve
@Nullable @Deprecated(since="6.0", forRemoval=true) public static HttpMethod resolve(@Nullable String method) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofvalueOf(String)
Resolve the given method value to anHttpMethod
.- Parameters:
method
- the method value as a String- Returns:
- the corresponding
HttpMethod
, ornull
if not found - Since:
- 4.2.4
-
name
Return the name of this method, e.g. "GET", "POST". -
matches
Determine whether thisHttpMethod
matches the given method value.- Parameters:
method
- the HTTP method as a String- Returns:
true
if it matches,false
otherwise- Since:
- 4.2.4
-
compareTo
- Specified by:
compareTo
in interfaceComparable<HttpMethod>
-
hashCode
public int hashCode() -
equals
-
toString
-
valueOf(String)