Package org.dmfs.httpessentials.methods
Class AbstractMethod
java.lang.Object
org.dmfs.httpessentials.methods.AbstractMethod
- All Implemented Interfaces:
HttpMethod
- Direct Known Subclasses:
IdempotentMethod,Method,SafeMethod
An abstract
HttpMethod. By default this method is not safe and not idempotent.-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractMethod(String verb, boolean supportsRequestPayload) Instantiates a newHttpMethodwith the given verb. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanfinal inthashCode()final booleanReturns whether thisHttpMethodallows to send a message body.final Stringverb()Returns the HTTP verb of this method.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dmfs.httpessentials.HttpMethod
isIdempotent, isSafe
-
Constructor Details
-
AbstractMethod
Instantiates a newHttpMethodwith the given verb.- Parameters:
verb- The method verb.supportsRequestPayload- whether this method support sending a request message body.
-
-
Method Details
-
verb
Description copied from interface:HttpMethodReturns the HTTP verb of this method.- Specified by:
verbin interfaceHttpMethod- Returns:
- A String containing the verb of the method.
-
supportsRequestPayload
public final boolean supportsRequestPayload()Description copied from interface:HttpMethodReturns whether thisHttpMethodallows to send a message body.Note that RFC 7231 does not explicitly forbid a message payload for some methods (in particular these are
HttpMethod.GET,HttpMethod.HEAD,HttpMethod.DELETEandHttpMethod.CONNECT). Instead is says something like this:A payload within a XXX request message has no defined semantics; sending a payload body on a XXX request might cause some existing implementations to reject the request.
The predefined methods in
HttpMethodinterpret this rather strict and returnfalsefor such methods.- Specified by:
supportsRequestPayloadin interfaceHttpMethod- Returns:
trueif this method supports a message body,falseotherwise.
-
hashCode
public final int hashCode() -
equals
-