Package org.keycloak.http
Interface HttpResponse
- 
- All Known Implementing Classes:
- HttpResponseImpl
 
 public interface HttpResponseRepresents an out coming HTTP response. Instances of this class can be obtained from KeycloakContext.getHttpResponse().
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddHeader(String name, String value)Add a value to the current list of values for the header with the givenname.voidsetCookieIfAbsent(HttpCookie cookie)Sets a new cookie only if not yet set.voidsetHeader(String name, String value)Set a header.voidsetStatus(int statusCode)Sets a status code.voidsetWriteCookiesOnTransactionComplete()Adding cookies at the end of the transaction helps when retrying a transaction might add the cookie multiple times.
 
- 
- 
- 
Method Detail- 
setStatusvoid setStatus(int statusCode) Sets a status code.- Parameters:
- statusCode- the status code
 
 - 
addHeadervoid addHeader(String name, String value) Add a value to the current list of values for the header with the givenname.- Parameters:
- name- the header name
- value- the header value
 
 - 
setHeadervoid setHeader(String name, String value) Set a header. Any existing values will be replaced.- Parameters:
- name- the header name
- value- the header value
 
 - 
setCookieIfAbsentvoid setCookieIfAbsent(HttpCookie cookie) Sets a new cookie only if not yet set.- Parameters:
- cookie- the cookie
 
 - 
setWriteCookiesOnTransactionCompletevoid setWriteCookiesOnTransactionComplete() 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.
 
- 
 
-