Package org.keycloak.transaction
Class AsyncResponseTransaction
- java.lang.Object
- 
- org.keycloak.transaction.AsyncResponseTransaction
 
- 
- All Implemented Interfaces:
- KeycloakTransaction
 
 public class AsyncResponseTransaction extends Object implements KeycloakTransaction When usingAsyncResponse.resume(Object)directly in the code, the response is returned before all changes done withing this execution are committed. Therefore we need some mechanism that resumes the AsyncResponse after all changes are successfully committed. This can be achieved by enlisting an instance of AsyncResponseTransaction into the main transaction usingKeycloakTransactionManager.enlistAfterCompletion(KeycloakTransaction).
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()voidcommit()static voidfinishAsyncResponseInTransaction(KeycloakSession session, javax.ws.rs.container.AsyncResponse responseToFinishInTransaction, javax.ws.rs.core.Response responseToSend)This method creates a new AsyncResponseTransaction instance that resumes provided AsyncResponseresponseToFinishInTransactionwith given ResponseresponseToSend.booleangetRollbackOnly()booleanisActive()voidrollback()voidsetRollbackOnly()
 
- 
- 
- 
Method Detail- 
finishAsyncResponseInTransactionpublic static void finishAsyncResponseInTransaction(KeycloakSession session, javax.ws.rs.container.AsyncResponse responseToFinishInTransaction, javax.ws.rs.core.Response responseToSend) This method creates a new AsyncResponseTransaction instance that resumes provided AsyncResponseresponseToFinishInTransactionwith given ResponseresponseToSend. The transaction is enlisted toKeycloakTransactionManager.- Parameters:
- session- Current KeycloakSession
- responseToFinishInTransaction- AsyncResponse to be resumed on- KeycloakTransactionManagercommit/rollback.
- responseToSend- Response to be sent
 
 - 
beginpublic void begin() - Specified by:
- beginin interface- KeycloakTransaction
 
 - 
commitpublic void commit() - Specified by:
- commitin interface- KeycloakTransaction
 
 - 
rollbackpublic void rollback() - Specified by:
- rollbackin interface- KeycloakTransaction
 
 - 
setRollbackOnlypublic void setRollbackOnly() - Specified by:
- setRollbackOnlyin interface- KeycloakTransaction
 
 - 
getRollbackOnlypublic boolean getRollbackOnly() - Specified by:
- getRollbackOnlyin interface- KeycloakTransaction
 
 - 
isActivepublic boolean isActive() - Specified by:
- isActivein interface- KeycloakTransaction
 
 
- 
 
-