Class RestCallerBuilderImpl

  • All Implemented Interfaces:
    org.refcodes.component.Closable, org.refcodes.component.Closable.CloseBuilder<org.refcodes.component.LinkComponent.LinkComponentBuilder<RestCallerBuilder>>, org.refcodes.component.ConnectionStatusAccessor, org.refcodes.component.LinkComponent, org.refcodes.component.LinkComponent.LinkComponentBuilder<RestCallerBuilder>, org.refcodes.component.Openable, org.refcodes.component.Openable.OpenBuilder<org.refcodes.component.LinkComponent.LinkComponentBuilder<RestCallerBuilder>>, org.refcodes.net.HeaderFieldsAccessor<org.refcodes.net.RequestHeaderFields>, org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsBuilder<org.refcodes.net.RequestHeaderFields,RestCallerBuilder>, 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.BadRequestException>, org.refcodes.net.HttpClientRequest, org.refcodes.net.HttpMethodAccessor, org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<RestCallerBuilder>, org.refcodes.net.HttpMethodAccessor.HttpMethodMutator, org.refcodes.net.HttpMethodAccessor.HttpMethodProperty, org.refcodes.net.HttpRequest, org.refcodes.net.HttpRequestBuilder<RestCallerBuilder>, org.refcodes.net.QueryFieldsAccessor, org.refcodes.net.QueryFieldsAccessor.QueryFieldsMutator, org.refcodes.net.QueryFieldsAccessor.QueryFieldsProperty, org.refcodes.net.UrlAccessor, org.refcodes.net.UrlAccessor.UrlBuilder, org.refcodes.net.UrlAccessor.UrlMutator, RestCaller, RestCallerBuilder, RestResponseObserver

    public class RestCallerBuilderImpl
    extends org.refcodes.net.HttpClientRequestImpl
    implements RestCallerBuilder
    The implementation of the RestCallerBuilder interface as good old POJO for use by different RestClient implementations.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.component.Closable

        org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor

        org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
      • Nested classes/interfaces inherited from interface org.refcodes.net.HeaderFieldsAccessor

        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<?,?>>
      • 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.component.LinkComponent

        org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.LinkComponent.LinkComponentBuilder<B extends org.refcodes.component.LinkComponent.LinkComponentBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.Openable

        org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<B extends org.refcodes.component.Openable.OpenBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.net.QueryFieldsAccessor

        org.refcodes.net.QueryFieldsAccessor.QueryFieldsBuilder<B extends org.refcodes.net.QueryFieldsAccessor.QueryFieldsBuilder<?>>, org.refcodes.net.QueryFieldsAccessor.QueryFieldsMutator, org.refcodes.net.QueryFieldsAccessor.QueryFieldsProperty
      • Nested classes/interfaces inherited from interface org.refcodes.net.UrlAccessor

        org.refcodes.net.UrlAccessor.UrlBuilder, org.refcodes.net.UrlAccessor.UrlMutator, org.refcodes.net.UrlAccessor.UrlProperty
    • Field Summary

      • Fields inherited from class org.refcodes.net.HttpClientRequestImpl

        _mediaTypeFactoryLookup
      • Fields inherited from class org.refcodes.net.HttpRequestImpl

        _headerFields, _httpMethod, _url
    • Constructor Summary

      Constructors 
      Constructor Description
      RestCallerBuilderImpl​(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, java.lang.Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
      Instantiates a new rest caller builder impl.
      RestCallerBuilderImpl​(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aHeaderFields, java.lang.Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
      Instantiates a new rest caller builder impl.
      RestCallerBuilderImpl​(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
      Instantiates a new rest caller builder impl.
    • Constructor Detail

      • RestCallerBuilderImpl

        public RestCallerBuilderImpl​(org.refcodes.net.HttpMethod aHttpMethod,
                                     org.refcodes.net.Url aUrl,
                                     org.refcodes.net.RequestHeaderFields aHeaderFields,
                                     java.lang.Object aRequest,
                                     RestResponseObserver aResponseObserver,
                                     org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
        Instantiates a new rest caller builder impl.
        Parameters:
        aHttpMethod - the http method
        aUrl - The Url from which to take the URL specific data.
        aHeaderFields - the Header-Fields
        aRequest - the request
        aResponseObserver - the response observer
        aMediaTypeFactoryLookup - the media type factory lookup
      • RestCallerBuilderImpl

        public RestCallerBuilderImpl​(org.refcodes.net.HttpMethod aHttpMethod,
                                     org.refcodes.net.Url aUrl,
                                     RestResponseObserver aResponseObserver,
                                     org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
        Instantiates a new rest caller builder impl.
        Parameters:
        aHttpMethod - the http method
        aUrl - The Url from which to take the URL specific data.
        aResponseObserver - the response observer
        aMediaTypeFactoryLookup - the media type factory lookup
      • RestCallerBuilderImpl

        public RestCallerBuilderImpl​(org.refcodes.net.HttpMethod aHttpMethod,
                                     org.refcodes.net.Url aUrl,
                                     java.lang.Object aRequest,
                                     RestResponseObserver aResponseObserver,
                                     org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
        Instantiates a new rest caller builder impl.
        Parameters:
        aHttpMethod - the http method
        aUrl - The Url from which to take the URL specific data.
        aRequest - the request
        aResponseObserver - the response observer
        aMediaTypeFactoryLookup - the media type factory lookup
    • Method Detail

      • onResponse

        public void onResponse​(RestResponseEvent aResponse)
                        throws org.refcodes.net.HttpResponseException
        The invoker provides a response context being a 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.
        Specified by:
        onResponse in interface RestResponseObserver
        Parameters:
        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.
        Throws:
        org.refcodes.net.HttpResponseException - thrown by a HTTP-Response handling system in case of some unexpected response.
      • getHttpMethod

        public org.refcodes.net.HttpMethod getHttpMethod()
        Specified by:
        getHttpMethod in interface org.refcodes.net.HttpMethodAccessor
        Overrides:
        getHttpMethod in class org.refcodes.net.HttpRequestImpl
      • setHttpMethod

        public void setHttpMethod​(org.refcodes.net.HttpMethod aHttpMethod)
        Specified by:
        setHttpMethod in interface org.refcodes.net.HttpMethodAccessor.HttpMethodMutator
      • open

        public void open()
                  throws org.refcodes.component.OpenException
        Specified by:
        open in interface org.refcodes.component.Openable
        Throws:
        org.refcodes.component.OpenException
      • close

        public void close()
                   throws org.refcodes.component.CloseException
        Specified by:
        close in interface org.refcodes.component.Closable
        Throws:
        org.refcodes.component.CloseException
      • getConnectionStatus

        public org.refcodes.component.ConnectionStatus getConnectionStatus()
        Specified by:
        getConnectionStatus in interface org.refcodes.component.ConnectionStatusAccessor
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setHeaderFields

        public void setHeaderFields​(org.refcodes.net.RequestHeaderFields aHeaderFields)
        Specified by:
        setHeaderFields in interface org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.net.RequestHeaderFields>
      • getUrl

        public org.refcodes.net.Url getUrl()
        Specified by:
        getUrl in interface org.refcodes.net.UrlAccessor
        Overrides:
        getUrl in class org.refcodes.net.HttpRequestImpl
      • setUrl

        public void setUrl​(org.refcodes.net.Url aUrl)
        Specified by:
        setUrl in interface org.refcodes.net.UrlAccessor.UrlMutator