c

wvlet.airframe.http.client

HttpClientConfig

case class HttpClientConfig(name: String = "default", backend: HttpClientBackend = Compat.defaultHttpClientBackend, requestFilter: (Request) ⇒ Request = identity, responseFilter: (Response) ⇒ Response = identity, rpcEncoding: RPCEncoding = RPCEncoding.JSON, retryContext: RetryContext = ..., codecFactory: MessageCodecFactory = ..., circuitBreaker: CircuitBreaker = ..., connectTimeout: Duration = Duration(90, TimeUnit.SECONDS), readTimeout: Duration = Duration(90, TimeUnit.SECONDS), clientFilter: RxHttpFilter = RxHttpFilter.identity, httpLoggerConfig: HttpLoggerConfig = ..., httpLoggerProvider: (HttpLoggerConfig) ⇒ HttpLogger = ..., loggingFilter: (HttpLogger) ⇒ HttpClientFilter = ..., useFetchAPI: Boolean = false, useHttp1: Boolean = false) extends HttpChannelConfig with Product with Serializable

A common immutable configuration for all HTTP clients in airframe-http. To modify any configuration, use withXXX methods.

The generated HTTP client has multiple layers of filters:

  • requestFilter: A filter to modify the request before sending it to the backend. This can be used for adding common HTTP headers (e.g., User-Agent, Authentication header, etc.)
  • clientFilter: A filter to modify the request/response.
  • loggingFilter: A filter to log individual requests and responses, including retried requests. The default behavior is logging each request with its response stats to log/http_client.json file.
  • responseFilter: A filter to modify the response before returning it to the caller.
Linear Supertypes
Serializable, Serializable, Product, Equals, HttpChannelConfig, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HttpClientConfig
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. HttpChannelConfig
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HttpClientConfig(name: String = "default", backend: HttpClientBackend = Compat.defaultHttpClientBackend, requestFilter: (Request) ⇒ Request = identity, responseFilter: (Response) ⇒ Response = identity, rpcEncoding: RPCEncoding = RPCEncoding.JSON, retryContext: RetryContext = ..., codecFactory: MessageCodecFactory = ..., circuitBreaker: CircuitBreaker = ..., connectTimeout: Duration = Duration(90, TimeUnit.SECONDS), readTimeout: Duration = Duration(90, TimeUnit.SECONDS), clientFilter: RxHttpFilter = RxHttpFilter.identity, httpLoggerConfig: HttpLoggerConfig = ..., httpLoggerProvider: (HttpLoggerConfig) ⇒ HttpLogger = ..., loggingFilter: (HttpLogger) ⇒ HttpClientFilter = ..., useFetchAPI: Boolean = false, useHttp1: Boolean = false)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. val backend: HttpClientBackend
  6. val circuitBreaker: CircuitBreaker
  7. val clientFilter: RxHttpFilter
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  9. val codecFactory: MessageCodecFactory
  10. val connectTimeout: Duration
    Definition Classes
    HttpClientConfigHttpChannelConfig
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  13. val httpLoggerConfig: HttpLoggerConfig
  14. val httpLoggerProvider: (HttpLoggerConfig) ⇒ HttpLogger
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. val loggingFilter: (HttpLogger) ⇒ HttpClientFilter
  17. val name: String
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. def newAsyncClient(serverAddress: String): AsyncClient
  20. def newHttpLogger(dest: ServerAddress): HttpLogger
  21. def newJSClient: AsyncClient

    Create a default Async client for Scala.js in web browsers

  22. def newLoggingFilter(logger: HttpLogger): HttpClientFilter
  23. def newSyncClient(serverAddress: String): SyncClient
  24. def noCircuitBreaker: HttpClientConfig
  25. def noClientFilter: HttpClientConfig

    Remove any client-side filter

  26. def noLogging: HttpClientConfig

    Disable http-client side logging

  27. def noRequestFilter: HttpClientConfig
  28. def noResponseFilter: HttpClientConfig
  29. def noRetry: HttpClientConfig
  30. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  31. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  32. val readTimeout: Duration
    Definition Classes
    HttpClientConfigHttpChannelConfig
  33. val requestFilter: (Request) ⇒ Request
  34. val responseFilter: (Response) ⇒ Response
  35. val retryContext: RetryContext
  36. val rpcEncoding: RPCEncoding
  37. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  38. val useFetchAPI: Boolean
  39. val useHttp1: Boolean
  40. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  42. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. def withBackend(newBackend: HttpClientBackend): HttpClientConfig
  44. def withCircuitBreaker(f: (CircuitBreaker) ⇒ CircuitBreaker): HttpClientConfig
  45. def withClientFilter(filter: RxHttpFilter): HttpClientConfig

    Add a new RxClientFilter.

    Add a new RxClientFilter. This filter is useful for adding a common error handling logic for the Rx[Response].

  46. def withCodecFactory(newCodecFactory: MessageCodecFactory): HttpClientConfig
  47. def withConnectTimeout(duration: Duration): HttpClientConfig
  48. def withDebugConsoleLogger: HttpClientConfig

    Use Debug Console http logging

  49. def withExtraLogEntries(extraEntryGenerator: () ⇒ Map[String, Any]): HttpClientConfig
  50. def withFetchAPI: HttpClientConfig
  51. def withHTTP1: HttpClientConfig

    Enforce using Http/1.1 if you experience GOAWAY error in HTTP/2

  52. def withHttpLogger(loggerProvider: (HttpLoggerConfig) ⇒ HttpLogger): HttpClientConfig
  53. def withJSONEncoding: HttpClientConfig
  54. def withLoggerConfig(f: (HttpLoggerConfig) ⇒ HttpLoggerConfig): HttpClientConfig

    Customize logger configuration

  55. def withMsgPackEncoding: HttpClientConfig
  56. def withName(name: String): HttpClientConfig
  57. def withRPCEncoding(newEncoding: RPCEncoding): HttpClientConfig
  58. def withReadTimeout(duration: Duration): HttpClientConfig
  59. def withRequestFilter(newRequestFilter: (Request) ⇒ Request): HttpClientConfig

    Add a custom request filter, e.g., for adding Authentication headers

  60. def withResponseFilter(newResponseFilter: (Response) ⇒ Response): HttpClientConfig

    Add a custom response filter to the last response, mostly for debugging purpose

  61. def withRetryContext(filter: (RetryContext) ⇒ RetryContext): HttpClientConfig

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from HttpChannelConfig

Inherited from AnyRef

Inherited from Any

Ungrouped