Package org.n52.iceland.response
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 Summary
Constructors Constructor Description ServiceResponse(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetContentLength()Get the content length of the byte streamMediaTypegetContentType()Map<String,String>getHeaderMap()List<SoapHeader>getSoapHeader()HTTPStatusgetStatus()booleanisContentLess()Check, if this response contains content to be written.booleanisSetHeaderMap()booleanisSetSoapHeader()Convenience method to check if the SoapHeader is set.voidsetHeader(String headerIdentifier, String headerValue)voidsetSoapHeader(List<SoapHeader> header)voidsetStatus(HTTPStatus status)voidsetSupportsGZip(boolean supportsGZip)booleansupportsGZip()StringtoString()voidwriteToOutputStream(OutputStream outputStream)
-
-
-
Constructor Detail
-
ServiceResponse
public ServiceResponse(ByteArrayOutputStream baos, MediaType contentType, HTTPStatus status)
constructor with content and response code- Parameters:
baos- Output stream of the service responsecontentType- Content typestatus- the HTTP response code as specified inHttpServletResponse
-
ServiceResponse
public ServiceResponse(ByteArrayOutputStream baos, MediaType contentType)
constructor with content but not specified response code- Parameters:
baos- Output stream of the service responsecontentType- Content type
-
ServiceResponse
public ServiceResponse(MediaType contentType, HTTPStatus status)
constructor without content type but with specified response code- Parameters:
contentType- Content typestatus- the HTTP response code as specified inHttpServletResponse
-
-
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
-
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, elsefalse, 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)
-
getSoapHeader
public List<SoapHeader> getSoapHeader()
- Specified by:
getSoapHeaderin interfaceCommunicationObjectWithSoapHeader- Returns:
- the SoapHeader encoded as an InputStream containing XML.
-
setSoapHeader
public void setSoapHeader(List<SoapHeader> header)
- 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)
-
-