public void close() {
}
@Override
public Response prepareResponse(final HttpResponseStatus status, final HttpResponseHeaders headers, final List<HttpResponseBodyPart> bodyParts) {
final HttpResponseBodyPart bodyPart = bodyParts.get(0);
return new Response() {
@Override
public int getStatusCode() {
return status.getStatusCode();
}
@Override
public String getStatusText() {
return status.getStatusText();
}
@Override
public byte[] getResponseBodyAsBytes() throws IOException {
return bodyPart.getBodyPartBytes();
}
@Override
public ByteBuffer getResponseBodyAsByteBuffer() throws IOException {
return bodyPart.getBodyByteBuffer();
}
@Override
public InputStream getResponseBodyAsStream() throws IOException {
return null; // TODO
}
@Override
public String getResponseBodyExcerpt(int maxLength, String charset) throws IOException {
return ""; // TODO
}
@Override
public String getResponseBody(String charset) throws IOException {
return new String(bodyPart.getBodyPartBytes(), charset);
}
@Override
public String getResponseBodyExcerpt(int maxLength) throws IOException {
return null; // TODO
}
@Override
public String getResponseBody() throws IOException {
return new String(bodyPart.getBodyPartBytes());
}
@Override
public URI getUri() throws MalformedURLException {
return status.getUrl();