Package org.n52.iceland.response
Class ServiceResponse
java.lang.Object
org.n52.iceland.response.ServiceResponse
- All Implemented Interfaces:
CommunicationObjectWithSoapHeader
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionServiceResponse(ByteArrayOutputStream baos, MediaType contentType) constructor with content but not specified response codeServiceResponse(ByteArrayOutputStream baos, MediaType contentType, HTTPStatus status) constructor with content and response codeServiceResponse(MediaType contentType, HTTPStatus status) constructor without content type but with specified response code -
Method Summary
Modifier and TypeMethodDescriptionintGet the content length of the byte streambooleanCheck, if this response contains content to be written.booleanbooleanConvenience method to check if the SoapHeader is set.voidvoidsetSoapHeader(List<SoapHeader> header) voidsetStatus(HTTPStatus status) voidsetSupportsGZip(boolean supportsGZip) booleantoString()voidwriteToOutputStream(OutputStream outputStream)
-
Constructor Details
-
ServiceResponse
constructor with content and response code- Parameters:
baos- Output stream of the service responsecontentType- Content typestatus- the HTTP response code as specified inHttpServletResponse
-
ServiceResponse
constructor with content but not specified response code- Parameters:
baos- Output stream of the service responsecontentType- Content type
-
ServiceResponse
constructor without content type but with specified response code- Parameters:
contentType- Content typestatus- the HTTP response code as specified inHttpServletResponse
-
-
Method Details
-
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
-
getHeaderMap
-
writeToOutputStream
- 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, elsefalse, if content is available- See Also:
-
getContentLength
public int getContentLength()Get the content length of the byte stream- Returns:
- content length
-
getStatus
- Returns:
- the status code
-
setStatus
-
toString
-
getSoapHeader
- Specified by:
getSoapHeaderin interfaceCommunicationObjectWithSoapHeader- Returns:
- the SoapHeader encoded as an InputStream containing XML.
-
setSoapHeader
- Specified by:
setSoapHeaderin interfaceCommunicationObjectWithSoapHeader- Parameters:
header- the SoapHeader encoded as an InputStream containing XML.
-
isSetSoapHeader
public boolean isSetSoapHeader()Description copied from interface:CommunicationObjectWithSoapHeaderConvenience method to check if the SoapHeader is set.- Specified by:
isSetSoapHeaderin interfaceCommunicationObjectWithSoapHeader- 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)
-