Class RemoteConnectorResponseImpl
- java.lang.Object
-
- org.alfresco.repo.remoteconnector.RemoteConnectorResponseImpl
-
- All Implemented Interfaces:
RemoteConnectorResponse
public class RemoteConnectorResponseImpl extends 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, String contentType, String charset, int status, org.apache.commons.httpclient.Header[] headers, byte[] response)RemoteConnectorResponseImpl(RemoteConnectorRequest request, String contentType, String charset, int status, org.apache.commons.httpclient.Header[] headers, 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 StringgetCharset()StringgetContentType()StringgetRawContentType()RemoteConnectorRequestgetRequest()byte[]getResponseBodyAsBytes()InputStreamgetResponseBodyAsStream()StringgetResponseBodyAsString()org.apache.commons.httpclient.Header[]getResponseHeaders()intgetStatus()
-
-
-
Constructor Detail
-
RemoteConnectorResponseImpl
public RemoteConnectorResponseImpl(RemoteConnectorRequest request, String contentType, String charset, int status, org.apache.commons.httpclient.Header[] headers, 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, String contentType, 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 String getCharset()
- Specified by:
getCharsetin interfaceRemoteConnectorResponse- Returns:
- The charset of the response content, if available
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceRemoteConnectorResponse- Returns:
- The mimetype of the response content, if available
-
getRawContentType
public 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 IOException- Specified by:
getResponseBodyAsBytesin interfaceRemoteConnectorResponse- Returns:
- The response data, as a byte array
- Throws:
IOException
-
getResponseBodyAsStream
public InputStream getResponseBodyAsStream()
- Specified by:
getResponseBodyAsStreamin interfaceRemoteConnectorResponse- Returns:
- The response data, as a stream
-
getResponseBodyAsString
public String getResponseBodyAsString() throws IOException
- Specified by:
getResponseBodyAsStringin interfaceRemoteConnectorResponse- Returns:
- The response as a string, based on the response content type charset
- Throws:
IOException
-
-