com.linkedin.restli.common
Enum HttpMethod
java.lang.Object
java.lang.Enum<HttpMethod>
com.linkedin.restli.common.HttpMethod
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<HttpMethod>
public enum HttpMethod
- extends java.lang.Enum<HttpMethod>
|
Method Summary |
boolean |
isIdempotent()
Determine whether this HTTP method is idempotent, as defined in RFC 2616
9.1.2 Idempotent Methods
Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the
side-effects of N > 0 identical requests is the same as for a single request. |
boolean |
isSafe()
Determine whether this HTTP method is safe, as defined in RFC 2616
9.1.1 Safe Methods
Implementors should be aware that the software represents the user in their interactions over the Internet, and
should be careful to allow the user to be aware of any actions they might take which may have an unexpected
significance to themselves or others. |
static HttpMethod |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static HttpMethod[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared. |
| Methods inherited from class java.lang.Enum |
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
GET
public static final HttpMethod GET
PUT
public static final HttpMethod PUT
POST
public static final HttpMethod POST
DELETE
public static final HttpMethod DELETE
OPTIONS
public static final HttpMethod OPTIONS
HEAD
public static final HttpMethod HEAD
TRACE
public static final HttpMethod TRACE
values
public static HttpMethod[] values()
- Returns an array containing the constants of this enum type, in
the order they are declared. This method may be used to iterate
over the constants as follows:
for (HttpMethod c : HttpMethod.values())
System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in
the order they are declared
valueOf
public static HttpMethod valueOf(java.lang.String name)
- Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)
- Parameters:
name - the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException - if this enum type has no constant
with the specified name
java.lang.NullPointerException - if the argument is null
isSafe
public boolean isSafe()
- Determine whether this HTTP method is safe, as defined in RFC 2616
9.1.1 Safe Methods
Implementors should be aware that the software represents the user in their interactions over the Internet, and
should be careful to allow the user to be aware of any actions they might take which may have an unexpected
significance to themselves or others.
In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance
of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to
represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the
fact that a possibly unsafe action is being requested.
Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing
a GET request; in fact, some dynamic resources consider that a feature. The important distinction here is that
the user did not request the side-effects, so therefore cannot be held accountable for them.
- Returns:
- a boolean
isIdempotent
public boolean isIdempotent()
- Determine whether this HTTP method is idempotent, as defined in RFC 2616
9.1.2 Idempotent Methods
Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the
side-effects of N > 0 identical requests is the same as for a single request. The methods GET, HEAD, PUT and
DELETE share this property. Also, the methods OPTIONS and TRACE SHOULD NOT have side effects, and so are
inherently idempotent.
However, it is possible that a sequence of several requests is non- idempotent, even if all of the methods executed
in that sequence are idempotent. (A sequence is idempotent if a single execution of the entire sequence always
yields a result that is not changed by a reexecution of all, or part, of that sequence.) For example, a sequence is
non-idempotent if its result depends on a value that is later modified in the same sequence.
A sequence that never has side effects is idempotent, by definition (provided that no concurrent operations are
being executed on the same set of resources).
- Returns:
- a boolean