Package org.keycloak.services
Class HttpResponseImpl
java.lang.Object
org.keycloak.services.HttpResponseImpl
- All Implemented Interfaces:
HttpResponse
,KeycloakTransaction
-
Constructor Summary
ConstructorDescriptionHttpResponseImpl
(KeycloakSession session, org.jboss.resteasy.spi.HttpResponse delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a value to the current list of values for the header with the givenname
.void
begin()
void
commit()
boolean
boolean
isActive()
void
rollback()
void
setCookieIfAbsent
(HttpCookie cookie) Sets a new cookie only if not yet set.void
Set a header.void
void
setStatus
(int statusCode) Sets a status code.void
Adding cookies at the end of the transaction helps when retrying a transaction might add the cookie multiple times.
-
Constructor Details
-
HttpResponseImpl
-
-
Method Details
-
setStatus
public void setStatus(int statusCode) Description copied from interface:HttpResponse
Sets a status code.- Specified by:
setStatus
in interfaceHttpResponse
- Parameters:
statusCode
- the status code
-
addHeader
Description copied from interface:HttpResponse
Add a value to the current list of values for the header with the givenname
.- Specified by:
addHeader
in interfaceHttpResponse
- Parameters:
name
- the header namevalue
- the header value
-
setHeader
Description copied from interface:HttpResponse
Set a header. Any existing values will be replaced.- Specified by:
setHeader
in interfaceHttpResponse
- Parameters:
name
- the header namevalue
- the header value
-
setCookieIfAbsent
Description copied from interface:HttpResponse
Sets a new cookie only if not yet set.- Specified by:
setCookieIfAbsent
in interfaceHttpResponse
- Parameters:
cookie
- the cookie
-
setWriteCookiesOnTransactionComplete
public void setWriteCookiesOnTransactionComplete()Description copied from interface:HttpResponse
Adding cookies at the end of the transaction helps when retrying a transaction might add the cookie multiple times. In some scenarios it must not be added at the end of the transaction, as at that time the response has already been sent to the caller ("committed"), so the code needs to make a choice. As retrying transactions is the exception, adding cookies at the end of the transaction is also the exception and needs to be switched on where necessary.- Specified by:
setWriteCookiesOnTransactionComplete
in interfaceHttpResponse
-
begin
public void begin()- Specified by:
begin
in interfaceKeycloakTransaction
-
commit
public void commit()- Specified by:
commit
in interfaceKeycloakTransaction
-
rollback
public void rollback()- Specified by:
rollback
in interfaceKeycloakTransaction
-
setRollbackOnly
public void setRollbackOnly()- Specified by:
setRollbackOnly
in interfaceKeycloakTransaction
-
getRollbackOnly
public boolean getRollbackOnly()- Specified by:
getRollbackOnly
in interfaceKeycloakTransaction
-
isActive
public boolean isActive()- Specified by:
isActive
in interfaceKeycloakTransaction
-