Class RemoteConnectorResponseImpl
- java.lang.Object
-
- org.alfresco.repo.remoteconnector.RemoteConnectorResponseImpl
-
- All Implemented Interfaces:
RemoteConnectorResponse
public class RemoteConnectorResponseImpl extends java.lang.Object implements RemoteConnectorResponse
Helper wrapper around a Remote Request, to be performed by theRemoteConnectorService.- Since:
- 4.0.2
- Author:
- Nick Burch
-
-
Constructor Summary
Constructors Constructor Description RemoteConnectorResponseImpl(RemoteConnectorRequest request, java.lang.String contentType, java.lang.String charset, int status, org.apache.commons.httpclient.Header[] headers, byte[] response)RemoteConnectorResponseImpl(RemoteConnectorRequest request, java.lang.String contentType, java.lang.String charset, int status, org.apache.commons.httpclient.Header[] headers, java.io.InputStream response)Creates a new Response object with the data coming from a stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCharset()java.lang.StringgetContentType()java.lang.StringgetRawContentType()RemoteConnectorRequestgetRequest()byte[]getResponseBodyAsBytes()java.io.InputStreamgetResponseBodyAsStream()java.lang.StringgetResponseBodyAsString()org.apache.commons.httpclient.Header[]getResponseHeaders()intgetStatus()
-
-
-
Constructor Detail
-
RemoteConnectorResponseImpl
public RemoteConnectorResponseImpl(RemoteConnectorRequest request, java.lang.String contentType, java.lang.String charset, int status, org.apache.commons.httpclient.Header[] headers, java.io.InputStream response)
Creates a new Response object with the data coming from a stream. Because of the HttpClient lifecycle, a HttpClient response InputStream shouldn't be used as cleanup is needed
-
RemoteConnectorResponseImpl
public RemoteConnectorResponseImpl(RemoteConnectorRequest request, java.lang.String contentType, java.lang.String charset, int status, org.apache.commons.httpclient.Header[] headers, byte[] response)
-
-
Method Detail
-
getStatus
public int getStatus()
- Specified by:
getStatusin interfaceRemoteConnectorResponse- Returns:
- The HTTP
StatusCode for the response
-
getCharset
public java.lang.String getCharset()
- Specified by:
getCharsetin interfaceRemoteConnectorResponse- Returns:
- The charset of the response content, if available
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentTypein interfaceRemoteConnectorResponse- Returns:
- The mimetype of the response content, if available
-
getRawContentType
public java.lang.String getRawContentType()
- Specified by:
getRawContentTypein interfaceRemoteConnectorResponse- Returns:
- The raw response content type, if available
-
getRequest
public RemoteConnectorRequest getRequest()
- Specified by:
getRequestin interfaceRemoteConnectorResponse- Returns:
- The request that generated this response
-
getResponseHeaders
public org.apache.commons.httpclient.Header[] getResponseHeaders()
- Specified by:
getResponseHeadersin interfaceRemoteConnectorResponse- Returns:
- All of the response headers
-
getResponseBodyAsBytes
public byte[] getResponseBodyAsBytes() throws java.io.IOException- Specified by:
getResponseBodyAsBytesin interfaceRemoteConnectorResponse- Returns:
- The response data, as a byte array
- Throws:
java.io.IOException
-
getResponseBodyAsStream
public java.io.InputStream getResponseBodyAsStream()
- Specified by:
getResponseBodyAsStreamin interfaceRemoteConnectorResponse- Returns:
- The response data, as a stream
-
getResponseBodyAsString
public java.lang.String getResponseBodyAsString() throws java.io.IOException- Specified by:
getResponseBodyAsStringin interfaceRemoteConnectorResponse- Returns:
- The response as a string, based on the response content type charset
- Throws:
java.io.IOException
-
-