Package org.keycloak.common.util
Class ResponseSessionTask
- java.lang.Object
- 
- org.keycloak.common.util.ResponseSessionTask
 
- 
- All Implemented Interfaces:
- KeycloakSessionTaskWithResult<javax.ws.rs.core.Response>
 
 public abstract class ResponseSessionTask extends Object implements KeycloakSessionTaskWithResult<javax.ws.rs.core.Response> AKeycloakSessionTaskWithResultthat is aimed to be used by endpoints that want to produce aResponsein a retriable transaction. It takes care of the boilerplate code that is common to be seen in this scenario, allowing the endpoint to focus on the actual code that has to be executed in a retriable manner. More specifically, this task:- pushes the task's session into the resteasy context, restoring the original value after the task is over. This allows
     for endpoints to create new instances of themselves and inject the resteasy properties correctly;
 - sets up the task's session context, based on model values found in the original session's context;
 - handles 
 WebApplicationExceptionwhen it is thrown by the task.- Author:
- Stefan Guilhen
 
- 
- 
Constructor SummaryConstructors Constructor Description ResponseSessionTask(KeycloakSession originalSession)Constructs a new instance of this task.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Responserun(KeycloakSession session)Computes a result.abstract javax.ws.rs.core.ResponserunInternal(KeycloakSession session)Builds the response that is to be returned.
 
- 
- 
- 
Constructor Detail- 
ResponseSessionTaskpublic ResponseSessionTask(KeycloakSession originalSession) Constructs a new instance of this task.- Parameters:
- originalSession- the original- KeycloakSessionthat was active when the task was created.
 
 
- 
 - 
Method Detail- 
runpublic javax.ws.rs.core.Response run(KeycloakSession session) Description copied from interface:KeycloakSessionTaskWithResultComputes a result.- Specified by:
- runin interface- KeycloakSessionTaskWithResult<javax.ws.rs.core.Response>
- Parameters:
- session- a reference to the- KeycloakSession.
- Returns:
- the computed result.
 
 - 
runInternalpublic abstract javax.ws.rs.core.Response runInternal(KeycloakSession session) Builds the response that is to be returned.- Parameters:
- session- a reference the- KeycloakSession.
- Returns:
- the constructed Response.
 
 
- 
 
-