Package org.apache.juneau.rest
Class RestSession
java.lang.Object
org.apache.juneau.ContextSession
org.apache.juneau.rest.RestSession
Represents a single HTTP request.
 
Notes:
- This class is not thread safe.
See Also:
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic RestSession.Buildercreate(RestContext ctx) Creates a builder of this object.debug(boolean value) Enables or disabled debug mode on this call.Identifies that an exception occurred during this call.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 of this call.Returns the context that created this call.Returns the exception that occurred during this call.Returns the HTTP method name.Returns the operation session of this REST session.Shortcut for callinggetRequest().getPathInfo() .Same asgetPathInfo()but doesn't decode encoded characters.Returns resolved@Resource (path)Returns the query parameters on the request.jakarta.servlet.http.HttpServletRequestReturns the HTTP servlet request of this REST call.Returns the REST object.jakarta.servlet.http.HttpServletResponseReturns the HTTP servlet response of this REST call.Shortcut for callinggetRequest().getServletPath() .intShortcut for callinggetRequest().getStatus() .Returns the request path info as aUrlPathbean.Returns the URL path pattern match on this call.logger(CallLogger value) Sets the logger to use when logging this call.voidrun()Runs this session.status(int value) Sets the HTTP status on this call.status(StatusLine value) Sets the HTTP status on this call.urlPathMatch(UrlPathMatch value) Sets the URL path pattern match on this call.Methods inherited from class org.apache.juneau.ContextSessionaddWarning, checkForWarnings, getSessionProperties, getWarnings, isDebug, properties, toString
- 
Constructor Details- 
RestSessionConstructor.- Parameters:
- builder- The builder for this object.
 
 
- 
- 
Method Details- 
createCreates a builder of this object.- Parameters:
- ctx- The context creating this builder.
- Returns:
- A new builder.
 
- 
loggerSets the logger to use when logging this call.- Parameters:
- value- The new value for this setting. Can be- null .
- Returns:
- This object.
 
- 
debugEnables or disabled debug mode on this call.- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
- Throws:
- IOException- Occurs if request content could not be cached into memory.
 
- 
statusSets the HTTP status on this call.- Parameters:
- value- The status code.
- Returns:
- This object.
 
- 
statusSets the HTTP status on this call.- Parameters:
- value- The status code.
- Returns:
- This object.
 
- 
exceptionIdentifies that an exception occurred during this call.- Parameters:
- value- The thrown exception.
- Returns:
- This object.
 
- 
urlPathMatchSets the URL path pattern match on this call.- Parameters:
- value- The match pattern.
- Returns:
- This object.
 
- 
getRequestReturns the HTTP servlet request of this REST call.- Returns:
- the HTTP servlet request of this REST call.
 
- 
getResponseReturns the HTTP servlet response of this REST call.- Returns:
- the HTTP servlet response of this REST call.
 
- 
getBeanStoreReturns the bean store of this call.- Returns:
- The bean store of this call.
 
- 
getPathVarsReturns resolved@Resource (path)- Returns:
- Resolved @Resource (path)
 
- 
getUrlPathMatchReturns the URL path pattern match on this call.- Returns:
- The URL path pattern match on this call.
 
- 
getExceptionReturns the exception that occurred during this call.- Returns:
- The exception that occurred during this call.
 
- 
finishCalled at the end of a call to finish any remaining tasks such as flushing buffers and logging the response.- Returns:
- This object.
 
- 
getServletPathShortcut for callinggetRequest().getServletPath() .- Returns:
- The request servlet path.
 
- 
getUrlPathReturns the request path info as aUrlPathbean.- Returns:
- The request path info as a UrlPathbean.
 
- 
getPathInfoShortcut for callinggetRequest().getPathInfo() .- Returns:
- The request servlet path info.
 
- 
getPathInfoUndecodedSame asgetPathInfo()but doesn't decode encoded characters.- Returns:
- The undecoded request servlet path info.
 
- 
getQueryParamsReturns the query parameters on the request.Unlike ServletRequest.getParameterMap(), this doesn't parse the content if it's a POST.- Returns:
- The query parameters on the request.
 
- 
getMethodReturns the HTTP method name.- Returns:
- The HTTP method name, always uppercased.
 
- 
getStatusShortcut for callinggetRequest().getStatus() .- Returns:
- The response status code.
 
- 
getContextReturns the context that created this call.- Overrides:
- getContextin class- ContextSession
- Returns:
- The context that created this call.
 
- 
getResourceReturns the REST object.- Returns:
- The rest object.
 
- 
getOpSessionReturns the operation session of this REST session.The operation session is created once the Java method to be invoked has been determined. - Returns:
- The operation session of this REST session.
- Throws:
- InternalServerError- If operation session has not been created yet.
 
- 
runRuns this session.Does the following: - Finds the Java method to invoke and creates a RestOpSessionfor it.
- Invokes RestPreCallmethods by callingRestContext.preCall(RestOpSession).
- Invokes Java method by calling RestOpSession.run().
- Invokes RestPostCallmethods by callingRestContext.postCall(RestOpSession).
- If the Java method produced output, finds the response processor for it and runs it by calling RestContext.processResponse(RestOpSession).
- If no Java method matched, generates a 404/405/412 by calling RestContext.handleNotFound(RestSession).
 - Throws:
- Throwable- Any throwable can be thrown.
 
- Finds the Java method to invoke and creates a 
 
-