java.lang.Object
org.seppiko.commons.utils.http.HttpResponseImpl<T>
- All Implemented Interfaces:
HttpResponse<T>
HttpResponse implementation
- Author:
- Leonard Woo
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.net.http.HttpResponse
HttpResponse.BodyHandler<T extends Object>, HttpResponse.BodyHandlers, HttpResponse.BodySubscriber<T extends Object>, HttpResponse.BodySubscribers, HttpResponse.PushPromiseHandler<T extends Object>, HttpResponse.ResponseInfo -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbody()Returns the body.headers()Returns the received response headers.Returns anOptionalcontaining the previous intermediate response if one was received.request()Returns the HttpRequest corresponding to this response.Returns anOptionalcontaining theSSLSessionin effect for this response.intReturns the status code for this response.uri()Returns theURIthat the response was received from.version()Returns the HTTP protocol version that was used for this response.
-
Constructor Details
-
HttpResponseImpl
Constructor- Parameters:
resp- http response
-
-
Method Details
-
statusCode
public int statusCode()Returns the status code for this response.- Specified by:
statusCodein interfaceHttpResponse<T>- Returns:
- the response code
-
request
Returns the HttpRequest corresponding to this response.- Specified by:
requestin interfaceHttpResponse<T>- Returns:
- the request
- See Also:
-
previousResponse
Returns anOptionalcontaining the previous intermediate response if one was received.- Specified by:
previousResponsein interfaceHttpResponse<T>- Returns:
- an Optional containing the HttpResponse, if any.
-
headers
Returns the received response headers.- Specified by:
headersin interfaceHttpResponse<T>- Returns:
- the response headers
-
body
Returns the body.If this
HttpResponsewas returned from an invocation ofpreviousResponse()then this method returnsnull- Specified by:
bodyin interfaceHttpResponse<T>- Returns:
- the body
-
sslSession
Returns anOptionalcontaining theSSLSessionin effect for this response.- Specified by:
sslSessionin interfaceHttpResponse<T>- Returns:
- an
Optionalcontaining theSSLSessionassociated with the response
-
uri
Returns theURIthat the response was received from. This may be different from the requestURIif redirection occurred.- Specified by:
uriin interfaceHttpResponse<T>- Returns:
- the URI of the response
-
version
Returns the HTTP protocol version that was used for this response.- Specified by:
versionin interfaceHttpResponse<T>- Returns:
- HTTP protocol version
-