Class RestOpSession

java.lang.Object
org.apache.juneau.ContextSession
org.apache.juneau.rest.RestOpSession
Direct Known Subclasses:
RrpcRestOpSession

public class RestOpSession extends ContextSession
A session for a single HTTP request.

This session object gets created by RestSession once the Java method to be invoked has been determined.

Notes:
  • This class is not thread safe.
See Also:
  • Constructor Details

  • Method Details

    • create

      public static RestOpSession.Builder create(RestOpContext ctx, RestSession session)
      Static creator.
      Parameters:
      ctx - The context object of the Java method being invoked.
      session - The REST session object creating this object.
      Returns:
      A new builder.
    • getContext

      Description copied from class: ContextSession
      Returns the context that created this session.
      Overrides:
      getContext in class ContextSession
      Returns:
      The context that created this session.
    • run

      public void run() throws Throwable
      Runs this session.

      Does the following:

      1. Runs the guards on the method.
      2. Finds the parameter values to pass to the Java method.
      3. Invokes the Java method.
      4. Sets the output and status on the response.
      5. Calls the converters on the Java method.
      Throws:
      Throwable - Any throwable can be thrown.
    • getRequest

      Returns the REST request object for this session.
      Returns:
      The REST request object for this session.
    • getResponse

      Returns the REST response object for this session.
      Returns:
      The REST response object for this session.
    • getBeanStore

      Returns the bean store for this session.
      Returns:
      The bean store for this session.
    • getRestContext

      Returns the context of the parent class of this Java method.
      Returns:
      The context of the parent class of this Java method.
    • getRestSession

      Returns the session of the parent class of this Java method.
      Returns:
      The session of the parent class of this Java method.
    • status

      Sets the status of the response.
      Parameters:
      value - The new status.
      Returns:
      This object.
    • finish

      Called at the end of a call to finish any remaining tasks such as flushing buffers and logging the response.
      Returns:
      This object.