public class RestCallerBuilderImpl extends org.refcodes.net.HttpClientRequestImpl implements RestCallerBuilder
RestCallerBuilder
interface as good old
POJO for use by different RestClient
implementations.org.refcodes.mixin.LocatorAccessor.LocatorBuilder<T,B extends org.refcodes.mixin.LocatorAccessor.LocatorBuilder<T,B>>, org.refcodes.mixin.LocatorAccessor.LocatorMutator<T>, org.refcodes.mixin.LocatorAccessor.LocatorProperty<T>
org.refcodes.net.QueryFieldsAccessor.QueryFieldsBuilder<B extends org.refcodes.net.QueryFieldsAccessor.QueryFieldsBuilder<?>>, org.refcodes.net.QueryFieldsAccessor.QueryFieldsMutator, org.refcodes.net.QueryFieldsAccessor.QueryFieldsProperty
org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.net.HttpMethodAccessor.HttpMethodMutator, org.refcodes.net.HttpMethodAccessor.HttpMethodProperty
org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsBuilder<T extends org.refcodes.net.HeaderFields<?,?>,B extends org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsBuilder<T,B>>, org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsMutator<T extends org.refcodes.net.HeaderFields<?,?>>, org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsProperty<T extends org.refcodes.net.HeaderFields<?,?>>
org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.LinkComponent.LinkComponentBuilder<B extends org.refcodes.component.LinkComponent.LinkComponentBuilder<B>>
org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<B extends org.refcodes.component.Openable.OpenBuilder<B>>
Constructor and Description |
---|
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
org.refcodes.net.FormFields aQueryFields,
Object aRequest,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new rest caller builder impl.
|
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
org.refcodes.net.FormFields aQueryFields,
org.refcodes.net.RequestHeaderFields aHeaderFields,
Object aRequest,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new rest caller builder impl.
|
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
org.refcodes.net.FormFields aQueryFields,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new rest caller builder impl.
|
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
Object aRequest,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new rest caller builder impl.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
org.refcodes.component.ConnectionStatus |
getConnectionStatus() |
org.refcodes.net.HttpMethod |
getHttpMethod() |
String |
getLocator() |
RestResponseObserver |
getResponseObserver()
Retrieves the
RestResponseObserver to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method. |
void |
onResponse(RestResponseEvent aResponse)
The invoker provides a response context being a
RestResponseEvent
describing the response being processed upon by your
lambda 's code. |
void |
open() |
void |
setHeaderFields(org.refcodes.net.RequestHeaderFields aHeaderFields) |
void |
setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod) |
void |
setLocator(String aLocator) |
void |
setQueryFields(org.refcodes.net.FormFields aQueryFields) |
void |
setResponseObserver(RestResponseObserver aLambda)
Sets the
RestResponseObserver to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method. |
String |
toString() |
getRequest, setRequest, toHttpBody
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
withClose, withCloseIn, withCloseQuietly, withHeaderFields, withHttpMethod, withLocator, withOpen, withQueryFields, withRequest, withResponseObserver
getRequest, setRequest, toHttpBody
withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToQueryFields, withAddToQueryFields, withAddToQueryFields
public RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, String aLocator, org.refcodes.net.FormFields aQueryFields, org.refcodes.net.RequestHeaderFields aHeaderFields, Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
aHttpMethod
- the a http methodaLocator
- the a locatoraQueryFields
- the a query fieldsaHeaderFields
- the a Header-FieldsaRequest
- the a requestaResponseObserver
- the a response observeraMediaTypeFactoryLookup
- the a media type factory lookuppublic RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, String aLocator, org.refcodes.net.FormFields aQueryFields, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
aHttpMethod
- the a http methodaLocator
- the a locatoraQueryFields
- the a query fieldsaResponseObserver
- the a response observeraMediaTypeFactoryLookup
- the a media type factory lookuppublic RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, String aLocator, Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
aHttpMethod
- the a http methodaLocator
- the a locatoraRequest
- the a requestaResponseObserver
- the a response observeraMediaTypeFactoryLookup
- the a media type factory lookuppublic RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, String aLocator, org.refcodes.net.FormFields aQueryFields, Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
aHttpMethod
- the a http methodaLocator
- the a locatoraQueryFields
- the a query fieldsaRequest
- the a requestaResponseObserver
- the a response observeraMediaTypeFactoryLookup
- the a media type factory lookuppublic void onResponse(RestResponseEvent aResponse) throws org.refcodes.net.HttpResponseException
RestResponseObserver
RestResponseEvent
describing the response being processed upon by your
lambda
's code. The method works synchronously and waits
(blocks the caller's thread) till it finishes execution.onResponse
in interface RestResponseObserver
aResponse
- The response of type RestResponseEvent
describing the response context. Use
HttpClientResponse.getResponse(Class)
to retrieve the
server's response body or
HttpStatusCodeAccessor.getHttpStatusCode()
to retrieve the
respone's HTTP Status-Code.org.refcodes.net.HttpResponseException
- thrown by a HTTP-Response handling system
in case of some unexpected response.public String getLocator()
getLocator
in interface org.refcodes.mixin.LocatorAccessor<String>
getLocator
in class org.refcodes.net.HttpRequestImpl
public org.refcodes.net.HttpMethod getHttpMethod()
getHttpMethod
in interface org.refcodes.net.HttpMethodAccessor
getHttpMethod
in class org.refcodes.net.HttpRequestImpl
public void setLocator(String aLocator)
setLocator
in interface org.refcodes.mixin.LocatorAccessor.LocatorMutator<String>
public void setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod)
setHttpMethod
in interface org.refcodes.net.HttpMethodAccessor.HttpMethodMutator
public RestResponseObserver getResponseObserver()
RestCallerBuilder
RestResponseObserver
to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method.getResponseObserver
in interface RestCallerBuilder
RestResponseObserver
to handle
responses.public void setResponseObserver(RestResponseObserver aLambda)
RestCallerBuilder
RestResponseObserver
to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method.setResponseObserver
in interface RestCallerBuilder
aLambda
- The (user defined) RestResponseObserver
to handle
responses, feel free to code it as lambda
expression!public void open() throws org.refcodes.component.OpenException
open
in interface org.refcodes.component.Openable
org.refcodes.component.OpenException
public void close() throws org.refcodes.component.CloseException
close
in interface org.refcodes.component.Closable
org.refcodes.component.CloseException
public org.refcodes.component.ConnectionStatus getConnectionStatus()
getConnectionStatus
in interface org.refcodes.component.ConnectionStatusAccessor
public void setQueryFields(org.refcodes.net.FormFields aQueryFields)
setQueryFields
in interface org.refcodes.net.QueryFieldsAccessor.QueryFieldsMutator
public void setHeaderFields(org.refcodes.net.RequestHeaderFields aHeaderFields)
setHeaderFields
in interface org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.net.RequestHeaderFields>
Copyright © 2017. All rights reserved.