java.lang.Object
io.helidon.http.Method
Interface representing an HTTP request method, all standard methods are in
Method
enumeration.
Although the constants are instances of this class, they can be compared using instance equality, as the only
way to obtain an instance is through method create(String)
, which ensures the same instance is returned for
known methods.
Methods that are not known (e.g. there is no constant for them) must be compared using equals(Object)
as usual.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Method
The HTTP CONNECT method starts two-way communications with the requested resource.static final Method
The DELETE method requests that the origin server delete the resource identified by the Request-URI.static final Method
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.static final Method
The HEAD method is identical toGET
except that the server MUST NOT return a message-body in the response.static final Method
The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI.static final Method
The PATCH method as described in RFC 5789 is used to perform an update to an existing resource, where the request payload only has to contain the instructions on how to perform the update.static final Method
The POST method is used to request that the origin server acceptedTypes the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.static final Method
The PUT method requests that the enclosed entity be stored under the supplied Request-URI.static final Method
The TRACE method is used to invoke a remote, application-layer loop- back of the request message. -
Method Summary
Modifier and TypeMethodDescriptionstatic Method
Create new HTTP request method instance from the provided name.boolean
int
hashCode()
int
length()
Number of characters.name()
Deprecated.static MethodPredicate
Create a predicate for the provided methods.static MethodPredicate
predicate
(Collection<Method> methods) Create a predicate for the provided methods.text()
Name of the method (such asGET
orPOST
).toString()
-
Field Details
-
GET
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the tryProcess. -
POST
The POST method is used to request that the origin server acceptedTypes the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI. The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it, a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database. -
PUT
The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem. The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases. -
DELETE
The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location. -
HEAD
The HEAD method is identical toGET
except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification. -
OPTIONS
The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. -
TRACE
The TRACE method is used to invoke a remote, application-layer loop- back of the request message. The final recipient of the request SHOULD reflect the message received back to the client as the entity-body of a 200 (OK) response. The final recipient is either the origin server or the first proxy or gateway to receive a Max-Forwards value of zero (0) in the request (see section 14.31). A TRACE request MUST NOT include an entity. -
PATCH
The PATCH method as described in RFC 5789 is used to perform an update to an existing resource, where the request payload only has to contain the instructions on how to perform the update. This is in contrast to PUT which requires that the payload contains the new version of the resource. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. -
CONNECT
The HTTP CONNECT method starts two-way communications with the requested resource. It can be used to open a tunnel.
-
-
Method Details
-
create
Create new HTTP request method instance from the provided name.In case the method name is recognized as one of the
standard HTTP methods
, the respective enumeration value is returned.- Parameters:
name
- the method name. Must not benull
or empty and must be a legal HTTP method name string.- Returns:
- HTTP request method instance representing an HTTP method with the provided name.
- Throws:
IllegalArgumentException
- In case of illegal method name or in case the name is empty ornull
.
-
predicate
Create a predicate for the provided methods.- Parameters:
methods
- methods to check against- Returns:
- a predicate that will validate the method is one of the methods provided; if methods are empty, the predicate
will always return
true
-
predicate
Create a predicate for the provided methods.- Parameters:
methods
- methods to check against- Returns:
- a predicate that will validate the method is one of the methods provided; if methods are empty, the predicate
will always return
true
-
name
Deprecated.usetext()
instead, this method conflicts with enumName of the method (such asGET
orPOST
).- Returns:
- a method name.
-
text
Name of the method (such asGET
orPOST
).- Returns:
- a method name.
-
length
public int length()Number of characters.- Returns:
- number of characters of this method
-
toString
-
equals
-
hashCode
public int hashCode()
-
text()
instead, this method conflicts with enum