java.lang.Object
org.refcodes.web.HttpResponseImpl
org.refcodes.web.HttpClientResponseImpl
- All Implemented Interfaces:
HeaderFieldsAccessor<ResponseHeaderFields>,HttpBodyAccessor,HttpClientResponse,HttpInputStreamAccessor,HttpResponse,HttpStatusCodeAccessor,UrlAccessor
public class HttpClientResponseImpl extends HttpResponseImpl implements HttpClientResponse
Implementation of the
HttpClientResponse interface.-
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.HttpStatusCodePropertyNested classes/interfaces inherited from interface org.refcodes.web.UrlAccessor
UrlAccessor.UrlBuilder, UrlAccessor.UrlMutator, UrlAccessor.UrlProperty -
Field Summary
Fields Modifier and Type Field Description protected MediaTypeFactoryLookup_mediaTypeFactoryLookupFields inherited from class org.refcodes.web.HttpResponseImpl
_httpStatusCode -
Constructor Summary
Constructors Constructor Description HttpClientResponseImpl(Url aUrl, HttpStatusCode aHttpStatusCode, ResponseHeaderFields aHeaderFields, InputStream aHttpInputStream, MediaTypeFactoryLookup aMediaTypeFactoryLookup)Constructs aHttpClientResponsewith all required attributes. -
Method Summary
Modifier and Type Method Description StringgetHttpBody()Retrieves the HTTP body from the HTTP body property.InputStreamgetHttpInputStream()Retrieves theInputStreamfrom the HTTPInputStreamproperty.<RES> RESgetResponse(Class<RES> aResponseType)This method's implementation supports theHttpBodyMapto unmarshal an HTTP Response-Body into anHttpBodyMapwhen providing theHttpBodyMapas response type.UrlgetUrl()StringtoString()Methods inherited from class org.refcodes.web.HttpResponseImpl
getHeaderFields, getHttpStatusCodeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.web.HeaderFieldsAccessor
getHeaderFieldsMethods inherited from interface org.refcodes.web.HttpClientResponse
getResponseMethods inherited from interface org.refcodes.web.HttpStatusCodeAccessor
getHttpStatusCode
-
Field Details
-
_mediaTypeFactoryLookup
-
-
Constructor Details
-
HttpClientResponseImpl
public HttpClientResponseImpl(Url aUrl, HttpStatusCode aHttpStatusCode, ResponseHeaderFields aHeaderFields, InputStream aHttpInputStream, MediaTypeFactoryLookup aMediaTypeFactoryLookup)Constructs aHttpClientResponsewith all required attributes.- Parameters:
aUrl- The URL from which the response originates.aHttpStatusCode- TheHttpStatusCodeof the response.aHeaderFields- TheResponseHeaderFieldssent by the response.aHttpInputStream- TheInputStreamrepresenting the request's HTTP body.aMediaTypeFactoryLookup- The lookup factory for retrieving the requiredMediaTypefactories.
-
-
Method Details
-
getResponse
This method's implementation supports theHttpBodyMapto unmarshal an HTTP Response-Body into anHttpBodyMapwhen providing theHttpBodyMapas response type.- Specified by:
getResponsein interfaceHttpClientResponse- Type Parameters:
RES- the generic type- Parameters:
aResponseType- the response type- Returns:
- the response
- Throws:
BadResponseException- the bad response exception
-
getHttpInputStream
Retrieves theInputStreamfrom the HTTPInputStreamproperty.- Specified by:
getHttpInputStreamin interfaceHttpInputStreamAccessor- Returns:
- The
InputStreamstored by theInputStreamproperty.
-
getHttpBody
Retrieves the HTTP body from the HTTP body property.- Specified by:
getHttpBodyin interfaceHttpBodyAccessor- Returns:
- The HTTP body stored by the HTTP body property.
-
getUrl
- Specified by:
getUrlin interfaceUrlAccessor- Returns:
- The Url stored by the
Urlproperty.
-
toString
-