Class 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 the RestCallerBuilder interface as good old POJO for use by different RestClient 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
      • 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 interface org.refcodes.net.HttpClientRequest

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

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

        _headerFields, _httpMethod, _url
    • 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 according RestResponse.
      String toString​()
      • Methods inherited from interface org.refcodes.mixin.Dumpable

        toDump, toDump, toPrintable
      • 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 org.refcodes.net.HttpRequestImpl

        getHeaderFields
      • Methods inherited from interface org.refcodes.net.RedirectDepthAccessor

        getRedirectDepth
      • Methods inherited from interface org.refcodes.net.RedirectDepthAccessor.RedirectDepthMutator

        setRedirectDepth
    • 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 method
        aUrl - The Url from which to take the URL specific data.
        aHeaderFields - the Header-Fields
        aRequest - the request
        aRestClient - 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 method
        aUrl - The Url 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 method
        aUrl - The Url from which to take the URL specific data.
        aRequest - the request
        aRestClient - 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 method
        aUrl - The Url 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 of HttpStatusCode.isRedirectStatus(). A value of -1 represents the default behavior, e.g. using HttpURLConnection'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 method
        aUrl - The Url from which to take the URL specific data.
        aRequest - the request
        aRedirectDepth - The redirect depth provides the count of HTTP-Request and HTTP-Response cycles where the response represents a redirect as of HttpStatusCode.isRedirectStatus(). A value of -1 represents the default behavior, e.g. using HttpURLConnection'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 method
        aUrl - The Url from which to take the URL specific data.
        aHeaderFields - the Header-Fields
        aRequest - the request
        aRedirectDepth - The redirect depth provides the count of HTTP-Request and HTTP-Response cycles where the response represents a redirect as of HttpStatusCode.isRedirectStatus(). A value of -1 represents the default behavior, e.g. using HttpURLConnection's redirection means.
        aRestClient - the rest client
    • Method Detail

      • getUrl

        public org.refcodes.net.Url.UrlBuilder 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
      • 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
      • toString

        public String toString​()
        Overrides:
        toString in class org.refcodes.net.HttpClientRequestImpl
      • setHeaderFields

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

        public RestResponse toRestResponse​()
                                    throws org.refcodes.net.HttpResponseException
        Sends the request and returns synchronously the according RestResponse.
        Specified by:
        toRestResponse in interface RestRequestBuilder
        Returns:
        the rest response
        Throws:
        org.refcodes.net.HttpResponseException - the http response exception