Class RestOperations

java.lang.Object
org.apache.juneau.rest.server.RestOperations
Direct Known Subclasses:
RestOperations.Void

public class RestOperations extends Object
Encapsulates the set of RestOp-annotated methods within a single Rest-annotated object.
  • Constructor Details

  • Method Details

    • create

      public static RestOperations.Builder create(BeanStore beanStore)
      Static creator.
      Parameters:
      beanStore - The bean store to use for creating beans.
      Returns:
      A new builder for this object.
    • findOperation

      Finds the method that should handle the specified call.
      Parameters:
      session - The HTTP call. Must not be null.
      Returns:
      The method that should handle the specified call.
      Throws:
      MethodNotAllowed - If no methods implement the requested HTTP method.
      PreconditionFailed - At least one method was found but it didn't match one or more matchers.
      NotFound - HTTP method match was found but matching path was not.
    • allowedMethods

      public String allowedMethods(RestSession session)
      Returns the value of the Allow header for a 405 Method Not Allowed response to the specified call.

      The methods this resource answers on the call's path: every key of the operation table, other than "*", with at least one operation whose path pattern matches, plus the request-line method when a "*" operation's path matches (the un-overridden request is always accepted there). The keys are what dispatch looks up, so a remote-proxy operation contributes GET and POST, never RRPC.

      Only path patterns are tested. Matchers are not run and the session's cached path match is not touched, so the call can be made for any request without disturbing the operation that handles it.

      Parameters:
      session - The HTTP call. Must not be null.
      Returns:
      The sorted, comma-separated method names. Empty when nothing answers on the path. Never null.
      Since:
      10.0.0
    • getOpContexts

      Returns the list of method contexts in this object.
      Returns:
      An unmodifiable list of method contexts in this object.