java.lang.Object
org.refcodes.web.AbstractHttpResponse
org.refcodes.web.HttpClientResponse
- All Implemented Interfaces:
HeaderFieldsAccessor<ResponseHeaderFields>
,HttpBodyAccessor
,HttpInputStreamAccessor
,HttpResponse
,HttpStatusCodeAccessor
,UrlAccessor
public class HttpClientResponse
extends AbstractHttpResponse
implements HttpBodyAccessor, HttpInputStreamAccessor, UrlAccessor
Defines a
HttpClientResponse
being the response as consumed by the
client.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.web.HeaderFieldsAccessor
HeaderFieldsAccessor.HeaderFieldsBuilder<T extends HeaderFields<?,
?>, B extends HeaderFieldsAccessor.HeaderFieldsBuilder<T, B>>, HeaderFieldsAccessor.HeaderFieldsMutator<T extends HeaderFields<?, ?>>, HeaderFieldsAccessor.HeaderFieldsProperty<T extends HeaderFields<?, ?>> Nested classes/interfaces inherited from interface org.refcodes.web.HttpBodyAccessor
HttpBodyAccessor.HttpBodyBuilder<B extends HttpBodyAccessor.HttpBodyBuilder<B>>, HttpBodyAccessor.HttpBodyMutator, HttpBodyAccessor.HttpBodyProperty, HttpBodyAccessor.HttpBodyProvider<EXC extends Exception>
Nested classes/interfaces inherited from interface org.refcodes.web.HttpInputStreamAccessor
HttpInputStreamAccessor.HttpInputStreamBuilder<B extends HttpInputStreamAccessor.HttpInputStreamBuilder<B>>, HttpInputStreamAccessor.HttpInputStreamMutator, HttpInputStreamAccessor.HttpInputStreamProperty, HttpInputStreamAccessor.HttpInputStreamProvider<EXC extends Exception>
Nested classes/interfaces inherited from interface org.refcodes.web.HttpStatusCodeAccessor
HttpStatusCodeAccessor.HttpStatusCodeBuilder<B extends HttpStatusCodeAccessor.HttpStatusCodeBuilder<B>>, HttpStatusCodeAccessor.HttpStatusCodeMutator, HttpStatusCodeAccessor.HttpStatusCodeProperty
Nested classes/interfaces inherited from interface org.refcodes.web.UrlAccessor
UrlAccessor.UrlBuilder, UrlAccessor.UrlMutator, UrlAccessor.UrlProperty
-
Field Summary
FieldsFields inherited from class org.refcodes.web.AbstractHttpResponse
_httpStatusCode
-
Constructor Summary
ConstructorsConstructorDescriptionHttpClientResponse
(Url aUrl, HttpStatusCode aHttpStatusCode, ResponseHeaderFields aHeaderFields, InputStream aHttpInputStream, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Constructs aHttpClientResponse
with all required attributes.HttpClientResponse
(Url aUrl, ResponseHeaderFields aHeaderFields, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Constructs aHttpClientResponse
with all available attributes. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the HTTP body from the HTTP body property.Retrieves theInputStream
from the HTTPInputStream
property.Retrieves theHttpBodyMap
representing the response body.<RES> RES
getResponse
(Class<RES> aResponseType) This method's implementation supports theHttpBodyMap
to unmarshal an HTTP Response-Body into anHttpBodyMap
when providing theHttpBodyMap
as response type.getUrl()
toString()
Methods inherited from class org.refcodes.web.AbstractHttpResponse
getHeaderFields, getHttpStatusCode
-
Field Details
-
_mediaTypeFactoryLookup
-
-
Constructor Details
-
HttpClientResponse
public HttpClientResponse(Url aUrl, ResponseHeaderFields aHeaderFields, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Constructs aHttpClientResponse
with all available attributes.- Parameters:
aUrl
- The URL from which the response originates.aHeaderFields
- TheResponseHeaderFields
sent by the response.aMediaTypeFactoryLookup
- The lookup factory for retrieving the requiredMediaType
factories.
-
HttpClientResponse
public HttpClientResponse(Url aUrl, HttpStatusCode aHttpStatusCode, ResponseHeaderFields aHeaderFields, InputStream aHttpInputStream, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Constructs aHttpClientResponse
with all required attributes.- Parameters:
aUrl
- The URL from which the response originates.aHttpStatusCode
- TheHttpStatusCode
of the response.aHeaderFields
- TheResponseHeaderFields
sent by the response.aHttpInputStream
- TheInputStream
representing the request's HTTP body.aMediaTypeFactoryLookup
- The lookup factory for retrieving the requiredMediaType
factories.
-
-
Method Details
-
getResponse
Retrieves theHttpBodyMap
representing the response body.- Returns:
- An instance of the
HttpBodyMap
representing the response. - Throws:
BadResponseException
- thrown when unmarshaling / deserializing an object fails.
-
getResponse
This method's implementation supports theHttpBodyMap
to unmarshal an HTTP Response-Body into anHttpBodyMap
when providing theHttpBodyMap
as response type.- Type Parameters:
RES
- the generic type- Parameters:
aResponseType
- the response type- Returns:
- the response
- Throws:
BadResponseException
- the bad response exception
-
getHttpInputStream
Retrieves theInputStream
from the HTTPInputStream
property.- Specified by:
getHttpInputStream
in interfaceHttpInputStreamAccessor
- Returns:
- The
InputStream
stored by theInputStream
property.
-
getHttpBody
Retrieves the HTTP body from the HTTP body property.- Specified by:
getHttpBody
in interfaceHttpBodyAccessor
- Returns:
- The HTTP body stored by the HTTP body property.
-
getUrl
- Specified by:
getUrl
in interfaceUrlAccessor
- Returns:
- The Url stored by the
Url
property.
-
toString
-