in finagle-http/src/main/scala/com/twitter/finagle/Http.scala [182:355]
protected def copy1(
stack: Stack[ServiceFactory[Request, Response]] = this.stack,
params: Stack.Params = this.params
): Client = copy(stack, params)
def withTls(hostname: String): Client = withTransport.tls(hostname)
def withTlsWithoutValidation: Client = withTransport.tlsWithoutValidation
/**
* Configures the sni hostname for SSL.
*
* @see [[https://docs.oracle.com/javase/8/docs/api/javax/net/ssl/SNIHostName.html Java's
* SNIHostName]] for more details.
*/
def withSni(hostname: String): Client = withTransport.sni(hostname)
/**
* For HTTP1*, configures the max size of headers
* For HTTP2, sets the MAX_HEADER_LIST_SIZE setting which is the maximum
* number of uncompressed bytes of header name/values.
* These may be set independently via the .configured API.
*/
def withMaxHeaderSize(size: StorageUnit): Client =
this
.configured(http.param.MaxHeaderSize(size))
.configured(http2.param.MaxHeaderListSize(size))
/**
* Configures the maximum initial line length the client can receive from a server.
*/
def withMaxInitialLineSize(size: StorageUnit): Client =
configured(http.param.MaxInitialLineSize(size))
/**
* Configures the maximum response size that client can receive.
*/
def withMaxResponseSize(size: StorageUnit): Client =
configured(http.param.MaxResponseSize(size))
/**
* Streaming allows applications to work with HTTP messages that have large
* (or infinite) content bodies.
*
* If `enabled` is set to `true`, the message content is available through a
* [[com.twitter.io.Reader]], which gives the application a handle to the byte stream.
*
* If `enabled` is set to `false`, the entire message content is buffered up to
* maximum allowed message size.
*/
def withStreaming(enabled: Boolean): Client =
configured(http.param.Streaming(enabled))
/**
* Streaming allows applications to work with HTTP messages that have large
* (or infinite) content bodies.
*
* This method configures `fixedLengthStreamedAfter` limit, which effectively turns on
* streaming (think `withStreaming(true)`). The `fixedLengthStreamedAfter`, however, disables
* streaming for sufficiently small messages of known fixed length.
*
* If `Content-Length` of a message does not exceed `fixedLengthStreamedAfter` it is
* buffered and its content is available through [[Request.content]] or
* [[Request.contentString]].
*
* Messages without `Content-Length` header are always streamed regardless of their
* actual content length and the `fixedLengthStreamedAfter` value.
*
* [[Response.isChunked]] should be used to determine whether a message is streamed
* (`isChunked == true`) or buffered (`isChunked == false`).
*/
def withStreaming(fixedLengthStreamedAfter: StorageUnit): Client =
configured(http.param.Streaming(fixedLengthStreamedAfter))
/**
* Enables decompression of http content bodies.
*/
def withDecompression(enabled: Boolean): Client =
configured(http.param.Decompression(enabled))
/**
* Enable the collection of HTTP specific metrics. See [[http.filter.StatsFilter]].
*/
def withHttpStats: Client =
withStack(stack.replace(http.filter.StatsFilter.role, http.filter.StatsFilter.module))
/**
* Enable HTTP/2
*
* @note this will override whatever has been set in the toggle.
*/
def withHttp2: Client =
configuredParams(Http2Params)
/**
* Disable HTTP/2
*
* @note this will override whatever has been set in the toggle.
*/
def withNoHttp2: Client =
configuredParams(Http11Params)
/**
* Enable kerberos client authentication for http requests
*/
def withKerberos(clientKerberosConfiguration: ClientKerberosConfiguration): Client = configured(
http.param.ClientKerberos(clientKerberosConfiguration))
/**
* Create a [[http.MethodBuilder]] for a given destination.
*
* @see [[https://twitter.github.io/finagle/guide/MethodBuilder.html user guide]]
*/
def methodBuilder(dest: String): http.MethodBuilder =
http.MethodBuilder.from(dest, this)
/**
* Create a [[http.MethodBuilder]] for a given destination.
*
* @see [[https://twitter.github.io/finagle/guide/MethodBuilder.html user guide]]
*/
def methodBuilder(dest: Name): http.MethodBuilder =
http.MethodBuilder.from(dest, this)
// Java-friendly forwarders
// See https://issues.scala-lang.org/browse/SI-8905
override val withSessionPool: finagle.param.SessionPoolingParams[Client] =
new finagle.param.SessionPoolingParams(this)
override val withLoadBalancer: finagle.param.DefaultLoadBalancingParams[Client] =
new finagle.param.DefaultLoadBalancingParams(this)
override val withSessionQualifier: finagle.param.SessionQualificationParams[Client] =
new finagle.param.SessionQualificationParams(this)
override val withAdmissionControl: finagle.param.ClientAdmissionControlParams[Client] =
new finagle.param.ClientAdmissionControlParams(this)
override val withSession: finagle.param.ClientSessionParams[Client] =
new finagle.param.ClientSessionParams(this)
override val withTransport: finagle.param.ClientTransportParams[Client] =
new finagle.param.ClientTransportParams(this)
override def withResponseClassifier(
responseClassifier: finagle.service.ResponseClassifier
): Client =
super.withResponseClassifier(responseClassifier)
override def withRetryBudget(budget: RetryBudget): Client = super.withRetryBudget(budget)
override def withRetryBackoff(backoff: Backoff): Client =
super.withRetryBackoff(backoff)
override def withLabel(label: String): Client = super.withLabel(label)
override def withStatsReceiver(statsReceiver: StatsReceiver): Client =
super.withStatsReceiver(statsReceiver)
override def withMonitor(monitor: Monitor): Client = super.withMonitor(monitor)
override def withTracer(tracer: Tracer): Client = super.withTracer(tracer)
override def withExceptionStatsHandler(exceptionStatsHandler: ExceptionStatsHandler): Client =
super.withExceptionStatsHandler(exceptionStatsHandler)
override def withRequestTimeout(timeout: Duration): Client = super.withRequestTimeout(timeout)
override def withStack(stack: Stack[ServiceFactory[Request, Response]]): Client =
super.withStack(stack)
override def withStack(
fn: Stack[ServiceFactory[Request, Response]] => Stack[ServiceFactory[Request, Response]]
): Client =
super.withStack(fn)
override def withExecutionOffloaded(executor: ExecutorService): Client =
super.withExecutionOffloaded(executor)
override def withExecutionOffloaded(pool: FuturePool): Client =
super.withExecutionOffloaded(pool)
override def configured[P](psp: (P, Stack.Param[P])): Client = super.configured(psp)
override def configuredParams(newParams: Stack.Params): Client =
super.configuredParams(newParams)
override def filtered(filter: Filter[Request, Response, Request, Response]): Client =
super.filtered(filter)
private def superNewClient(dest: Name, label0: String): ServiceFactory[Request, Response] = {
super.newClient(dest, label0)
}