Package org.refcodes.net
Class HttpClientRequestImpl
- java.lang.Object
-
- org.refcodes.net.HttpRequestImpl
-
- org.refcodes.net.HttpClientRequestImpl
-
- All Implemented Interfaces:
HeaderFieldsAccessor<RequestHeaderFields>
,HttpBodyAccessor.HttpBodyProvider<BadRequestException>
,HttpClientRequest
,HttpMethodAccessor
,HttpRequest
,UrlAccessor
public class HttpClientRequestImpl extends HttpRequestImpl implements HttpClientRequest
The Class HttpClientRequestImpl.
-
-
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.HttpMethodAccessor
HttpMethodAccessor.HttpMethodBuilder<B extends HttpMethodAccessor.HttpMethodBuilder<B>>, HttpMethodAccessor.HttpMethodMutator, HttpMethodAccessor.HttpMethodProperty
-
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.HttpRequestImpl
_headerFields, _httpMethod, _url
-
-
Constructor Summary
Constructors Constructor Description HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, java.lang.Object aRequest, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, java.lang.Object aRequest, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <REQ> REQ
getRequest()
Gets the request.<REQ> void
setRequest(REQ aRequest)
Sets the request for the request property.java.lang.String
toHttpBody()
Automatically sets theContentType
to theRequestHeaderFields
retrieved fromHeaderFieldsAccessor.getHeaderFields()
.-
Methods inherited from interface org.refcodes.net.HeaderFieldsAccessor
getHeaderFields
-
Methods inherited from interface org.refcodes.net.HttpClientRequest
withRequest
-
Methods inherited from interface org.refcodes.net.HttpMethodAccessor
getHttpMethod
-
Methods inherited from class org.refcodes.net.HttpRequestImpl
getHeaderFields, getHttpMethod, getUrl
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.net.UrlAccessor
getUrl
-
-
-
-
Field Detail
-
_mediaTypeFactoryLookup
protected MediaTypeFactoryLookup _mediaTypeFactoryLookup
-
-
Constructor Detail
-
HttpClientRequestImpl
public HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from which to take the URL specific data.aMediaTypeFactoryLookup
- the media type factory lookup
-
HttpClientRequestImpl
public HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, java.lang.Object aRequest, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from which to take the URL specific data.aRequest
- the requestaMediaTypeFactoryLookup
- the media type factory lookup
-
HttpClientRequestImpl
public HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, java.lang.Object aRequest, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from which to take the URL specific data.aHeaderFields
- the Header-FieldsaRequest
- the requestaMediaTypeFactoryLookup
- the media type factory lookup
-
-
Method Detail
-
getRequest
public <REQ> REQ getRequest()
Gets the request.- Specified by:
getRequest
in interfaceHttpClientRequest
- Type Parameters:
REQ
- the generic type- Returns:
- the request
-
setRequest
public <REQ> void setRequest(REQ aRequest)
Sets the request for the request property. ThesetRequest(Object)
supports theHttpBodyMap
to marshal anHttpBodyMap
into an HTTP Request-Body.- Specified by:
setRequest
in interfaceHttpClientRequest
- Type Parameters:
REQ
- the generic type- Parameters:
aRequest
- The request to be stored by the request property.
-
toHttpBody
public java.lang.String toHttpBody() throws BadRequestException
Automatically sets theContentType
to theRequestHeaderFields
retrieved fromHeaderFieldsAccessor.getHeaderFields()
. (seeHeaderFields.putContentType(org.refcodes.net.HttpMediaType)
) Converts an object representing the HTTP body to aString
instance. Automatically determines theContentType
from any headers when applicable.- Specified by:
toHttpBody
in interfaceHttpBodyAccessor.HttpBodyProvider<BadRequestException>
- Specified by:
toHttpBody
in interfaceHttpClientRequest
- Returns:
- The converted
String
instance represented by the according object. - Throws:
BadRequestException
-
-