public class MechResponse extends Object implements Closeable
| Constructor and Description |
|---|
MechResponse(MechRequest request,
org.apache.http.impl.client.CloseableHttpClient httpClient,
org.apache.http.client.methods.CloseableHttpResponse response,
Optional<JsonValidator> jsonValidator) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
byte[] |
getContent() |
String |
getContentString() |
String |
getContentString(Charset charset) |
org.apache.http.entity.ContentType |
getContentType() |
Optional<String> |
getFirstHeader(String name) |
List<String> |
getHeaders(String name) |
MechRequest |
getRequest() |
org.apache.http.HttpResponse |
getResponse() |
int |
getStatusCode() |
<T> T |
readJSON(Class<T> valueType) |
<T> T |
readJSON(com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef) |
public MechResponse(MechRequest request, org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.CloseableHttpResponse response, @NonNull Optional<JsonValidator> jsonValidator)
public int getStatusCode()
public org.apache.http.entity.ContentType getContentType()
public String getContentString()
public <T> T readJSON(Class<T> valueType) throws com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException, IOException, JsonValidatorViolationException
com.fasterxml.jackson.core.JsonParseExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionJsonValidatorViolationExceptionpublic <T> T readJSON(com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef)
throws com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
IOException,
JsonValidatorViolationException
com.fasterxml.jackson.core.JsonParseExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionJsonValidatorViolationExceptionpublic org.apache.http.HttpResponse getResponse()
public byte[] getContent()
public MechRequest getRequest()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2014. All rights reserved.