Class Method

java.lang.Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final Method
    Pseudo-method use to match all methods.
    static final Method
    Used with a proxy that can dynamically switch to being a tunnel.
    static final Method
    Requests that the origin server deletes the resource identified by the request URI.
    static final Method
    Retrieves whatever information (in the form of an entity) that is identified by the request URI.
    static final Method
    Identical to GET except that the server must not return a message body in the response but only the message header.
    static final Method
    Requests for information about the communication options available on the request/response chain identified by the URI.
    static final Method
    Requests that the origin server applies partial modifications contained in the entity enclosed in the request to the resource identified by the request URI.
    static final Method
    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 final Method
    Requests that the enclosed entity be stored under the supplied request URI.
    static final Method
    Used to invoke a remote, application-layer loop-back of the request message.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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

    Modifier and Type
    Method
    Description
    int
    Compares this method to another.
    boolean
    equals(Object object)
    Returns the description.
    Returns the name.
    Returns the URI of the specification describing the method.
    int
    boolean
    Indicates if the side-effects of several requests is the same as a single request.
    boolean
    Indicates if the method replies with a response.
    boolean
    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.
    static void
    sort(List<Method> methods)
    Sorts the given list of methods by name.
    Returns the name.
    static Method
    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 Details

    • 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:
    • DELETE

      public static final Method DELETE
      Requests that the origin server deletes the resource identified by the request URI.
      See Also:
    • GET

      public static final Method GET
      Retrieves whatever information (in the form of an entity) that is identified by the request URI.
      See Also:
    • 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:
    • PATCH

      public static final Method PATCH
      Requests that the origin server applies partial modifications contained in the entity enclosed in the request to the resource identified by the request URI.
      See Also:
    • 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:
    • PUT

      public static final Method PUT
      Requests that the enclosed entity be stored under the supplied request URI.
      See Also:
      • invalid input: '<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6" HTTP RFC - 9.6 PUT</a>'
    • TRACE

      public static final Method TRACE
      Used to invoke a remote, application-layer loop-back of the request message.
      See Also:
  • Constructor Details

    • Method

      public Method(String name)
      Constructor for unsafe and non idempotent methods.
      Parameters:
      name - The technical name of the method.
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
  • Method Details

    • 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.
    • toString

      public String toString()
      Returns the name.
      Overrides:
      toString in class Object
      Returns:
      The name.