Package org.refcodes.net
Class HttpClientResponseImpl
- java.lang.Object
-
- org.refcodes.net.HttpResponseImpl
-
- org.refcodes.net.HttpClientResponseImpl
-
- All Implemented Interfaces:
HeaderFieldsAccessor<ResponseHeaderFields>
,HttpBodyAccessor
,HttpClientResponse
,HttpInputStreamAccessor
,HttpResponse
,HttpStatusCodeAccessor
,UrlAccessor
public class HttpClientResponseImpl extends HttpResponseImpl implements HttpClientResponse
Implementation of theHttpClientResponse
interface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.net.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.net.HttpBodyAccessor
HttpBodyAccessor.HttpBodyBuilder<B extends HttpBodyAccessor.HttpBodyBuilder<B>>, HttpBodyAccessor.HttpBodyMutator, HttpBodyAccessor.HttpBodyProperty, HttpBodyAccessor.HttpBodyProvider<EXC extends java.lang.Exception>
-
Nested classes/interfaces inherited from interface org.refcodes.net.HttpInputStreamAccessor
HttpInputStreamAccessor.HttpInputStreamBuilder<B extends HttpInputStreamAccessor.HttpInputStreamBuilder<B>>, HttpInputStreamAccessor.HttpInputStreamMutator, HttpInputStreamAccessor.HttpInputStreamProperty, HttpInputStreamAccessor.HttpInputStreamProvider<EXC extends java.lang.Exception>
-
Nested classes/interfaces inherited from interface org.refcodes.net.HttpStatusCodeAccessor
HttpStatusCodeAccessor.HttpStatusCodeBuilder<B extends HttpStatusCodeAccessor.HttpStatusCodeBuilder<B>>, HttpStatusCodeAccessor.HttpStatusCodeMutator, HttpStatusCodeAccessor.HttpStatusCodeProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.UrlAccessor
UrlAccessor.UrlBuilder, UrlAccessor.UrlMutator, UrlAccessor.UrlProperty
-
-
Field Summary
Fields Modifier and Type Field Description protected MediaTypeFactoryLookup
_mediaTypeFactoryLookup
-
Fields inherited from class org.refcodes.net.HttpResponseImpl
_httpStatusCode
-
-
Constructor Summary
Constructors Constructor Description HttpClientResponseImpl(Url aUrl, HttpStatusCode aHttpStatusCode, ResponseHeaderFields aHeaderFields, java.io.InputStream aHttpInputStream, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Constructs aHttpClientResponse
with all required attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getHttpBody()
Retrieves the HTTP body from the HTTP body property.java.io.InputStream
getHttpInputStream()
Retrieves theInputStream
from the HTTPInputStream
property.<RES> RES
getResponse(java.lang.Class<RES> aResponseType)
This method's implementation supports theHttpBodyMap
to unmarshal an HTTP Response-Body into anHttpBodyMap
when providing theHttpBodyMap
as response type.Url
getUrl()
java.lang.String
toString()
-
Methods inherited from interface org.refcodes.net.HeaderFieldsAccessor
getHeaderFields
-
Methods inherited from interface org.refcodes.net.HttpClientResponse
getResponse
-
Methods inherited from class org.refcodes.net.HttpResponseImpl
getHeaderFields, getHttpStatusCode
-
Methods inherited from interface org.refcodes.net.HttpStatusCodeAccessor
getHttpStatusCode
-
-
-
-
Field Detail
-
_mediaTypeFactoryLookup
protected MediaTypeFactoryLookup _mediaTypeFactoryLookup
-
-
Constructor Detail
-
HttpClientResponseImpl
public HttpClientResponseImpl(Url aUrl, HttpStatusCode aHttpStatusCode, ResponseHeaderFields aHeaderFields, java.io.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 Detail
-
getResponse
public <RES> RES getResponse(java.lang.Class<RES> aResponseType) throws BadResponseException
This method's implementation supports theHttpBodyMap
to unmarshal an HTTP Response-Body into anHttpBodyMap
when providing theHttpBodyMap
as response type.- Specified by:
getResponse
in interfaceHttpClientResponse
- Type Parameters:
RES
- the generic type- Parameters:
aResponseType
- the response type- Returns:
- the response
- Throws:
BadResponseException
- the bad response exception
-
getHttpInputStream
public java.io.InputStream getHttpInputStream()
Retrieves theInputStream
from the HTTPInputStream
property.- Specified by:
getHttpInputStream
in interfaceHttpInputStreamAccessor
- Returns:
- The
InputStream
stored by theInputStream
property.
-
getHttpBody
public java.lang.String 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
public Url getUrl()
- Specified by:
getUrl
in interfaceUrlAccessor
- Returns:
- The Url stored by the
Url
property.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-