Package org.refcodes.rest
Class RestRequestBuilderImpl
- java.lang.Object
-
- org.refcodes.net.HttpRequestImpl
-
- org.refcodes.net.HttpClientRequestImpl
-
- org.refcodes.rest.RestRequestBuilderImpl
-
- All Implemented Interfaces:
org.refcodes.mixin.Dumpable
,org.refcodes.net.HeaderFieldsAccessor<org.refcodes.net.RequestHeaderFields>
,org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsBuilder<org.refcodes.net.RequestHeaderFields,RestRequestBuilder>
,org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.net.RequestHeaderFields>
,org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsProperty<org.refcodes.net.RequestHeaderFields>
,org.refcodes.net.HttpBodyAccessor.HttpBodyProvider<org.refcodes.net.RequestHeaderFields>
,org.refcodes.net.HttpClientRequest
,org.refcodes.net.HttpClientRequest.HttpClientRequestBuilder
,org.refcodes.net.HttpMethodAccessor
,org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<org.refcodes.net.RequestHeaderFields>
,org.refcodes.net.HttpMethodAccessor.HttpMethodMutator
,org.refcodes.net.HttpMethodAccessor.HttpMethodProperty
,org.refcodes.net.HttpRequest
,org.refcodes.net.HttpRequestBuilder<org.refcodes.net.RequestHeaderFields>
,org.refcodes.net.RedirectDepthAccessor
,org.refcodes.net.RedirectDepthAccessor.RedirectDepthBuilder<org.refcodes.net.RequestHeaderFields>
,org.refcodes.net.RedirectDepthAccessor.RedirectDepthMutator
,org.refcodes.net.RedirectDepthAccessor.RedirectDepthProperty
,org.refcodes.net.UrlAccessor
,org.refcodes.net.UrlAccessor.UrlBuilder
,org.refcodes.net.UrlAccessor.UrlMutator
,RestRequest
,RestRequestBuilder
public class RestRequestBuilderImpl extends org.refcodes.net.HttpClientRequestImpl implements RestRequestBuilder
The implementation of theRestCallerBuilder
interface as good old POJO for use by differentRestClient
implementations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.net.HttpClientRequest
org.refcodes.net.HttpClientRequest.HttpClientRequestBuilder
-
Nested classes/interfaces inherited from interface org.refcodes.net.HttpMethodAccessor
org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.net.HttpMethodAccessor.HttpMethodMutator, org.refcodes.net.HttpMethodAccessor.HttpMethodProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.RedirectDepthAccessor
org.refcodes.net.RedirectDepthAccessor.RedirectDepthBuilder<B extends org.refcodes.net.RedirectDepthAccessor.RedirectDepthBuilder<B>>, org.refcodes.net.RedirectDepthAccessor.RedirectDepthMutator, org.refcodes.net.RedirectDepthAccessor.RedirectDepthProperty
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, Object aRequest, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, Object aRequest, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aHeaderFields, Object aRequest, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aHeaderFields, Object aRequest, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequestBuilderImpl(RestClient aRestClient)
Instantiates a new rest request builder impl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.refcodes.net.HttpMethod
getHttpMethod()
org.refcodes.net.Url.UrlBuilder
getUrl()
void
setHeaderFields(org.refcodes.net.RequestHeaderFields aHeaderFields)
void
setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod)
void
setUrl(org.refcodes.net.Url aUrl)
RestResponse
toRestResponse()
Sends the request and returns synchronously the accordingRestResponse
.String
toString()
-
Methods inherited from interface org.refcodes.net.HttpClientRequest
getRequest, setRequest, toHttpBody
-
Methods inherited from class org.refcodes.net.HttpClientRequestImpl
getRedirectDepth, getRequest, setRedirectDepth, setRequest, toHttpBody
-
Methods inherited from interface org.refcodes.net.HttpRequestBuilder
withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToQueryFields, withAddToQueryFields, withAddToQueryFields
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.net.RedirectDepthAccessor.RedirectDepthMutator
setRedirectDepth
-
Methods inherited from interface org.refcodes.rest.RestRequestBuilder
build, withHeaderFields, withHttpMethod, withRedirectDepth, withRequest, withUrl
-
-
-
-
Constructor Detail
-
RestRequestBuilderImpl
protected RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aHeaderFields, Object aRequest, RestClient aRestClient)
Instantiates a new rest request builder impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from which to take the URL specific data.aHeaderFields
- the Header-FieldsaRequest
- the requestaRestClient
- the rest client
-
RestRequestBuilderImpl
protected RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, RestClient aRestClient)
Instantiates a new rest request builder impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from which to take the URL specific data.aRestClient
- the rest client
-
RestRequestBuilderImpl
protected RestRequestBuilderImpl(RestClient aRestClient)
Instantiates a new rest request builder impl.- Parameters:
aRestClient
- the rest client
-
RestRequestBuilderImpl
protected RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, Object aRequest, RestClient aRestClient)
Instantiates a new rest request builder impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from which to take the URL specific data.aRequest
- the requestaRestClient
- the rest client
-
RestRequestBuilderImpl
protected RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from 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 the default behavior, e.g. usingHttpURLConnection
's redirection means.aRestClient
- the rest client
-
RestRequestBuilderImpl
protected RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, Object aRequest, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from 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 the default behavior, e.g. usingHttpURLConnection
's redirection means.aRestClient
- the rest client
-
RestRequestBuilderImpl
protected RestRequestBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aHeaderFields, Object aRequest, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.- Parameters:
aHttpMethod
- the http methodaUrl
- TheUrl
from 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 the default behavior, e.g. usingHttpURLConnection
's redirection means.aRestClient
- the rest client
-
-
Method Detail
-
getUrl
public org.refcodes.net.Url.UrlBuilder getUrl()
- Specified by:
getUrl
in interfaceorg.refcodes.net.UrlAccessor
- Overrides:
getUrl
in classorg.refcodes.net.HttpRequestImpl
-
setUrl
public void setUrl(org.refcodes.net.Url aUrl)
- Specified by:
setUrl
in interfaceorg.refcodes.net.UrlAccessor.UrlMutator
-
getHttpMethod
public org.refcodes.net.HttpMethod getHttpMethod()
- Specified by:
getHttpMethod
in interfaceorg.refcodes.net.HttpMethodAccessor
- Overrides:
getHttpMethod
in classorg.refcodes.net.HttpRequestImpl
-
setHttpMethod
public void setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod)
- Specified by:
setHttpMethod
in interfaceorg.refcodes.net.HttpMethodAccessor.HttpMethodMutator
-
toString
public String toString()
- Overrides:
toString
in classorg.refcodes.net.HttpClientRequestImpl
-
setHeaderFields
public void setHeaderFields(org.refcodes.net.RequestHeaderFields aHeaderFields)
- Specified by:
setHeaderFields
in interfaceorg.refcodes.net.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.net.RequestHeaderFields>
-
toRestResponse
public RestResponse toRestResponse() throws org.refcodes.net.HttpResponseException
Sends the request and returns synchronously the accordingRestResponse
.- Specified by:
toRestResponse
in interfaceRestRequestBuilder
- Returns:
- the rest response
- Throws:
org.refcodes.net.HttpResponseException
- the http response exception
-
-