Search in sources :

Example 1 with InterceptingClientHttpRequestFactory

use of cn.taketoday.http.client.InterceptingClientHttpRequestFactory in project today-framework by TAKETODAY.

the class InterceptingHttpAccessor method getRequestFactory.

/**
 * Overridden to expose an {@link InterceptingClientHttpRequestFactory}
 * if necessary.
 *
 * @see #getInterceptors()
 */
@Override
public ClientHttpRequestFactory getRequestFactory() {
    if (!interceptors.isEmpty()) {
        ClientHttpRequestFactory factory = this.interceptingRequestFactory;
        if (factory == null) {
            synchronized (this) {
                factory = this.interceptingRequestFactory;
                if (factory == null) {
                    factory = new InterceptingClientHttpRequestFactory(super.getRequestFactory(), interceptors);
                    this.interceptingRequestFactory = factory;
                }
            }
        }
        return factory;
    } else {
        return super.getRequestFactory();
    }
}
Also used : ClientHttpRequestFactory(cn.taketoday.http.client.ClientHttpRequestFactory) InterceptingClientHttpRequestFactory(cn.taketoday.http.client.InterceptingClientHttpRequestFactory) InterceptingClientHttpRequestFactory(cn.taketoday.http.client.InterceptingClientHttpRequestFactory)

Example 2 with InterceptingClientHttpRequestFactory

use of cn.taketoday.http.client.InterceptingClientHttpRequestFactory in project today-infrastructure by TAKETODAY.

the class InterceptingHttpAccessor method getRequestFactory.

/**
 * Overridden to expose an {@link InterceptingClientHttpRequestFactory}
 * if necessary.
 *
 * @see #getInterceptors()
 */
@Override
public ClientHttpRequestFactory getRequestFactory() {
    if (!interceptors.isEmpty()) {
        ClientHttpRequestFactory factory = this.interceptingRequestFactory;
        if (factory == null) {
            synchronized (this) {
                factory = this.interceptingRequestFactory;
                if (factory == null) {
                    factory = new InterceptingClientHttpRequestFactory(super.getRequestFactory(), interceptors);
                    this.interceptingRequestFactory = factory;
                }
            }
        }
        return factory;
    } else {
        return super.getRequestFactory();
    }
}
Also used : ClientHttpRequestFactory(cn.taketoday.http.client.ClientHttpRequestFactory) InterceptingClientHttpRequestFactory(cn.taketoday.http.client.InterceptingClientHttpRequestFactory) InterceptingClientHttpRequestFactory(cn.taketoday.http.client.InterceptingClientHttpRequestFactory)

Aggregations

ClientHttpRequestFactory (cn.taketoday.http.client.ClientHttpRequestFactory)2 InterceptingClientHttpRequestFactory (cn.taketoday.http.client.InterceptingClientHttpRequestFactory)2