Package org.takes.rs

Class RsWithType

  • All Implemented Interfaces:
    Body, Head, Response

    public final class RsWithType
    extends RsWrap
    Response decorator, with content type.

    The class is immutable and thread-safe.

    Since:
    0.1
    • Constructor Detail

      • RsWithType

        public RsWithType​(Response res,
                          CharSequence type)
        Constructs a RsWithType that will add the content type header to the response using the specified type as media type.

        The resulting header is of type Content-Type: media-type.

        Parameters:
        res - Original response
        type - Content type
      • RsWithType

        public RsWithType​(Response res,
                          CharSequence type,
                          Charset charset)
        Constructs a RsWithType that will add the content type header to the response using the specified type as media type and the specified charset as charset parameter value.

        The resulting header is of type Content-Type: media-type; charset=charset-value.

        Parameters:
        res - Original response
        type - Content type
        charset - The character set to add in the content type header