Package org.refcodes.net
Class HttpClientRequestImpl
- java.lang.Object
-
- org.refcodes.net.HttpRequestImpl
-
- org.refcodes.net.HttpClientRequestImpl
-
- All Implemented Interfaces:
HeaderFieldsAccessor<RequestHeaderFields>,HttpBodyAccessor.HttpBodyProvider<RequestHeaderFields>,HttpClientRequest,HttpMethodAccessor,HttpRequest,RedirectDepthAccessor,RedirectDepthAccessor.RedirectDepthMutator,RedirectDepthAccessor.RedirectDepthProperty,UrlAccessor
public class HttpClientRequestImpl extends HttpRequestImpl implements HttpClientRequest
Implementation of theHttpClientRequestinterface.
-
-
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.HttpClientRequest
HttpClientRequest.HttpClientRequestBuilder
-
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.RedirectDepthAccessor
RedirectDepthAccessor.RedirectDepthBuilder<B extends RedirectDepthAccessor.RedirectDepthBuilder<B>>, RedirectDepthAccessor.RedirectDepthMutator, RedirectDepthAccessor.RedirectDepthProperty
-
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 interface org.refcodes.net.HttpClientRequest
DEFAULT_REDIRECT_DEPTH
-
Fields inherited from class org.refcodes.net.HttpRequestImpl
_headerFields, _httpMethod, _url
-
-
Constructor Summary
Constructors Constructor Description HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, int aRedirectDepth, MediaTypeFactoryLookup aMediaTypeFactoryLookup)Instantiates a new http client request impl.HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, java.lang.Object aRequest, int aRedirectDepth, MediaTypeFactoryLookup aMediaTypeFactoryLookup)Instantiates a new http client request impl.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, int aRedirectDepth, 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 intgetRedirectDepth()Retrieves the redirect depth from the redirect depth property.<REQ> REQgetRequest()Gets the request.voidsetRedirectDepth(int aRedirectDepth)Sets the redirect depth for the redirect depth property.<REQ> voidsetRequest(REQ aRequest)Sets the request for the request property.java.lang.StringtoHttpBody()Automatically sets theContentTypeto theRequestHeaderFieldsretrieved fromHeaderFieldsAccessor.getHeaderFields().java.lang.StringtoString()-
Methods inherited from interface org.refcodes.net.HeaderFieldsAccessor
getHeaderFields
-
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, 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- TheUrlfrom 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- TheUrlfrom 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- TheUrlfrom which to take the URL specific data.aHeaderFields- the Header-FieldsaRequest- the requestaMediaTypeFactoryLookup- the media type factory lookup
-
HttpClientRequestImpl
public HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, int aRedirectDepth, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.- Parameters:
aHttpMethod- the http methodaUrl- TheUrlfrom which to take the URL specific data.aRedirectDepth- The redirect depth provides the count of HTTP-Request and HTTP-Response cycles where the response represents a redirect as ofHttpStatusCode.isRedirectStatus(). A value of -1 represents a nearly infinite HTTP-Request and HTTP-Response cycle (infinite might mean a maximum of 256 cycle).aMediaTypeFactoryLookup- the media type factory lookup
-
HttpClientRequestImpl
public HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, java.lang.Object aRequest, int aRedirectDepth, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.- Parameters:
aHttpMethod- the http methodaUrl- TheUrlfrom which to take the URL specific data.aRequest- the requestaRedirectDepth- The redirect depth provides the count of HTTP-Request and HTTP-Response cycles where the response represents a redirect as ofHttpStatusCode.isRedirectStatus(). A value of -1 represents a nearly infinite HTTP-Request and HTTP-Response cycle (infinite might mean a maximum of 256 cycle).aMediaTypeFactoryLookup- the media type factory lookup
-
HttpClientRequestImpl
public HttpClientRequestImpl(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, java.lang.Object aRequest, int aRedirectDepth, MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new http client request impl.- Parameters:
aHttpMethod- the http methodaUrl- TheUrlfrom which to take the URL specific data.aHeaderFields- the Header-FieldsaRequest- the requestaRedirectDepth- The redirect depth provides the count of HTTP-Request and HTTP-Response cycles where the response represents a redirect as ofHttpStatusCode.isRedirectStatus(). A value of -1 represents a nearly infinite HTTP-Request and HTTP-Response cycle (infinite might mean a maximum of 256 cycle).aMediaTypeFactoryLookup- the media type factory lookup
-
-
Method Detail
-
getRequest
public <REQ> REQ getRequest()
Gets the request.- Specified by:
getRequestin 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 theHttpBodyMapto marshal anHttpBodyMapinto an HTTP Request-Body.- Specified by:
setRequestin 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 BadRequestExceptionAutomatically sets theContentTypeto theRequestHeaderFieldsretrieved fromHeaderFieldsAccessor.getHeaderFields(). (seeHeaderFields.putContentType(org.refcodes.net.HttpMediaType)) Converts an object representing the HTTP body to aStringinstance. Automatically determines theContentTypefrom any headers when applicable.- Specified by:
toHttpBodyin interfaceHttpBodyAccessor.HttpBodyProvider<RequestHeaderFields>- Specified by:
toHttpBodyin interfaceHttpClientRequest- Returns:
- The converted
Stringinstance represented by the according object. - Throws:
BadRequestException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getRedirectDepth
public int getRedirectDepth()
Retrieves the redirect depth from the redirect depth property.- Specified by:
getRedirectDepthin interfaceRedirectDepthAccessor- Returns:
- The redirect depth stored by the redirect depth property.
-
setRedirectDepth
public void setRedirectDepth(int aRedirectDepth)
Sets the redirect depth for the redirect depth property.- Specified by:
setRedirectDepthin interfaceRedirectDepthAccessor.RedirectDepthMutator- Parameters:
aRedirectDepth- The redirect depth to be stored by the redirect depth property.
-
-