Interface Response.Builder

All Superinterfaces:
Buildable<Response>, Common<Response.Builder>
Enclosing interface:
Response

public static interface Response.Builder extends Common<Response.Builder>, Buildable<Response>
  • Method Details

    • setContentType

      Response.Builder setContentType(String contentType)
      Description copied from interface: Common
      Sets the IANA media type, for the current entity, if any. If the contentType argument also contains charset information, this method will have the side effect of parsing the charset out and storing the component parts independently. The method getContentCharset() can be used to retrieve extracted content charset, if present, and getHeader("Content-Type") can be used to retrieve the entire Content-Type header, complete with charset information, if set. The content type property is required when an entity is present.
      Specified by:
      setContentType in interface Common<Response.Builder>
      Parameters:
      contentType - An IANA media type with optional charset information
      Returns:
      This object, for builder-style chaining
    • setContentCharset

      Response.Builder setContentCharset(String contentCharset)
      Description copied from interface: Common
      Sets the charset for this object's entity, if any. This value is ignored during headeer access if no entity is present or if the content type property is not set.
      Specified by:
      setContentCharset in interface Common<Response.Builder>
      Parameters:
      contentCharset - The entity's charset value, or null
      Returns:
      This object, for builder-style chaining
    • setHeaders

      Response.Builder setHeaders(Map<String,String> headers)
      Description copied from interface: Common
      Copies the specified map of HTTP headers into this object. It will also parse any included Content-Type header into its constituent parts of IANA media type and content charset, updating those properties as appropriate.
      Specified by:
      setHeaders in interface Common<Response.Builder>
      Parameters:
      headers - A map of HTTP headers
      Returns:
      This object, for builder-style chaining
    • setHeader

      Response.Builder setHeader(String name, String value)
      Description copied from interface: Common
      Sets an HTTP header on this object. If the header's name is "Content-Type", the value will be parsed into this object's content type and content charset properties, as appropriate.
      Specified by:
      setHeader in interface Common<Response.Builder>
      Parameters:
      name - The name of the header to be set
      value - The value of the header to be set
      Returns:
      This object, for builder-style chaining
    • setEntity

      Response.Builder setEntity(String entity)
      Description copied from interface: Common
      Sets this object's entity stream from a string. Using this method of setting the entity automatically sets this object's content charset property to "UTF-8" if the entity is not null.
      Specified by:
      setEntity in interface Common<Response.Builder>
      Parameters:
      entity - An entity string
      Returns:
      This object, for builder-style chaining
    • setEntityStream

      Response.Builder setEntityStream(InputStream entityStream, String encoding)
      Description copied from interface: Common
      Sets this object's entity as an input stream, encoded with the specified charset. Invocations of this method reset this object's hasReadEntity() state to false. This method should only be called for entity streams targetting textual media types -- that is, it's nonsensical to set the charset of an entity stream for binary media types (e.g. image/*, etc).
      Specified by:
      setEntityStream in interface Common<Response.Builder>
      Parameters:
      entityStream - An entity input stream ready to be read
      encoding - The charset in which the entity stream is encoded
      Returns:
      This object, for builder-style chaining
    • setEntityStream

      Response.Builder setEntityStream(InputStream entityStream)
      Description copied from interface: Common
      Sets this object's entity as an input stream. Invocations of this method reset this object's hasReadEntity() state to false. It is recommended to also set this object's content charset property when setting an entity stream for a textual media type (or using the overloaded form that takes both the entity stream and charset in the same call). Clients of this object should assume the HTTP standard of ISO-8859-1 (latin-1) for the content charset property if a textual media type is set but no explcit charset was provided for this message. A charset should NOT be provided for entity streams targetting binary media types.
      Specified by:
      setEntityStream in interface Common<Response.Builder>
      Parameters:
      entityStream - An entity input stream ready to be read
      Returns:
      This object, for builder-style chaining
    • setStatusText

      Response.Builder setStatusText(String statusText)
      Sets the status text of the response.
      Parameters:
      statusText - The status text
      Returns:
      This object, for builder-style chaining
    • setStatusCode

      Response.Builder setStatusCode(int statusCode)
      Sets the status code of the response.
      Parameters:
      statusCode - The status code
      Returns:
      This object, for builder-stye chaining