public abstract class AbstractHttpResponse extends Object implements HttpResponse
HttpResponse interface.
This abstract class is not part of the public API and should not be used publicly.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractHttpResponse(long duration)
Create the partial HTTP response implementation.
|
| Modifier and Type | Method and Description |
|---|---|
String |
body()
Http response body.
|
protected boolean |
canEqual(AbstractHttpResponse o)
Ensure that given object o can be equal to this.
|
boolean |
containsHeader(String name)
Check that given header is available.
|
boolean |
equals(Object o) |
HttpHeader |
getCacheControl()
Get
Cache-Control header from http response. |
HttpHeader |
getContentEncoding()
Get
Content-Encoding header from http response. |
HttpHeader |
getContentSecurityPolicy()
Get
Content-Security-Policy header from http response. |
HttpHeader |
getContentType()
Get
Content-Type header from http response. |
Cookie |
getCookie(String name)
Get cookie by its name (if cookie is missing,
null is returned). |
List<Cookie> |
getCookies()
Get all cookies sent by server.
|
HttpHeader |
getETag()
Get
ETag header from http response. |
HttpHeader |
getLastModified()
Get
Last-Modified header from http response. |
HttpHeader |
getLocation()
Get
Location header from http response. |
long |
getRequestDuration()
Get duration of request execution in nano seconds.
|
long |
getRequestDurationInMillis()
Get duration of request execution in milli seconds (shortcut for
getRequestDuration() / 100). |
HttpHeader |
getStrictTransportSecurity()
Get
Strict-Transport-Security header from http response. |
HttpHeader |
getXContentSecurityPolicy()
Get
X-Content-Security-Policy header from http response: this header was initially an experimental
header implemented in Firefox. |
HttpHeader |
getXContentTypeOptions()
Get
X-Content-Type-Options header from http response. |
HttpHeader |
getXWebkitCSP()
Get
X-Webkit-CSP header from http response: this header was initially an experimental header implemented
in Webkit browser (Chrome and Safari). |
HttpHeader |
getXXSSProtection()
Get
X-XSS-Protection header from http response. |
int |
hashCode() |
protected abstract String |
readResponseBody()
Read HTTP Response _body as a
String. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetHeader, getHeaders, statusprotected AbstractHttpResponse(long duration)
duration - Original request duration.public long getRequestDuration()
HttpResponsegetRequestDuration in interface HttpResponsepublic long getRequestDurationInMillis()
HttpResponsegetRequestDuration() / 100).getRequestDurationInMillis in interface HttpResponseHttpResponse.getRequestDuration()public String body()
HttpResponsebody in interface HttpResponseprotected abstract String readResponseBody() throws IOException
String.IOException - If an error occurred while reading _body.public boolean containsHeader(String name)
HttpResponsecontainsHeader in interface HttpResponsename - Header name.true if header is in response, false otherwise.public Cookie getCookie(String name)
HttpResponsenull is returned).getCookie in interface HttpResponsename - Cookie name.HttpHeaders.SET_COOKIE,
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie,
https://tools.ietf.org/html/rfc6265#section-4.1public List<Cookie> getCookies()
HttpResponsegetCookies in interface HttpResponseHttpHeaders.SET_COOKIE,
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie,
https://tools.ietf.org/html/rfc6265#section-4.1public HttpHeader getETag()
HttpResponseETag header from http response.getETag in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.ETAG,
https://tools.ietf.org/html/rfc7232#section-2.3public HttpHeader getContentType()
HttpResponseContent-Type header from http response.getContentType in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.CONTENT_TYPE,
https://www.w3.org/Protocols/rfc1341/4_Content-Type.htmlpublic HttpHeader getContentEncoding()
HttpResponseContent-Encoding header from http response.getContentEncoding in interface HttpResponseHttpHeaders.CONTENT_ENCODING,
https://tools.ietf.org/html/rfc7231#section-3.1.2.2public HttpHeader getLocation()
HttpResponseLocation header from http response.getLocation in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.LOCATION,
https://tools.ietf.org/html/rfc7231#section-7.1.2public HttpHeader getCacheControl()
HttpResponseCache-Control header from http response.getCacheControl in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.CACHE_CONTROL,
https://tools.ietf.org/html/rfc7234#section-5.2public HttpHeader getLastModified()
HttpResponseLast-Modified header from http response.getLastModified in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.LAST_MODIFIED,
https://tools.ietf.org/html/rfc7232#section-2.2public HttpHeader getStrictTransportSecurity()
HttpResponseStrict-Transport-Security header from http response.getStrictTransportSecurity in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.STRICT_TRANSPORT_SECURITY,
https://tools.ietf.org/html/rfc6797public HttpHeader getContentSecurityPolicy()
HttpResponseContent-Security-Policy header from http response.getContentSecurityPolicy in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.CONTENT_SECURITY_POLICY,
https://www.w3.org/TR/2011/WD-CSP-20111129/,
https://content-security-policy.com/public HttpHeader getXContentSecurityPolicy()
HttpResponseX-Content-Security-Policy header from http response: this header was initially an experimental
header implemented in Firefox.getXContentSecurityPolicy in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.X_CONTENT_SECURITY_POLICY,
https://www.w3.org/TR/2011/WD-CSP-20111129/,
https://content-security-policy.com/public HttpHeader getXWebkitCSP()
HttpResponseX-Webkit-CSP header from http response: this header was initially an experimental header implemented
in Webkit browser (Chrome and Safari).getXWebkitCSP in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.X_WEBKIT_CSP,
https://www.w3.org/TR/2011/WD-CSP-20111129/,
https://content-security-policy.com/public HttpHeader getXContentTypeOptions()
HttpResponseX-Content-Type-Options header from http response.getXContentTypeOptions in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.X_CONTENT_TYPE_OPTIONS,
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Optionspublic HttpHeader getXXSSProtection()
HttpResponseX-XSS-Protection header from http response.getXXSSProtection in interface HttpResponseHttpResponse.getHeader(String),
HttpHeaders.X_XSS_PROTECTION,
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protectionprotected boolean canEqual(AbstractHttpResponse o)
o - The HTTP Response.Copyright © 2018. All rights reserved.