Class ServiceResponse

    • Constructor Detail

      • ServiceResponse

        public ServiceResponse​(ByteArrayOutputStream baos,
                               MediaType contentType,
                               HTTPStatus status)
        constructor with content and response code
        Parameters:
        baos - Output stream of the service response
        contentType - Content type
        status - the HTTP response code as specified in HttpServletResponse
      • ServiceResponse

        public ServiceResponse​(ByteArrayOutputStream baos,
                               MediaType contentType)
        constructor with content but not specified response code
        Parameters:
        baos - Output stream of the service response
        contentType - Content type
      • ServiceResponse

        public ServiceResponse​(MediaType contentType,
                               HTTPStatus status)
        constructor without content type but with specified response code
        Parameters:
        contentType - Content type
        status - the HTTP response code as specified in HttpServletResponse
    • Method Detail

      • getContentType

        public MediaType getContentType()
        Returns:
        Returns the content type of this response
      • isSetHeaderMap

        public boolean isSetHeaderMap()
        Returns:
        true if as minimum one header value is contained in the map
      • setHeader

        public void setHeader​(String headerIdentifier,
                              String headerValue)
      • writeToOutputStream

        public void writeToOutputStream​(OutputStream outputStream)
        Parameters:
        outputStream - The stream the content of this response is written to
        See Also:
        isContentLess()
      • isContentLess

        public boolean isContentLess()
        Check, if this response contains content to be written.
        Returns:
        true, if content is NOT available, else false, if content is available
        See Also:
        writeToOutputStream(java.io.OutputStream)
      • getContentLength

        public int getContentLength()
        Get the content length of the byte stream
        Returns:
        content length
      • getStatus

        public HTTPStatus getStatus()
        Returns:
        the status code
      • setStatus

        public void setStatus​(HTTPStatus status)
      • supportsGZip

        public boolean supportsGZip()
        Returns:
        Whether or not the response can be gzipped
      • setSupportsGZip

        public void setSupportsGZip​(boolean supportsGZip)