public class HttpResponse extends Object
| Constructor and Description |
|---|
HttpResponse(InputStream inputStream) |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getBodyAsStream()
This returns the body of the response as a stream
Please note it is the user needs to close this stream if connection is to be reused
|
long |
getContentLength() |
String |
getHeader(String headerName)
This returns an HTTP header by name, if there are more then one header with this name, the first one will be
returned, if header with this name does not exist, null is returned.
|
HttpResponseHeaders |
getHeaders() |
List<String> |
getHeaders(String headerName)
This returns headers by name, if there are more then one header with this name, all of them will be returned, if
headers with this name don't exist, an empty list is returned The name is not case-sensitive.
|
String |
getReason() |
int |
getStatusCode() |
String |
getVersion() |
boolean |
isBodyCompressed() |
boolean |
isContentChunked() |
byte[] |
readBodyAsBytes()
This reads the body of the request and returns it as an array of bytes
|
String |
readBodyAsString()
This reads the body of the request and returns it as a string
|
String |
toString() |
public HttpResponse(InputStream inputStream) throws IOException
IOExceptionpublic String getVersion()
public int getStatusCode()
public String getReason()
public long getContentLength()
public boolean isContentChunked()
public String getHeader(String headerName)
public List<String> getHeaders(String headerName)
public String readBodyAsString() throws IOException
IOExceptionpublic byte[] readBodyAsBytes()
throws IOException
IOExceptionpublic InputStream getBodyAsStream()
public boolean isBodyCompressed()
public HttpResponseHeaders getHeaders()
Copyright © 2019. All rights reserved.