java.lang.Object
org.refcodes.web.AbstractHttpRequest
org.refcodes.web.HttpClientRequest
org.refcodes.rest.RestRequest
org.refcodes.rest.RestRequestBuilder
- All Implemented Interfaces:
org.refcodes.mixin.Dumpable,org.refcodes.web.HeaderFieldsAccessor<org.refcodes.web.RequestHeaderFields>,org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsBuilder<org.refcodes.web.RequestHeaderFields,,RestRequestBuilder> org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.web.RequestHeaderFields>,org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsProperty<org.refcodes.web.RequestHeaderFields>,org.refcodes.web.HttpBodyAccessor.HttpBodyProvider<org.refcodes.web.BadRequestException>,org.refcodes.web.HttpMethodAccessor,org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestRequestBuilder>,org.refcodes.web.HttpMethodAccessor.HttpMethodMutator,org.refcodes.web.HttpMethodAccessor.HttpMethodProperty,org.refcodes.web.HttpRequest,org.refcodes.web.HttpRequestBuilder<RestRequestBuilder>,org.refcodes.web.RedirectDepthAccessor,org.refcodes.web.RedirectDepthAccessor.RedirectDepthBuilder<RestRequestBuilder>,org.refcodes.web.RedirectDepthAccessor.RedirectDepthMutator,org.refcodes.web.RedirectDepthAccessor.RedirectDepthProperty,org.refcodes.web.UrlAccessor,org.refcodes.web.UrlAccessor.UrlBuilder,org.refcodes.web.UrlAccessor.UrlMutator
public class RestRequestBuilder
extends RestRequest
implements org.refcodes.web.RedirectDepthAccessor.RedirectDepthBuilder<RestRequestBuilder>, org.refcodes.web.HttpRequestBuilder<RestRequestBuilder>, org.refcodes.web.HttpMethodAccessor.HttpMethodProperty, org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestRequestBuilder>, org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsBuilder<org.refcodes.web.RequestHeaderFields,RestRequestBuilder>
The implementation of the
RestResponseHandler interface as good old
POJO for use by different RestfulClient implementations.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.web.HeaderFieldsAccessor
org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsBuilder<T extends org.refcodes.web.HeaderFields<?,?>, B extends org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsBuilder<T, B>>, org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsMutator<T extends org.refcodes.web.HeaderFields<?, ?>>, org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsProperty<T extends org.refcodes.web.HeaderFields<?, ?>> Nested classes/interfaces inherited from interface org.refcodes.web.HttpMethodAccessor
org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.web.HttpMethodAccessor.HttpMethodMutator, org.refcodes.web.HttpMethodAccessor.HttpMethodPropertyNested classes/interfaces inherited from interface org.refcodes.web.RedirectDepthAccessor
org.refcodes.web.RedirectDepthAccessor.RedirectDepthBuilder<B extends org.refcodes.web.RedirectDepthAccessor.RedirectDepthBuilder<B>>, org.refcodes.web.RedirectDepthAccessor.RedirectDepthMutator, org.refcodes.web.RedirectDepthAccessor.RedirectDepthPropertyNested classes/interfaces inherited from interface org.refcodes.web.UrlAccessor
org.refcodes.web.UrlAccessor.UrlBuilder, org.refcodes.web.UrlAccessor.UrlMutator, org.refcodes.web.UrlAccessor.UrlProperty -
Field Summary
Fields inherited from class org.refcodes.web.HttpClientRequest
_mediaTypeFactoryLookup, DEFAULT_REDIRECT_DEPTHFields inherited from class org.refcodes.web.AbstractHttpRequest
_headerFields, _httpMethod, _url -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRestRequestBuilder(RestfulClient aRestClient) Instantiates a new rest request builder impl.protectedRestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, int aRedirectDepth, RestfulClient aRestClient) Instantiates a new rest request builder impl.protectedRestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, Object aRequest, int aRedirectDepth, RestfulClient aRestClient) Instantiates a new rest request builder impl.protectedRestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, Object aRequest, RestfulClient aRestClient) Instantiates a new rest request builder impl.protectedRestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, RestfulClient aRestClient) Instantiates a new rest request builder impl.protectedRestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aHeaderFields, Object aRequest, int aRedirectDepth, RestfulClient aRestClient) Instantiates a new rest request builder impl.protectedRestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aHeaderFields, Object aRequest, RestfulClient aRestClient) Instantiates a new rest request builder impl. -
Method Summary
Modifier and TypeMethodDescriptionbuild(RestfulClient aRestClient) This is a convenience method for easily instantiating the according builder.org.refcodes.web.HttpMethodorg.refcodes.web.UrlBuildergetUrl()voidsetHeaderFields(org.refcodes.web.RequestHeaderFields aHeaderFields) voidsetHttpMethod(org.refcodes.web.HttpMethod aHttpMethod) voidsetUrl(org.refcodes.web.Url aUrl) Sends the request and returns synchronously the accordingRestResponse.toString()withHeaderFields(org.refcodes.web.RequestHeaderFields aRequestHeaderFields) withHttpMethod(org.refcodes.web.HttpMethod aHttpMethod) withRedirectDepth(int aRedirectDepth) <REQ> RestRequestBuilderwithRequest(REQ aRequest) Sets the request for the request property.withUrl(org.refcodes.web.Url aUrl) Methods inherited from class org.refcodes.web.HttpClientRequest
getRedirectDepth, getRequest, setRedirectDepth, setRequest, toHttpBodyMethods inherited from class org.refcodes.web.AbstractHttpRequest
getHeaderFieldsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.mixin.Dumpable
toDump, toDumpMethods inherited from interface org.refcodes.web.HeaderFieldsAccessor
getHeaderFieldsMethods inherited from interface org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsProperty
letHeaderFieldsMethods inherited from interface org.refcodes.web.HttpMethodAccessor.HttpMethodProperty
letHttpMethodMethods inherited from interface org.refcodes.web.HttpRequestBuilder
withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToQueryFields, withAddToQueryFields, withAddToQueryFieldsMethods inherited from interface org.refcodes.web.RedirectDepthAccessor.RedirectDepthProperty
letRedirectDepth
-
Constructor Details
-
RestRequestBuilder
protected RestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aHeaderFields, Object aRequest, RestfulClient aRestClient) Instantiates a new rest request builder impl.- Parameters:
aHttpMethod- the http methodaUrl- TheUrlfrom which to take the URL specific data.aHeaderFields- the Header-FieldsaRequest- the requestaRestClient- the rest client
-
RestRequestBuilder
protected RestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, RestfulClient aRestClient) Instantiates a new rest request builder impl.- Parameters:
aHttpMethod- the http methodaUrl- TheUrlfrom which to take the URL specific data.aRestClient- the rest client
-
RestRequestBuilder
Instantiates a new rest request builder impl.- Parameters:
aRestClient- the rest client
-
RestRequestBuilder
protected RestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, Object aRequest, RestfulClient aRestClient) Instantiates a new rest request builder impl.- Parameters:
aHttpMethod- the http methodaUrl- TheUrlfrom which to take the URL specific data.aRequest- the requestaRestClient- the rest client
-
RestRequestBuilder
protected RestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, int aRedirectDepth, RestfulClient aRestClient) Instantiates a new rest request builder 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 the default behavior, e.g. usingHttpURLConnection's redirection means.aRestClient- the rest client
-
RestRequestBuilder
protected RestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, Object aRequest, int aRedirectDepth, RestfulClient aRestClient) Instantiates a new rest request builder 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 the default behavior, e.g. usingHttpURLConnection's redirection means.aRestClient- the rest client
-
RestRequestBuilder
protected RestRequestBuilder(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aHeaderFields, Object aRequest, int aRedirectDepth, RestfulClient aRestClient) Instantiates a new rest request builder 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 the default behavior, e.g. usingHttpURLConnection's redirection means.aRestClient- the rest client
-
-
Method Details
-
withUrl
- Specified by:
withUrlin interfaceorg.refcodes.web.UrlAccessor.UrlBuilder
-
withHttpMethod
- Specified by:
withHttpMethodin interfaceorg.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestRequestBuilder>
-
withRequest
Sets the request for the request property.- Type Parameters:
REQ- the generic type- Parameters:
aRequest- The request to be stored by the request property.- Returns:
- The builder for applying multiple build operations.
-
withHeaderFields
public RestRequestBuilder withHeaderFields(org.refcodes.web.RequestHeaderFields aRequestHeaderFields) - Specified by:
withHeaderFieldsin interfaceorg.refcodes.web.HeaderFieldsAccessor.HeaderFieldsBuilder<org.refcodes.web.RequestHeaderFields,RestRequestBuilder>
-
withRedirectDepth
- Specified by:
withRedirectDepthin interfaceorg.refcodes.web.RedirectDepthAccessor.RedirectDepthBuilder<RestRequestBuilder>
-
build
This is a convenience method for easily instantiating the according builder.- Overrides:
buildin classRestRequest- Parameters:
aRestClient- the rest client- Returns:
- an instance (using a public implementation) of this builder
-
getUrl
public org.refcodes.web.UrlBuilder getUrl()- Specified by:
getUrlin interfaceorg.refcodes.web.UrlAccessor- Overrides:
getUrlin classRestRequest
-
setUrl
public void setUrl(org.refcodes.web.Url aUrl) - Specified by:
setUrlin interfaceorg.refcodes.web.UrlAccessor.UrlMutator
-
getHttpMethod
public org.refcodes.web.HttpMethod getHttpMethod()- Specified by:
getHttpMethodin interfaceorg.refcodes.web.HttpMethodAccessor- Overrides:
getHttpMethodin classRestRequest
-
setHttpMethod
public void setHttpMethod(org.refcodes.web.HttpMethod aHttpMethod) - Specified by:
setHttpMethodin interfaceorg.refcodes.web.HttpMethodAccessor.HttpMethodMutator
-
toString
- Overrides:
toStringin classRestRequest
-
setHeaderFields
public void setHeaderFields(org.refcodes.web.RequestHeaderFields aHeaderFields) - Specified by:
setHeaderFieldsin interfaceorg.refcodes.web.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.web.RequestHeaderFields>- Overrides:
setHeaderFieldsin classRestRequest
-
toRestResponse
Sends the request and returns synchronously the accordingRestResponse.- Overrides:
toRestResponsein classRestRequest- Returns:
- the rest response
- Throws:
org.refcodes.web.HttpResponseException- the http response exception
-