Top Description Fields Constructors Methods
org.springframework.http.client.support

public abstract Class InterceptingHttpAccessor

extends HttpAccessor
Class Inheritance
Known Direct Subclasses
org.springframework.web.client.RestTemplate
Imports
java.util.ArrayList, .List, org.springframework.core.annotation.AnnotationAwareOrderComparator, org.springframework.http.client.ClientHttpRequestFactory, .ClientHttpRequestInterceptor, .InterceptingClientHttpRequestFactory, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils

Base class for org.springframework.web.client.RestTemplate and other HTTP accessing gateway helpers, adding interceptor-related properties to HttpAccessor's common properties.

Not intended to be used directly. See org.springframework.web.client.RestTemplate for an entry point.

Authors
Arjen Poutsma, Juergen Hoeller
Since
3.0
See Also
ClientHttpRequestInterceptor, InterceptingClientHttpRequestFactory, org.springframework.web.client.RestTemplate

Field Summary

Modifier and TypeField and Description
private volatile ClientHttpRequestFactory
private final List<ClientHttpRequestInterceptor>
Inherited from org.springframework.http.client.support.HttpAccessor:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public List<ClientHttpRequestInterceptor>
getInterceptors()

Get the request interceptors that this accessor uses.

public ClientHttpRequestFactory
public void
setInterceptors(List<ClientHttpRequestInterceptor> interceptors)

Set the request interceptors that this accessor should use.

public void
setRequestFactory(ClientHttpRequestFactory requestFactory)

Overrides org.springframework.http.client.support.HttpAccessor.setRequestFactory.

Set the request factory that this accessor uses for obtaining client request handles.

Inherited from org.springframework.http.client.support.HttpAccessor:
createRequestgetClientHttpRequestInitializerssetClientHttpRequestInitializers

Field Detail

interceptingRequestFactoryback to summary
private volatile ClientHttpRequestFactory interceptingRequestFactory
Annotations
@Nullable
interceptorsback to summary
private final List<ClientHttpRequestInterceptor> interceptors

Constructor Detail

InterceptingHttpAccessorback to summary
public InterceptingHttpAccessor()

Method Detail

getInterceptorsback to summary
public List<ClientHttpRequestInterceptor> getInterceptors()

Get the request interceptors that this accessor uses.

The returned List is active and may be modified. Note, however, that the interceptors will not be resorted according to their order before the ClientHttpRequestFactory is built.

getRequestFactoryback to summary
public ClientHttpRequestFactory getRequestFactory()

Overrides org.springframework.http.client.support.HttpAccessor.getRequestFactory.

Overridden to expose an InterceptingClientHttpRequestFactory if necessary.

Annotations
@Override
See Also
getInterceptors()
setInterceptorsback to summary
public void setInterceptors(List<ClientHttpRequestInterceptor> interceptors)

Set the request interceptors that this accessor should use.

The interceptors will get immediately sorted according to their order.

Note

This method does not support concurrent changes, and in most cases should not be called after initialization on startup. See also related note on org.springframework.web.client.RestTemplate regarding concurrent configuration changes.

See Also
getRequestFactory(), AnnotationAwareOrderComparator
setRequestFactoryback to summary
public void setRequestFactory(ClientHttpRequestFactory requestFactory)

Overrides org.springframework.http.client.support.HttpAccessor.setRequestFactory.

Doc from org.springframework.http.client.support.HttpAccessor.setRequestFactory.

Set the request factory that this accessor uses for obtaining client request handles.

The default is a SimpleClientHttpRequestFactory based on the JDK's own HTTP libraries (java.net.HttpURLConnection).

Note that the standard JDK HTTP library does not support the HTTP PATCH method. Configure the Apache HttpComponents or OkHttp request factory to enable PATCH.

Annotations
@Override