Class ResponseSessionTask

java.lang.Object
org.keycloak.common.util.ResponseSessionTask
All Implemented Interfaces:
KeycloakSessionTaskWithResult<jakarta.ws.rs.core.Response>

public abstract class ResponseSessionTask extends Object implements KeycloakSessionTaskWithResult<jakarta.ws.rs.core.Response>
A KeycloakSessionTaskWithResult that is aimed to be used by endpoints that want to produce a Response in 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 WebApplicationException when it is thrown by the task.
  • Author:
    Stefan Guilhen
    • Constructor Details

      • ResponseSessionTask

        public ResponseSessionTask(KeycloakSession originalSession)
        Constructs a new instance of this task.
        Parameters:
        originalSession - the original KeycloakSession that was active when the task was created.
    • Method Details