Interface Response
- Since:
- 2.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe scope of a response model. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrorMessage(ErrorMessage errorMessage) Add a "error" message to the response view data.voidaddErrorMessages(Set<ErrorMessage> errorMessages) Add a Set of "error" messages to the response view data.voidaddInfoMessage(InfoMessage infoMessage) Add an "info" message to the response view data.voidaddInfoMessages(Set<InfoMessage> infoMessages) Add a Set of "info" messages to the response view data.voidaddWarningMessage(WarningMessage warningMessage) Add a "warning" message to the response view data.voidaddWarningMessages(Set<WarningMessage> warningMessages) Add a Set of "warning" messages to the response view data.cookies()Returns aHttpHeaders.Builderfor adding HTTP headers to this Request.voidputViewData(String key, @Nullable Object value, Response.ResponseModelScope scope) Put a key-value pair on the response model for a specificResponse.ResponseModelScope.voidputViewData(String key, Object value, HttpStatus httpStatus) Put a key-value pair on the response model for a particular status code.voidsetHttpStatus(HttpStatus httpStatus) Set the HTTP status to be used to respond to a HTTP Request.voidsetResponseModel(ResponseModel responseModel, HttpStatus httpStatus, HttpStatus... otherHttpStatus) Set the response model to associate with one or more HTTP status codes in one operation.voidsetResponseModel(ResponseModel responseModel, Response.ResponseModelScope scope) Set the response model to be associated with a givenResponse.ResponseModelScope.
-
Method Details
-
setResponseModel
Set the response model to be associated with a givenResponse.ResponseModelScope.- Parameters:
responseModel- response modelscope- scope for which this response model data applies- See Also:
-
setResponseModel
void setResponseModel(ResponseModel responseModel, HttpStatus httpStatus, HttpStatus... otherHttpStatus) Set the response model to associate with one or more HTTP status codes in one operation.Typically, this method is used to specify a particular response model for a success and one or more failure status codes which share the same model.
- Parameters:
responseModel- response modelhttpStatus- status code for which this response model data appliesotherHttpStatus- other status codes for which this response model data applies- See Also:
-
putViewData
Put a key-value pair on the response model for a particular status code.This method allows a response model to be built from separate key-value pairs.
- Parameters:
key- view data keyvalue- valuehttpStatus- status code for which this response model data applies
-
putViewData
Put a key-value pair on the response model for a specificResponse.ResponseModelScope.This method allows a response model to be built from separate key-value pairs.
- Parameters:
key- view data keyvalue- valuescope- scope for which this response model data applies
-
setHttpStatus
Set the HTTP status to be used to respond to a HTTP Request.- Parameters:
httpStatus- status code
-
getHeaders
HttpHeaders.Builder getHeaders()Returns aHttpHeaders.Builderfor adding HTTP headers to this Request.- Returns:
- a builder for adding HTTP headers
-
cookies
ResponseCookies cookies()- Returns:
- the cookies builder.
-
addInfoMessage
Add an "info" message to the response view data.The Set of "info" messages can be accessed by templates with the
_infoMessagesvariable.- Parameters:
infoMessage- info message
-
addWarningMessage
Add a "warning" message to the response view data.The Set of "warning" messages can be accessed by templates with the
_warningsvariable.- Parameters:
warningMessage- warning message
-
addErrorMessage
Add a "error" message to the response view data.The Set of "error" messages can be accessed by templates with the
_errorsvariable.- Parameters:
errorMessage- error message
-
addInfoMessages
Add a Set of "info" messages to the response view data.The Set of "info" messages can be accessed by templates with the
_infoMessagesvariable.- Parameters:
infoMessages- info messages
-
addWarningMessages
Add a Set of "warning" messages to the response view data.The Set of "warning" messages can be accessed by templates with the
_warningsvariable.- Parameters:
warningMessages- warning messages
-
addErrorMessages
Add a Set of "error" messages to the response view data.The Set of "error" messages can be accessed by templates with the
_errorsvariable.- Parameters:
errorMessages- error messages
-