Class RequestBuilderBase<T extends RequestBuilderBase<T>>

    • Field Detail

      • DEFAULT_NAME_RESOLVER

        public static final io.netty.resolver.NameResolver<InetAddress> DEFAULT_NAME_RESOLVER
      • queryParams

        @Nullable
        protected @Nullable List<Param> queryParams
      • method

        protected String method
      • uri

        @Nullable
        protected @Nullable Uri uri
      • address

        @Nullable
        protected @Nullable InetAddress address
      • localAddress

        @Nullable
        protected @Nullable InetAddress localAddress
      • headers

        protected io.netty.handler.codec.http.HttpHeaders headers
      • cookies

        @Nullable
        protected @Nullable ArrayList<io.netty.handler.codec.http.cookie.Cookie> cookies
      • byteData

        protected byte @Nullable [] byteData
      • compositeByteData

        @Nullable
        protected @Nullable List<byte[]> compositeByteData
      • stringData

        @Nullable
        protected @Nullable String stringData
      • byteBufferData

        @Nullable
        protected @Nullable ByteBuffer byteBufferData
      • byteBufData

        @Nullable
        protected @Nullable io.netty.buffer.ByteBuf byteBufData
      • streamData

        @Nullable
        protected @Nullable InputStream streamData
      • bodyGenerator

        @Nullable
        protected @Nullable BodyGenerator bodyGenerator
      • formParams

        @Nullable
        protected @Nullable List<Param> formParams
      • bodyParts

        @Nullable
        protected @Nullable List<Part> bodyParts
      • virtualHost

        @Nullable
        protected @Nullable String virtualHost
      • proxyServer

        @Nullable
        protected @Nullable ProxyServer proxyServer
      • realm

        @Nullable
        protected @Nullable Realm realm
      • file

        @Nullable
        protected @Nullable File file
      • followRedirect

        @Nullable
        protected @Nullable Boolean followRedirect
      • requestTimeout

        @Nullable
        protected @Nullable Duration requestTimeout
      • readTimeout

        @Nullable
        protected @Nullable Duration readTimeout
      • rangeOffset

        protected long rangeOffset
      • charset

        @Nullable
        protected @Nullable Charset charset
      • nameResolver

        protected io.netty.resolver.NameResolver<InetAddress> nameResolver
      • contentTypeLocked

        protected boolean contentTypeLocked
    • Constructor Detail

      • RequestBuilderBase

        protected RequestBuilderBase​(String method,
                                     boolean disableUrlEncoding)
      • RequestBuilderBase

        protected RequestBuilderBase​(String method,
                                     boolean disableUrlEncoding,
                                     boolean validateHeaders)
      • RequestBuilderBase

        protected RequestBuilderBase​(Request prototype)
      • RequestBuilderBase

        protected RequestBuilderBase​(Request prototype,
                                     boolean disableUrlEncoding,
                                     boolean validateHeaders)
    • Method Detail

      • doContentTypeLock

        protected final void doContentTypeLock()
        Mark the Content-Type header as explicitly set by the user. When locked, the Content-Type header will not be modified by the client (e.g., charset addition).
      • resetContentTypeLock

        protected final void resetContentTypeLock()
        Clear the Content-Type lock, allowing the client to modify the Content-Type header if needed (for example, to add charset when it was auto-generated).
      • isContentTypeLocked

        protected final boolean isContentTypeLocked()
        Return whether the Content-Type header has been locked as explicitly set by the user.
      • setUrl

        public T setUrl​(String url)
      • setUri

        public T setUri​(Uri uri)
      • setLocalAddress

        public T setLocalAddress​(InetAddress address)
      • setVirtualHost

        public T setVirtualHost​(String virtualHost)
      • clearHeaders

        public T clearHeaders()
        Remove all added headers
        Returns:
        this
      • setHeader

        public T setHeader​(CharSequence name,
                           Object value)
        Set uni-value header for the request
        Parameters:
        name - header name
        value - header value to set
        Returns:
        this
      • setHeader

        public T setHeader​(CharSequence name,
                           Iterable<?> values)
        Set multi-values header for the request
        Parameters:
        name - header name
        values - Iterable with multiple header values to set
        Returns:
        this
      • addHeader

        public T addHeader​(CharSequence name,
                           Object value)
        Add a header value for the request. If a header with name was set up for this request already - call will add one more header value and convert it to multi-value header
        Parameters:
        name - header name
        value - header value to add
        Returns:
        this
      • addHeader

        public T addHeader​(CharSequence name,
                           Iterable<?> values)
        Add header values for the request. If a header with name was set up for this request already - call will add more header values and convert it to multi-value header
        Parameters:
        name - header name
        values - Iterable with multiple header values to add
        Returns:
      • setHeaders

        public T setHeaders​(io.netty.handler.codec.http.HttpHeaders headers)
      • setHeaders

        public T setHeaders​(Map<? extends CharSequence,​? extends Iterable<?>> headers)
        Set request headers using a map headers of pair (Header name, Header values) This method could be used to set up multivalued headers
        Parameters:
        headers - map of header names as the map keys and header values Iterable as the map values
        Returns:
        this
      • setSingleHeaders

        public T setSingleHeaders​(Map<? extends CharSequence,​?> headers)
        Set single-value request headers using a map headers of pairs (Header name, Header value). To set headers with multiple values use setHeaders(Map)
        Parameters:
        headers - map of header names as the map keys and header values as the map values
        Returns:
        this
      • setCookies

        public T setCookies​(Collection<io.netty.handler.codec.http.cookie.Cookie> cookies)
      • addCookie

        public T addCookie​(io.netty.handler.codec.http.cookie.Cookie cookie)
      • addOrReplaceCookie

        public T addOrReplaceCookie​(io.netty.handler.codec.http.cookie.Cookie cookie)
        Add/replace a cookie based on its name
        Parameters:
        cookie - the new cookie
        Returns:
        this
      • addCookieIfUnset

        public T addCookieIfUnset​(io.netty.handler.codec.http.cookie.Cookie cookie)
        Add a cookie based on its name, if it does not exist yet. Cookies that are already set will be ignored.
        Parameters:
        cookie - the new cookie
        Returns:
        this
      • resetCookies

        public void resetCookies()
      • resetQuery

        public void resetQuery()
      • resetFormParams

        public void resetFormParams()
      • resetNonMultipartData

        public void resetNonMultipartData()
      • resetMultipartData

        public void resetMultipartData()
      • setBody

        public T setBody​(File file)
      • setBody

        public T setBody​(byte[] data)
      • setBody

        public T setBody​(List<byte[]> data)
      • setBody

        public T setBody​(String data)
      • setBody

        public T setBody​(io.netty.buffer.ByteBuf data)
        Sets the request body from a Netty ByteBuf.

        Ownership: the caller retains ownership of data. AsyncHttpClient sends a retained duplicate per attempt (so redirects, auth replays and retries each get their own reference and the body survives across them) and never releases data itself. The caller is responsible for releasing data once the request has completed. (This differs from older releases, which consumed and released the buffer on the first send — and double-freed it on any retry.)

        Parameters:
        data - the request body; the caller keeps ownership and must release it after the request completes
        Returns:
        this builder
      • addQueryParam

        public T addQueryParam​(String name,
                               String value)
      • addQueryParams

        public T addQueryParams​(List<Param> params)
      • setQueryParams

        public T setQueryParams​(@Nullable
                                @Nullable List<Param> params)
      • addFormParam

        public T addFormParam​(String name,
                              String value)
      • setFormParams

        public T setFormParams​(@Nullable
                               @Nullable List<Param> params)
      • addBodyPart

        public T addBodyPart​(Part bodyPart)
      • setBodyParts

        public T setBodyParts​(List<Part> bodyParts)
      • setProxyServer

        public T setProxyServer​(ProxyServer proxyServer)
      • setRealm

        public T setRealm​(Realm realm)
      • setFollowRedirect

        public T setFollowRedirect​(boolean followRedirect)
      • setRequestTimeout

        public T setRequestTimeout​(Duration requestTimeout)
      • setReadTimeout

        public T setReadTimeout​(Duration readTimeout)
      • setRangeOffset

        public T setRangeOffset​(long rangeOffset)
      • setMethod

        public T setMethod​(String method)
      • setCharset

        public T setCharset​(Charset charset)
      • setNameResolver

        public T setNameResolver​(io.netty.resolver.NameResolver<InetAddress> nameResolver)
      • setSignatureCalculator

        public T setSignatureCalculator​(@Nullable
                                        @Nullable SignatureCalculator signatureCalculator)