Interface WebClientRequestBuilder


  • public interface WebClientRequestBuilder
    Fluent API builder that is used by WebClient to create an outgoing request.
    • Method Detail

      • uri

        WebClientRequestBuilder uri​(String uri)
        String representation of request uri. Replaces baseUri defined in client builder.
        Parameters:
        uri - request uri
        Returns:
        updated builder instance
      • uri

        WebClientRequestBuilder uri​(URL url)
        Request URL. Replaces baseUri defined in client builder.
        Parameters:
        url - request url
        Returns:
        updated builder instance
      • uri

        WebClientRequestBuilder uri​(URI uri)
        Request URI. Replaces baseUri defined in client builder.
        Parameters:
        uri - request uri
        Returns:
        updated builder instance
      • skipUriEncoding

        WebClientRequestBuilder skipUriEncoding()
        Disables final uri encoding. This setting skips all parts of URI from encoding.
        Returns:
        updated builder instance
      • followRedirects

        WebClientRequestBuilder followRedirects​(boolean followRedirects)
        Sets if redirects should be followed at this request or not.
        Parameters:
        followRedirects - follow redirects
        Returns:
        updated builder instance
      • context

        WebClientRequestBuilder context​(Context context)
        Explicitly configure a context to use. This method is not needed when running within a scope of a Helidon server, such as Web Server, gRPC Server, MicroProfile Server, or when processing a Helidon message consumer.
        Parameters:
        context - context to be used by the outbound request, to look for security context, parent tracing span and similar
        Returns:
        updated builder instance
      • headers

        WebClientRequestHeaders headers()
        Get a (mutable) instance of outgoing headers.
        Returns:
        client request headers
      • queryParam

        WebClientRequestBuilder queryParam​(String name,
                                           String... values)
        Add a query parameter. Appends these query parameters to the query parameters defined in the request uri.
        Parameters:
        name - query name
        values - query value
        Returns:
        updated builder instance
      • proxy

        WebClientRequestBuilder proxy​(Proxy proxy)
        Override client proxy configuration.
        Parameters:
        proxy - request proxy
        Returns:
        updated builder instance
      • headers

        WebClientRequestBuilder headers​(Headers headers)
        Configure headers. Copy all headers from supplied Headers instance.
        Parameters:
        headers - to copy
        Returns:
        updated builder instance
      • headers

        WebClientRequestBuilder headers​(Function<WebClientRequestHeaders,​Headers> headers)
        Function from parameter is executed on top of stored headers. This approach is here to allow as to add any header via specialized method while using builder pattern.
        Parameters:
        headers - function which adds headers
        Returns:
        updated builder instance
      • queryParams

        WebClientRequestBuilder queryParams​(Parameters queryParams)
        Configure query parameters. Appends these query parameters to the query parameters defined in the request uri. Copy all query parameters from supplied Parameters instance.
        Parameters:
        queryParams - to copy
        Returns:
        updated builder instance
      • readerContext

        MessageBodyReaderContext readerContext()
        Returns reader context of the request builder.
        Returns:
        request reader context
      • writerContext

        MessageBodyWriterContext writerContext()
        Returns writer context of the request builder.
        Returns:
        request writer context
      • connectTimeout

        WebClientRequestBuilder connectTimeout​(long amount,
                                               TimeUnit unit)
        Sets new connection timeout for this request.
        Parameters:
        amount - amount of time
        unit - time unit
        Returns:
        updated builder instance
      • readTimeout

        WebClientRequestBuilder readTimeout​(long amount,
                                            TimeUnit unit)
        Sets new read timeout for this request.
        Parameters:
        amount - amount of time
        unit - time unit
        Returns:
        updated builder instance
      • fragment

        WebClientRequestBuilder fragment​(String fragment)
        Fragment of the request. Replaces fragment defined in the request uri.
        Parameters:
        fragment - request fragment
        Returns:
        updated builder instance
      • path

        WebClientRequestBuilder path​(HttpRequest.Path path)
        Path of the request. Appends this path to the path defined in the request uri.
        Parameters:
        path - path
        Returns:
        updated builder instance
      • path

        WebClientRequestBuilder path​(String path)
        Path of the request. Appends this path to the path defined in the request uri.
        Parameters:
        path - path
        Returns:
        updated builder instance
      • contentType

        WebClientRequestBuilder contentType​(MediaType contentType)
        Content type of the request.
        Parameters:
        contentType - content type
        Returns:
        updated builder instance
      • accept

        WebClientRequestBuilder accept​(MediaType... mediaTypes)
        Media types which are accepted in the response.
        Parameters:
        mediaTypes - media types
        Returns:
        updated builder instance
      • request

        <T> Single<T> request​(Class<T> responseType)
        Performs prepared request and transforms response to requested type. When transformation is done the returned CompletionStage is notified.
        Type Parameters:
        T - response type
        Parameters:
        responseType - requested response type
        Returns:
        request completion stage
      • request

        <T> Single<T> request​(GenericType<T> responseType)
        Performs prepared request and transforms response to requested type. When transformation is done the returned CompletionStage is notified.
        Type Parameters:
        T - response type
        Parameters:
        responseType - requested response type
        Returns:
        request completion stage
      • request

        Single<WebClientResponse> request()
        Performs prepared request without expecting to receive any specific type. Response is not converted and returned CompletionStage is notified.
        Returns:
        request completion stage
      • submit

        Single<WebClientResponse> submit()
        Performs prepared request. When response is received, it is not converted to any other specific type and returned CompletionStage is notified.
        Returns:
        request completion stage
      • submit

        <T> Single<T> submit​(Flow.Publisher<DataChunk> requestEntity,
                             Class<T> responseType)
        Performs prepared request and submitting request entity using Flow.Publisher. When response is received, it is converted to response type and returned CompletionStage is notified.
        Type Parameters:
        T - response type
        Parameters:
        requestEntity - request entity
        responseType - requested response type
        Returns:
        request completion stage
      • submit

        <T> Single<T> submit​(Object requestEntity,
                             Class<T> responseType)
        Performs prepared request and submitting request entity. When response is received, it is converted to response type and returned CompletionStage is notified.
        Type Parameters:
        T - response type
        Parameters:
        requestEntity - request entity
        responseType - requested response type
        Returns:
        request completion stage
      • submit

        Single<WebClientResponse> submit​(Object requestEntity)
        Performs prepared request and submitting request entity. When response is received, it is not converted to any other specific type and returned CompletionStage is notified.
        Parameters:
        requestEntity - request entity
        Returns:
        request completion stage