public enum RequestMethod extends Enum<RequestMethod>
Enum Constant and Description |
---|
CONNECT
The HTTP CONNECT method method starts two-way communications with the requested resource.
|
DELETE
The HTTP DELETE request method deletes the specified resource.
|
GET
The HTTP GET method requests a representation of the specified resource.
|
HEAD
The HTTP HEAD method requests the headers that are returned if the specified resource would be requested with an HTTP GET method.
|
OPTIONS
The HTTP OPTIONS method is used to describe the communication options for the target resource.
|
PATCH
The HTTP PATCH request method applies partial modifications to a resource.
|
POST
The HTTP POST method sends data to the server.
|
PUT
The HTTP PUT request method creates a new resource or replaces a representation of the target resource with the request payload.
|
Modifier and Type | Method and Description |
---|---|
String |
toString() |
static RequestMethod |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static RequestMethod[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final RequestMethod CONNECT
For example, the CONNECT method can be used to access websites that use SSL (HTTPS). The client asks an HTTP Proxy server to tunnel the TCP connection to the desired destination. The server then proceeds to make the connection on behalf of the client. Once the connection has been established by the server, the Proxy server continues to proxy the TCP stream to and from the client.
learn more
public static final RequestMethod GET
public static final RequestMethod POST
The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), where successive identical POST may have additional effects, like passing an order several times.
A POST request is typically sent via an HTML form and results in a change on the server. In this case, the content type is selected by putting the adequate string in the enctype attribute of the <form> element or the formenctype attribute of the <input> or <button> elements:
When the POST request is sent via another method that an HTML form, like via an XMLHttpRequest, the body can take any type. As described in the HTTP 1.1 specification, POST is designed to allow a uniform method to cover the following functions:
public static final RequestMethod PUT
The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), where successive identical POST may have additional effects, like passing an order several times.
learn more
public static final RequestMethod PATCH
The HTTP PUT method is already defined to overwrite a resource with a complete new body, and for the POST method there is no standard way to discover patch format support. Unlike PUT, but like POST, PATCH is not idempotent, meaning successive identical patch requests will have different effects.
To find out whether a server supports PATCH, a server can advertise its support by adding it to the list in the Allow or Access-Control-Allow-Methods (for CORS) response headers.
Another (implicit) indication that PATCH is allowed, is the presence of the Accept-Patch header, which specifies the patch document formats accepted by the server.
learn more
public static final RequestMethod HEAD
A response to a HEAD method should not have a body. If so, it must be ignored. Even so, entity headers describing the content of the body, like Content-Length may be included in the response. They don't relate to the body of the HEAD response, which should be empty, but to the body of similar request using the GET method would have returned as a response.
If the result of a HEAD request shows that a cached resource after a GET request is now outdated, the cache is invalidated, even if no GET request has been made.
learn more
public static final RequestMethod OPTIONS
public static final RequestMethod DELETE
public static RequestMethod[] values()
for (RequestMethod c : RequestMethod.values()) System.out.println(c);
public static RequestMethod valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String toString()
toString
in class Enum<RequestMethod>
Copyright © 2017. All rights reserved.