Class ServiceResponse

java.lang.Object
org.n52.iceland.response.ServiceResponse
All Implemented Interfaces:
CommunicationObjectWithSoapHeader

public class ServiceResponse extends Object implements CommunicationObjectWithSoapHeader
Since:
1.0.0
  • Constructor Details

    • 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 Details

    • 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)
    • getHeaderMap

      public Map<String,String> getHeaderMap()
    • writeToOutputStream

      public void writeToOutputStream(OutputStream outputStream)
      Parameters:
      outputStream - The stream the content of this response is written to
      See Also:
    • 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:
    • 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)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSoapHeader

      public List<SoapHeader> getSoapHeader()
      Specified by:
      getSoapHeader in interface CommunicationObjectWithSoapHeader
      Returns:
      the SoapHeader encoded as an InputStream containing XML.
    • setSoapHeader

      public void setSoapHeader(List<SoapHeader> header)
      Specified by:
      setSoapHeader in interface CommunicationObjectWithSoapHeader
      Parameters:
      header - the SoapHeader encoded as an InputStream containing XML.
    • isSetSoapHeader

      public boolean isSetSoapHeader()
      Description copied from interface: CommunicationObjectWithSoapHeader
      Convenience method to check if the SoapHeader is set.
      Specified by:
      isSetSoapHeader in interface CommunicationObjectWithSoapHeader
      Returns:
      true if Header is set
    • supportsGZip

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

      public void setSupportsGZip(boolean supportsGZip)