Class HttpResponse
HTTP response.
-
Nested Class Summary
Nested classes/interfaces inherited from class HttpBase
HttpBase.Defaults -
Field Summary
FieldsFields inherited from class HttpBase
body, capitalizeHeaderKeys, charset, form, formEncoding, HEADER_ACCEPT, HEADER_ACCEPT_ENCODING, HEADER_AUTHORIZATION, HEADER_CLOSE, HEADER_CONNECTION, HEADER_CONTENT_ENCODING, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_ETAG, HEADER_HOST, HEADER_KEEP_ALIVE, HEADER_USER_AGENT, headers, HTTP_1_0, HTTP_1_1, httpProgressListener, httpVersion, mediaType, multipart -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidassignHttpRequest(HttpRequest httpRequest) BindsHttpRequestto this response.protected Bufferbuffer(boolean fullResponse) Creates responsebuffer.close()Closes requests connection if it was open.Cookie[]cookies()Returns list of valid cookies sent from server.ReturnsHttpRequestthat created this response.location()Parses the 'location' header and returns an absolute URL for the provided path.static HttpResponsereadFrom(InputStream in) Reads response input stream and returnsresponse.intReturns response status code.statusCode(int statusCode) Sets response status code.Returns response status phrase.statusPhrase(String statusPhrase) Sets response status phrase.unzip()Unzips GZip-ed body content, removes the content-encoding header and sets the new content-length value.Methods inherited from class HttpBase
_header, _headerRaw, _this, accept, accept, acceptEncoding, acceptEncoding, body, body, bodyBytes, bodyRaw, bodyText, bodyText, bodyText, bodyText, capitalizeHeaderKeys, capitalizeHeaderKeys, charset, charset, connectionKeepAlive, contentEncoding, contentLength, contentLength, contentType, contentType, contentType, form, form, form, form, formBuffer, formEncoding, formOverwrite, header, header, header, header, header, headerNames, headerOverwrite, headerRemove, headers, headersClear, httpVersion, httpVersion, initForm, isConnectionPersistent, isFormMultipart, mediaType, mediaType, populateHeaderAndBody, readBody, readHeaders, resolveFormEncoding, sendTo, toByteArray, tokenAuthentication, toString, toString, wrapFormValue
-
Field Details
-
statusCode
protected int statusCode -
statusPhrase
-
httpRequest
-
-
Constructor Details
-
HttpResponse
public HttpResponse()
-
-
Method Details
-
statusCode
public int statusCode()Returns response status code. -
statusCode
Sets response status code. -
statusPhrase
Returns response status phrase. -
statusPhrase
Sets response status phrase. -
location
Parses the 'location' header and returns an absolute URL for the provided path. Returnsnullif no location was specified or throwsHttpExceptionif it was impossible to assemble a valid URL.RFC 2616 still required an absolute URL, whereas RFC 9110 introduced the support for relative paths.
-
cookies
Returns list of valid cookies sent from server. If no cookie found, returns an empty array. Invalid cookies are ignored.- Overrides:
cookiesin classHttpBase<HttpResponse>
-
unzip
Unzips GZip-ed body content, removes the content-encoding header and sets the new content-length value. -
buffer
Creates responsebuffer.- Specified by:
bufferin classHttpBase<HttpResponse>
-
readFrom
Reads response input stream and returnsresponse. Supports both streamed and chunked response. -
assignHttpRequest
BindsHttpRequestto this response. -
getHttpRequest
ReturnsHttpRequestthat created this response. -
close
Closes requests connection if it was open. Should be called when using keep-alive connections. Otherwise, connection will be already closed.
-