Interface Response
-
- All Implemented Interfaces:
public interface Response
-
-
Method Summary
Modifier and Type Method Description abstract Iterator<ByteArray>contentIterator(Integer chunkSize)Gets an Iterator that provides ByteArrays of chunkSize for the content. abstract Iterator<ByteArray>lineIterator(Integer chunkSize, ByteArray delimiter)Gets an Iterator that provides ByteArrays of lines separated by delimiter. abstract RequestgetRequest()The request that generated this response. abstract IntegergetStatusCode()The status code from the request. abstract Map<String, String>getHeaders()The headers from the request. abstract InputStreamgetRaw()The raw response from the request. abstract ByteArraygetContent()The response as a ByteArray. abstract StringgetText()The response as a String. abstract JSONObjectgetJsonObject()The response as a JSON object. abstract JSONArraygetJsonArray()The response as a JSON array. abstract CookieJargetCookies()The cookies from the request. abstract StringgetUrl()The URL that this request ended up going to. abstract CharsetgetEncoding()The encoding in which to decode text. abstract UnitsetEncoding(Charset encoding)The encoding in which to decode text. abstract List<Response>getHistory()A list of KHttpResponse objects from the history of the request. abstract HttpURLConnectiongetConnection()The connection used for the request. -
-
Method Detail
-
contentIterator
abstract Iterator<ByteArray> contentIterator(Integer chunkSize)
-
lineIterator
abstract Iterator<ByteArray> lineIterator(Integer chunkSize, ByteArray delimiter)
Gets an Iterator that provides ByteArrays of lines separated by delimiter.
If delimiter is not specified, the delimiter will be
\r?\n.chunkSize sets the size of chunks used by contentIterator internally when scanning for lines.
This method converts lines into Strings and back to ByteArrays using encoding.
-
getRequest
abstract Request getRequest()
The request that generated this response.
-
getStatusCode
abstract Integer getStatusCode()
The status code from the request.
-
getHeaders
abstract Map<String, String> getHeaders()
The headers from the request.
-
getRaw
abstract InputStream getRaw()
The raw response from the request.
-
getContent
abstract ByteArray getContent()
The response as a ByteArray.
-
getJsonObject
abstract JSONObject getJsonObject()
The response as a JSON object.
-
getJsonArray
abstract JSONArray getJsonArray()
The response as a JSON array.
-
getCookies
abstract CookieJar getCookies()
The cookies from the request.
-
getEncoding
abstract Charset getEncoding()
The encoding in which to decode text. If not specified, uses the Content-Type header. If there is no such header, uses UTF-8.
-
setEncoding
abstract Unit setEncoding(Charset encoding)
The encoding in which to decode text. If not specified, uses the Content-Type header. If there is no such header, uses UTF-8.
-
getHistory
abstract List<Response> getHistory()
A list of KHttpResponse objects from the history of the request. Any redirect responses will end up here. The list is sorted from the oldest to the most recent request.
-
getConnection
abstract HttpURLConnection getConnection()
The connection used for the request.
-
-
-
-