java.lang.Object
org.refcodes.web.AbstractHttpRequest
org.refcodes.web.HttpClientRequest
- All Implemented Interfaces:
HeaderFieldsAccessor<RequestHeaderFields>,HttpBodyAccessor.HttpBodyProvider<BadRequestException>,HttpMethodAccessor,HttpRequest,RedirectDepthAccessor,RedirectDepthAccessor.RedirectDepthMutator,RedirectDepthAccessor.RedirectDepthProperty,UrlAccessor
public class HttpClientRequest
extends AbstractHttpRequest
implements HttpRequest, HttpBodyAccessor.HttpBodyProvider<BadRequestException>, RedirectDepthAccessor.RedirectDepthProperty
Defines a
HttpClientRequest being the request as produced 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.HttpMethodAccessor
HttpMethodAccessor.HttpMethodBuilder<B extends HttpMethodAccessor.HttpMethodBuilder<B>>, HttpMethodAccessor.HttpMethodMutator, HttpMethodAccessor.HttpMethodPropertyNested classes/interfaces inherited from interface org.refcodes.web.RedirectDepthAccessor
RedirectDepthAccessor.RedirectDepthBuilder<B extends RedirectDepthAccessor.RedirectDepthBuilder<B>>, RedirectDepthAccessor.RedirectDepthMutator, RedirectDepthAccessor.RedirectDepthPropertyNested classes/interfaces inherited from interface org.refcodes.web.UrlAccessor
UrlAccessor.UrlBuilder, UrlAccessor.UrlMutator, UrlAccessor.UrlProperty -
Field Summary
FieldsFields inherited from class org.refcodes.web.AbstractHttpRequest
_headerFields, _httpMethod, _url -
Constructor Summary
ConstructorsConstructorDescriptionHttpClientRequest(HttpMethod aHttpMethod, Url aUrl, int aRedirectDepth, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Instantiates a new http client request impl.HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, Object aRequest, int aRedirectDepth, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Instantiates a new http client request impl.HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, Object aRequest, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Instantiates a new http client request impl.HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Instantiates a new http client request impl.HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, Object aRequest, int aRedirectDepth, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Instantiates a new http client request impl.HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, Object aRequest, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Instantiates a new http client request impl. -
Method Summary
Modifier and TypeMethodDescriptionintRetrieves the redirect depth from the redirect depth property.<REQ> REQRetrieves the request from the request property.voidsetRedirectDepth(int aRedirectDepth) Sets the redirect depth for the redirect depth property.<REQ> voidsetRequest(REQ aRequest) Sets the request for the request property.Automatically sets theContentTypeto theRequestHeaderFieldsretrieved fromAbstractHttpRequest.getHeaderFields().toString()Methods inherited from class org.refcodes.web.AbstractHttpRequest
getHeaderFields, getHttpMethod, getUrlMethods 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.HttpMethodAccessor
getHttpMethodMethods inherited from interface org.refcodes.web.RedirectDepthAccessor.RedirectDepthProperty
letRedirectDepthMethods inherited from interface org.refcodes.web.UrlAccessor
getUrl
-
Field Details
-
DEFAULT_REDIRECT_DEPTH
public static final int DEFAULT_REDIRECT_DEPTH- See Also:
-
_mediaTypeFactoryLookup
-
-
Constructor Details
-
HttpClientRequest
public HttpClientRequest(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
-
HttpClientRequest
public HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, 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
-
HttpClientRequest
public HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, 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
-
HttpClientRequest
public HttpClientRequest(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
-
HttpClientRequest
public HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, 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
-
HttpClientRequest
public HttpClientRequest(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, 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 keeps a redirect depth as used by default by underlying implementations.aMediaTypeFactoryLookup- the media type factory lookup
-
-
Method Details
-
getRequest
public <REQ> REQ getRequest()Retrieves the request from the request property.- Type Parameters:
REQ- the generic type- Returns:
- The request stored by the request property.
-
setRequest
public <REQ> void setRequest(REQ aRequest) Sets the request for the request property. ThesetRequest(Object)supports theHttpBodyMapto marshal anHttpBodyMapinto an HTTP Request-Body.- Type Parameters:
REQ- the generic type- Parameters:
aRequest- The request to be stored by the request property.
-
toHttpBody
Automatically sets theContentTypeto theRequestHeaderFieldsretrieved fromAbstractHttpRequest.getHeaderFields(). (seeHeaderFields.putContentType(org.refcodes.web.HttpMediaType)) Converts an object representing the HTTP body to aStringinstance. Automatically determines theContentTypefrom any headers when applicable.- Specified by:
toHttpBodyin interfaceHttpBodyAccessor.HttpBodyProvider<BadRequestException>- Returns:
- The converted
Stringinstance represented by the according object. - Throws:
BadRequestException
-
toString
-
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.
-