Class RestClientBuilder

  • Direct Known Subclasses:
    IServerRestClientBuilder

    public class RestClientBuilder
    extends java.lang.Object
    Builder pattern for creating a RestClient
    • Field Detail

      • url

        protected java.lang.String url
      • body

        protected java.lang.Object body
      • headers

        protected java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers
      • mediaType

        protected java.lang.String mediaType
      • isTLSEnabled

        protected boolean isTLSEnabled
      • connectTimeout

        protected java.lang.Integer connectTimeout
      • readTimeout

        protected java.lang.Integer readTimeout
    • Constructor Detail

      • RestClientBuilder

        public RestClientBuilder()
    • Method Detail

      • url

        public RestClientBuilder url​(java.lang.String url)
        Parameters:
        url -
        Returns:
      • body

        public RestClientBuilder body​(java.lang.String body)
        String as request body.
        Parameters:
        body - string
        Returns:
        builder
      • streamBody

        public RestClientBuilder streamBody​(java.io.InputStream inputStream)
        Input stream as request body.
        Parameters:
        inputStream - input stream
        Returns:
        builder
      • headers

        public RestClientBuilder headers​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers)
        Parameters:
        headers -
        Returns:
      • addheader

        public RestClientBuilder addheader​(java.lang.String key,
                                           java.lang.String value)
        adds individual header key-value
        Parameters:
        key -
        value -
        Returns:
      • mediaType

        public RestClientBuilder mediaType​(java.lang.String mediaType)
        Set media type using String value
        Parameters:
        mediaType - Any valid "accept" header value
        Returns:
      • connectTimeout

        public RestClientBuilder connectTimeout​(int connectTimeout)
        Set http connect timeout
        Parameters:
        connectTimeout -
        Returns:
      • readTimeout

        public RestClientBuilder readTimeout​(int readTimeout)
        Set http read timeout
        Parameters:
        readTimeout -
        Returns:
      • responseWrapper

        public RestClientBuilder responseWrapper​(SimpleResponseWrapper responseWrapper)
        Caller can provide its own implementation of SimpleResponseWrapper
        Parameters:
        responseWrapper -
        Returns:
      • toString

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