public class BaseResponse extends Object implements Response, Retrievable
Constructor and Description |
---|
BaseResponse(int statusCode,
String baseUrl,
byte[] content,
org.apache.http.entity.ContentType contentType,
org.apache.http.Header[] headers,
org.apache.http.HttpHost proxy)
Constructs a base response.
|
BaseResponse(int statusCode,
String baseUrl,
byte[] content,
org.apache.http.entity.ContentType contentType,
org.apache.http.Header[] headers,
org.apache.http.HttpHost proxy,
Validator validator,
String sourceId)
Constructs a base response.
|
Modifier and Type | Method and Description |
---|---|
String |
getBaseUrl()
Returns the base form of the url used in this request.
|
byte[] |
getContent()
Returns raw content of the response.
|
org.apache.http.entity.ContentType |
getContentType()
Returns the content type of the content fetched.
|
org.apache.http.Header[] |
getHeaders()
Returns the headers that were used to trigger this response.
|
org.apache.http.HttpHost |
getProxy()
Returns the proxy that was used to trigger this response.
|
String |
getSourceId()
Returns the id of the row where an archive of this response
has been insert into a persistent storage.
|
int |
getStatusCode()
Returns status code of the response.
|
Validator |
getValidator()
Returns the instance of validator used to validate this response.
|
BaseResponse |
setSourceId(String sourceId)
Sets the source id where the raw response is saved.
|
BaseResponse |
setValidator(Validator validator)
Sets the validator used to validate this response.
|
public BaseResponse(int statusCode, String baseUrl, byte[] content, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] headers, org.apache.http.HttpHost proxy)
statusCode
- Status code of the responsebaseUrl
- Base url of the responsecontent
- Content from the responsecontentType
- Content type of the responseheaders
- Headers from the responseproxy
- Proxy used to obtain the responsepublic BaseResponse(int statusCode, String baseUrl, byte[] content, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] headers, org.apache.http.HttpHost proxy, Validator validator, String sourceId)
statusCode
- Status code of the responsebaseUrl
- Base url of the responsecontent
- Content from the responsecontentType
- Content type of the responseheaders
- Headers from the responseproxy
- Proxy used to obtain the responsevalidator
- Validator used to validate this responsesourceId
- `id` of the row the raw response is saved topublic final int getStatusCode()
Response
getStatusCode
in interface Response
public final byte[] getContent()
Response
getContent
in interface Response
public final org.apache.http.entity.ContentType getContentType()
Response
This is provided by the server or guessed by the server or an amalgamation of both.
getContentType
in interface Response
public final org.apache.http.Header[] getHeaders()
Response
getHeaders
in interface Response
public final String getBaseUrl()
Response
getBaseUrl
in interface Response
public final org.apache.http.HttpHost getProxy()
Response
public final Validator getValidator()
Response
getValidator
in interface Response
public final BaseResponse setValidator(Validator validator)
validator
- Row id of the saved responsepublic final String getSourceId()
Retrievable
This string should be null if no implementation of FileManager is specified during the initialisation of the fetcher.
getSourceId
in interface Retrievable
public final BaseResponse setSourceId(String sourceId)
sourceId
- Row id of the saved responseCopyright © 2018. All rights reserved.