org.restlet.data
Class Method

java.lang.Object
  extended by org.restlet.data.Method
All Implemented Interfaces:
Comparable<Method>

public final class Method
extends Object
implements Comparable<Method>

Method to execute when handling a call.

Author:
Jerome Louvel

Field Summary
static Method ALL
          Pseudo-method use to match all methods.
static Method CONNECT
          Used with a proxy that can dynamically switch to being a tunnel.
static Method COPY
          Creates a duplicate of the source resource, identified by the Request-URI, in the destination resource, identified by the URI in the Destination header.
static Method DELETE
          Requests that the origin server deletes the resource identified by the request URI.
static Method GET
          Retrieves whatever information (in the form of an entity) that is identified by the request URI.
static Method HEAD
          Identical to GET except that the server must not return a message body in the response but only the message header.
static Method LOCK
          Used to take out a lock of any access type on the resource identified by the request URI.
static Method MKCOL
          MKCOL creates a new collection resource at the location specified by the Request URI.
static Method MOVE
          Logical equivalent of a copy, followed by consistency maintenance processing, followed by a delete of the source where all three actions are performed atomically.
static Method OPTIONS
          Requests for information about the communication options available on the request/response chain identified by the URI.
static Method POST
          Requests that the origin server accepts the entity enclosed in the request as a new subordinate of the resource identified by the request URI.
static Method PROPFIND
          Retrieves properties defined on the resource identified by the request URI.
static Method PROPPATCH
          Processes instructions specified in the request body to set and/or remove properties defined on the resource identified by the request URI.
static Method PUT
          Requests that the enclosed entity be stored under the supplied request URI.
static Method TRACE
          Used to invoke a remote, application-layer loop-back of the request message.
static Method UNLOCK
          Removes the lock identified by the lock token from the request URI, and all other resources included in the lock.
 
Constructor Summary
Method(String name)
          Constructor for unsafe and non idempotent methods.
Method(String name, String description)
          Constructor for unsafe and non idempotent methods.
Method(String name, String description, String uri)
          Constructor for unsafe and non idempotent methods.
Method(String name, String description, String uri, boolean safe, boolean idempotent)
          Constructor for methods that reply to requests with responses.
Method(String name, String description, String uri, boolean safe, boolean idempotent, boolean replying)
          Constructor.
 
Method Summary
 int compareTo(Method o)
          Compares this method to another.
 boolean equals(Object object)
          
 String getDescription()
          Returns the description.
 String getName()
          Returns the name.
 String getUri()
          Returns the URI of the specification describing the method.
 int hashCode()
          
 boolean isIdempotent()
          Indicates if the side-effects of several requests is the same as a single request.
 boolean isReplying()
          Indicates if the method replies with a response.
 boolean isSafe()
          Indicates if it should have the significance of taking an action other than retrieval.
static void register(Method method)
          Adds a new Method to the list of registered methods.
 void setUri(String uri)
          Deprecated. Method instances are shared by all Restlet applications and shouldn't be modifiable.
static void sort(List<Method> methods)
          Sorts the given list of methods by name.
 String toString()
          Returns the name.
static Method valueOf(String name)
          Returns the method associated to a given method name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL

public static final Method ALL
Pseudo-method use to match all methods.


CONNECT

public static final Method CONNECT
Used with a proxy that can dynamically switch to being a tunnel.

See Also:
HTTP RFC - 9.9 CONNECT

COPY

public static final Method COPY
Creates a duplicate of the source resource, identified by the Request-URI, in the destination resource, identified by the URI in the Destination header.

See Also:
WEBDAV RFC - 8.8 COPY Method

DELETE

public static final Method DELETE
Requests that the origin server deletes the resource identified by the request URI.

See Also:
HTTP RFC - 9.7 DELETE

GET

public static final Method GET
Retrieves whatever information (in the form of an entity) that is identified by the request URI.

See Also:
HTTP RFC - 9.3 GET

HEAD

public static final Method HEAD
Identical to GET except that the server must not return a message body in the response but only the message header.

See Also:
HTTP RFC - 9.4 HEAD

LOCK

public static final Method LOCK
Used to take out a lock of any access type on the resource identified by the request URI.

See Also:
WEBDAV RFC - 8.10 LOCK Method

MKCOL

public static final Method MKCOL
MKCOL creates a new collection resource at the location specified by the Request URI.

See Also:
WEBDAV RFC - 8.3 MKCOL Method

MOVE

public static final Method MOVE
Logical equivalent of a copy, followed by consistency maintenance processing, followed by a delete of the source where all three actions are performed atomically.

See Also:
WEBDAV RFC - 8.3 MKCOL Method

OPTIONS

public static final Method OPTIONS
Requests for information about the communication options available on the request/response chain identified by the URI.

See Also:
HTTP RFC - 9.2 OPTIONS

POST

public static final Method POST
Requests that the origin server accepts the entity enclosed in the request as a new subordinate of the resource identified by the request URI.

See Also:
HTTP RFC - 9.5 POST

PROPFIND

public static final Method PROPFIND
Retrieves properties defined on the resource identified by the request URI.

See Also:
WEBDAV RFC - 8.1 PROPFIND

PROPPATCH

public static final Method PROPPATCH
Processes instructions specified in the request body to set and/or remove properties defined on the resource identified by the request URI.

See Also:
WEBDAV RFC - 8.2 PROPPATCH

PUT

public static final Method PUT
Requests that the enclosed entity be stored under the supplied request URI.

See Also:

TRACE

public static final Method TRACE
Used to invoke a remote, application-layer loop-back of the request message.

See Also:
HTTP RFC - 9.8 TRACE

UNLOCK

public static final Method UNLOCK
Removes the lock identified by the lock token from the request URI, and all other resources included in the lock.

See Also:
WEBDAV RFC - 8.11 UNLOCK Method
Constructor Detail

Method

public Method(String name)
Constructor for unsafe and non idempotent methods.

Parameters:
name - The technical name of the method.
See Also:
valueOf(String)

Method

public Method(String name,
              String description)
Constructor for unsafe and non idempotent methods.

Parameters:
name - The technical name of the method.
description - The description.
See Also:
valueOf(String)

Method

public Method(String name,
              String description,
              String uri)
Constructor for unsafe and non idempotent methods.

Parameters:
name - The technical name.
description - The description.
uri - The URI of the specification describing the method.
See Also:
valueOf(String)

Method

public Method(String name,
              String description,
              String uri,
              boolean safe,
              boolean idempotent)
Constructor for methods that reply to requests with responses.

Parameters:
name - The technical name.
description - The description.
uri - The URI of the specification describing the method.
safe - Indicates if the method is safe.
idempotent - Indicates if the method is idempotent.
See Also:
valueOf(String)

Method

public Method(String name,
              String description,
              String uri,
              boolean safe,
              boolean idempotent,
              boolean replying)
Constructor.

Parameters:
name - The technical name.
description - The description.
uri - The URI of the specification describing the method.
safe - Indicates if the method is safe.
idempotent - Indicates if the method is idempotent.
replying - Indicates if the method replies with a response.
See Also:
valueOf(String)
Method Detail

register

public static void register(Method method)
Adds a new Method to the list of registered methods.

Parameters:
method - The method to register.

sort

public static void sort(List<Method> methods)
Sorts the given list of methods by name.

Parameters:
methods - The methods to sort.

valueOf

public static Method valueOf(String name)
Returns the method associated to a given method name. If an existing constant exists then it is returned, otherwise a new instance is created.

Parameters:
name - The method name.
Returns:
The associated method.

compareTo

public int compareTo(Method o)
Compares this method to another. Based on the method name.

Specified by:
compareTo in interface Comparable<Method>
Parameters:
o - The other method.

equals

public boolean equals(Object object)

Overrides:
equals in class Object

getDescription

public String getDescription()
Returns the description.

Returns:
The description.

getName

public String getName()
Returns the name.

Returns:
The name.

getUri

public String getUri()
Returns the URI of the specification describing the method.

Returns:
The URI of the specification describing the method.

hashCode

public int hashCode()

Overrides:
hashCode in class Object

isIdempotent

public boolean isIdempotent()
Indicates if the side-effects of several requests is the same as a single request.

Returns:
True if the method is idempotent.

isReplying

public boolean isReplying()
Indicates if the method replies with a response.

Returns:
True if the method replies with a response.

isSafe

public boolean isSafe()
Indicates if it should have the significance of taking an action other than retrieval.

Returns:
True if the method is safe.

setUri

@Deprecated
public void setUri(String uri)
Deprecated. Method instances are shared by all Restlet applications and shouldn't be modifiable.

Sets the URI of the specification describing the method.

Parameters:
uri - The URI of the specification describing the method.

toString

public String toString()
Returns the name.

Overrides:
toString in class Object
Returns:
The name.


Copyright © 2005-2013 Restlet S.A.S..