- java.lang.Object
-
- org.refcodes.web.AbstractHttpRequest
-
- org.refcodes.web.HttpClientRequest
-
- org.refcodes.rest.RestRequest
-
- All Implemented Interfaces:
org.refcodes.mixin.Dumpable
,org.refcodes.web.HeaderFieldsAccessor<org.refcodes.web.RequestHeaderFields>
,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.HttpRequest
,org.refcodes.web.RedirectDepthAccessor
,org.refcodes.web.RedirectDepthAccessor.RedirectDepthMutator
,org.refcodes.web.RedirectDepthAccessor.RedirectDepthProperty
,org.refcodes.web.UrlAccessor
- Direct Known Subclasses:
RestRequestBuilder
public class RestRequest extends org.refcodes.web.HttpClientRequest implements org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsProperty<org.refcodes.web.RequestHeaderFields>, org.refcodes.mixin.Dumpable
ARestRequest
describes a REST request and theRestResponse
providing the response. TheRestRequest
describes theHttpMethod
to be used, the targeted URL, theHeaderFields
as well as the Query-Fields and the requestObject
orInputStream
.
-
-
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.HttpMethodProperty
-
Nested 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.RedirectDepthProperty
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RestRequest(RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, Object aRequest, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, Object aRequest, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aHeaderFields, Object aRequest, int aRedirectDepth, RestClient aRestClient)
Instantiates a new rest request builder impl.protected
RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aHeaderFields, Object aRequest, RestClient aRestClient)
Instantiates a new rest request builder impl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RestRequest
build(RestClient aRestClient)
This is a convenience method for easily instantiating the according builder.org.refcodes.web.HttpMethod
getHttpMethod()
org.refcodes.web.UrlBuilder
getUrl()
void
setHeaderFields(org.refcodes.web.RequestHeaderFields aHeaderFields)
RestResponse
toRestResponse()
Sends the request and returns synchronously the accordingRestResponse
.String
toString()
-
Methods inherited from class org.refcodes.web.HttpClientRequest
getRedirectDepth, getRequest, setRedirectDepth, setRequest, toHttpBody
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
RestRequest
protected RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.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
-
RestRequest
protected RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.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
-
RestRequest
protected RestRequest(RestClient aRestClient)
Instantiates a new rest request builder impl.- Parameters:
aRestClient
- the rest client
-
RestRequest
protected RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.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
-
RestRequest
protected RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.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
-
RestRequest
protected RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.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
-
RestRequest
protected RestRequest(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.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
-
build
public RestRequest build(RestClient aRestClient)
This is a convenience method for easily instantiating the according builder.- Parameters:
aRestClient
- the rest client- Returns:
- an instance (using a public implementation) of this builder
-
getUrl
public org.refcodes.web.UrlBuilder getUrl()
- Specified by:
getUrl
in interfaceorg.refcodes.web.UrlAccessor
- Overrides:
getUrl
in classorg.refcodes.web.AbstractHttpRequest
-
getHttpMethod
public org.refcodes.web.HttpMethod getHttpMethod()
- Specified by:
getHttpMethod
in interfaceorg.refcodes.web.HttpMethodAccessor
- Overrides:
getHttpMethod
in classorg.refcodes.web.AbstractHttpRequest
-
toString
public String toString()
- Overrides:
toString
in classorg.refcodes.web.HttpClientRequest
-
setHeaderFields
public void setHeaderFields(org.refcodes.web.RequestHeaderFields aHeaderFields)
- Specified by:
setHeaderFields
in interfaceorg.refcodes.web.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.web.RequestHeaderFields>
-
toRestResponse
public RestResponse toRestResponse() throws org.refcodes.web.HttpResponseException
Sends the request and returns synchronously the accordingRestResponse
.- Returns:
- the rest response
- Throws:
org.refcodes.web.HttpResponseException
- the http response exception
-
-