Interface Response


public interface Response
A HTTP Response from the perspective of the server (as opposed to a HTTP client).
Since:
2.1.0
  • Method Details

    • setResponseModel

      void setResponseModel(ResponseModel responseModel, Response.ResponseModelScope scope)
      Set the response model to be associated with a given Response.ResponseModelScope.
      Parameters:
      responseModel - response model
      scope - 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 model
      httpStatus - status code for which this response model data applies
      otherHttpStatus - other status codes for which this response model data applies
      See Also:
    • putViewData

      void putViewData(String key, Object value, HttpStatus httpStatus)
      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 key
      value - value
      httpStatus - status code for which this response model data applies
    • putViewData

      void putViewData(String key, @Nullable Object value, Response.ResponseModelScope scope)
      Put a key-value pair on the response model for a specific Response.ResponseModelScope.

      This method allows a response model to be built from separate key-value pairs.

      Parameters:
      key - view data key
      value - value
      scope - scope for which this response model data applies
    • setHttpStatus

      void setHttpStatus(HttpStatus httpStatus)
      Set the HTTP status to be used to respond to a HTTP Request.
      Parameters:
      httpStatus - status code
    • getHeaders

      HttpHeaders.Builder getHeaders()
      Returns a HttpHeaders.Builder for adding HTTP headers to this Request.
      Returns:
      a builder for adding HTTP headers
    • cookies

      ResponseCookies cookies()
      Returns:
      the cookies builder.
    • addInfoMessage

      void addInfoMessage(InfoMessage infoMessage)
      Add an "info" message to the response view data.

      The Set of "info" messages can be accessed by templates with the _infoMessages variable.

      Parameters:
      infoMessage - info message
    • addWarningMessage

      void addWarningMessage(WarningMessage warningMessage)
      Add a "warning" message to the response view data.

      The Set of "warning" messages can be accessed by templates with the _warnings variable.

      Parameters:
      warningMessage - warning message
    • addErrorMessage

      void addErrorMessage(ErrorMessage errorMessage)
      Add a "error" message to the response view data.

      The Set of "error" messages can be accessed by templates with the _errors variable.

      Parameters:
      errorMessage - error message
    • addInfoMessages

      void addInfoMessages(Set<InfoMessage> infoMessages)
      Add a Set of "info" messages to the response view data.

      The Set of "info" messages can be accessed by templates with the _infoMessages variable.

      Parameters:
      infoMessages - info messages
    • addWarningMessages

      void addWarningMessages(Set<WarningMessage> warningMessages)
      Add a Set of "warning" messages to the response view data.

      The Set of "warning" messages can be accessed by templates with the _warnings variable.

      Parameters:
      warningMessages - warning messages
    • addErrorMessages

      void addErrorMessages(Set<ErrorMessage> errorMessages)
      Add a Set of "error" messages to the response view data.

      The Set of "error" messages can be accessed by templates with the _errors variable.

      Parameters:
      errorMessages - error messages