Interface HttpHeadersCustomizer


  • public interface HttpHeadersCustomizer
    Allows programmatic customization of HTTP headers for requests sent by the Snowflake JDBC driver.

    Implementations can be registered with the driver (e.g., via SnowflakeBasicDataSource) to dynamically add headers. They define which requests to apply headers to, provide the headers, and specify if headers should regenerate on retries (e.g., for dynamic tokens).

    • Method Detail

      • applies

        boolean applies​(String method,
                        String uri,
                        Map<String,​List<String>> currentHeaders)
        Determines if this customizer should be applied to the given request context.
        Parameters:
        method - The HTTP method (e.g., "GET", "POST").
        uri - The target URI for the request.
        currentHeaders - A read-only view of headers already present before this customizer runs.
        Returns:
        true if newHeaders() should be called for this request, false otherwise.
      • newHeaders

        Map<String,​List<String>> newHeaders()
        Generates the custom headers to be added to the request.
        Returns:
        A Map where keys are header names and values are Lists of header values.
      • invokeOnce

        boolean invokeOnce()
        Indicates if newHeaders() should be called only once for the initial request attempt (true), or if it should be called again before each retry attempt (false).
        Returns:
        true for static headers, false for dynamic headers needing regeneration.