Package org.apache.juneau.rest
Class RestOpSession
java.lang.Object
org.apache.juneau.ContextSession
org.apache.juneau.rest.RestOpSession
- Direct Known Subclasses:
RrpcRestOpSession
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:
-
Nested Class Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
RestOpSession
(RestOpSession.Builder builder) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic RestOpSession.Builder
create
(RestOpContext ctx, RestSession session) Static creator.finish()
Called at the end of a call to finish any remaining tasks such as flushing buffers and logging the response.Returns the bean store for this session.Returns the context that created this session.Returns the REST request object for this session.Returns the REST response object for this session.Returns the context of the parent class of this Java method.Returns the session of the parent class of this Java method.void
run()
Runs this session.status
(StatusLine value) Sets the status of the response.Methods inherited from class org.apache.juneau.ContextSession
addWarning, checkForWarnings, getSessionProperties, getWarnings, isDebug, properties, toString
-
Constructor Details
-
RestOpSession
Constructor.- Parameters:
builder
- The builder for this object.
-
-
Method Details
-
create
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 classContextSession
- Returns:
- The context that created this session.
-
run
Runs this session.Does the following:
- Runs the guards on the method.
- Finds the parameter values to pass to the Java method.
- Invokes the Java method.
- Sets the output and status on the response.
- 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.
-