public class RestClientBuilder extends BeanContextBuilder
RestClient
class.
Instances of this class are created by the following methods:
Refer to the RestClient
javadocs for information on using this class.
Modifier | Constructor and Description |
---|---|
protected |
RestClientBuilder()
No-arg constructor.
|
protected |
RestClientBuilder(PropertyStore ps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
RestClientBuilder |
accept(Object value)
Sets the value for the
|
RestClientBuilder |
acceptCharset(Object value)
Sets the value for the
|
RestClientBuilder |
acceptEncoding(Object value)
Sets the value for the
|
RestClientBuilder |
acceptLanguage(Object value)
Sets the value for the
|
RestClientBuilder |
add(Map<String,Object> properties)
Adds multiple free-form configuration properties on this object without first clearing out any previous values.
|
RestClientBuilder |
addBeanTypes()
|
RestClientBuilder |
addInterceptorFirst(HttpRequestInterceptor itcp)
Adds this protocol interceptor to the head of the protocol processing list.
|
RestClientBuilder |
addInterceptorFirst(HttpResponseInterceptor itcp)
Adds this protocol interceptor to the head of the protocol processing list.
|
RestClientBuilder |
addInterceptorLast(HttpRequestInterceptor itcp)
Adds this protocol interceptor to the tail of the protocol processing list.
|
RestClientBuilder |
addInterceptorLast(HttpResponseInterceptor itcp)
Adds this protocol interceptor to the tail of the protocol processing list.
|
RestClientBuilder |
addRootType()
|
RestClientBuilder |
addTo(String name,
Object value)
Adds a free-form value to a SET property.
|
RestClientBuilder |
annotations(Annotation... values)
|
RestClientBuilder |
appendTo(String name,
Object value)
Adds a free-form value to the end of a LIST property.
|
RestClientBuilder |
apply(PropertyStore copyFrom)
Copies the settings from the specified property store into this builder.
|
RestClientBuilder |
applyAnnotations(AnnotationList al,
VarResolverSession r)
Applies a set of annotations to this property store.
|
RestClientBuilder |
applyAnnotations(Class<?>... fromClasses)
Applies any of the various
|
RestClientBuilder |
applyAnnotations(Method... fromMethods)
Applies any of the various
|
RestClientBuilder |
authorization(Object value)
Sets the value for the
|
RestClientBuilder |
backoffManager(BackoffManager backoffManager)
Assigns
BackoffManager instance. |
RestClientBuilder |
basicAuth(String host,
int port,
String user,
String pw)
Set up this client to use BASIC auth.
|
RestClientBuilder |
beanClassVisibility(Visibility value)
|
RestClientBuilder |
beanConstructorVisibility(Visibility value)
|
RestClientBuilder |
beanFieldVisibility(Visibility value)
|
RestClientBuilder |
beanInterceptor(Class<?> on,
Class<? extends BeanInterceptor<?>> value)
Bean interceptor.
|
RestClientBuilder |
beanMethodVisibility(Visibility value)
|
RestClientBuilder |
beansDontRequireSomeProperties()
|
RestClientBuilder |
beansRequireDefaultConstructor()
|
RestClientBuilder |
beansRequireSerializable()
|
RestClientBuilder |
beansRequireSettersForGetters()
|
RestClientBuilder |
bpi(Class<?> beanClass,
String properties)
Bean property includes.
|
RestClientBuilder |
bpi(Map<String,Object> values)
Bean property includes.
|
RestClientBuilder |
bpi(String beanClassName,
String properties)
Bean property includes.
|
RestClientBuilder |
bpro(Class<?> beanClass,
String properties)
Read-only bean properties.
|
RestClientBuilder |
bpro(Map<String,Object> values)
Read-only bean properties.
|
RestClientBuilder |
bpro(String beanClassName,
String properties)
Read-only bean properties.
|
RestClientBuilder |
bpwo(Class<?> beanClass,
String properties)
Write-only bean properties.
|
RestClientBuilder |
bpwo(Map<String,Object> values)
Write-only bean properties.
|
RestClientBuilder |
bpwo(String beanClassName,
String properties)
Write-only bean properties.
|
RestClientBuilder |
bpx(Class<?> beanClass,
String properties)
Bean property excludes.
|
RestClientBuilder |
bpx(Map<String,Object> values)
Bean property excludes.
|
RestClientBuilder |
bpx(String beanClassName,
String properties)
Bean property excludes.
|
RestClient |
build()
Build the object.
|
<T extends Context> |
build(Class<T> c)
Build a new instance of the specified object.
|
RestClientBuilder |
cacheControl(Object value)
Sets the value for the
|
RestClientBuilder |
callHandler(Class<? extends RestCallHandler> value)
|
RestClientBuilder |
callHandler(RestCallHandler value)
|
RestClientBuilder |
clientVersion(Object value)
Sets the client version by setting the value for the
|
RestClientBuilder |
connection(Object value)
Sets the value for the
|
RestClientBuilder |
connectionBackoffStrategy(ConnectionBackoffStrategy connectionBackoffStrategy)
Assigns
ConnectionBackoffStrategy instance. |
RestClientBuilder |
connectionManager(HttpClientConnectionManager connManager)
Assigns
HttpClientConnectionManager instance. |
RestClientBuilder |
connectionManagerShared(boolean shared)
Defines the connection manager is to be shared by multiple client instances.
|
RestClientBuilder |
connectionReuseStrategy(ConnectionReuseStrategy reuseStrategy)
Assigns
ConnectionReuseStrategy instance. |
RestClientBuilder |
connectionTimeToLive(long connTimeToLive,
TimeUnit connTimeToLiveTimeUnit)
Sets maximum time to live for persistent connections.
|
RestClientBuilder |
console(Class<? extends PrintStream> value)
|
RestClientBuilder |
console(PrintStream value)
|
RestClientBuilder |
contentDecoderRegistry(Map<String,InputStreamFactory> contentDecoderMap)
Assigns a map of
InputStreamFactories to be used for automatic content decompression. |
RestClientBuilder |
contentEncoding(Object value)
Sets the value for the
|
RestClientBuilder |
contentLength(Object value)
Sets the value for the
|
RestClientBuilder |
contentType(Object value)
Sets the value for the
|
protected HttpClientConnectionManager |
createConnectionManager()
Creates the
HttpClientConnectionManager returned by createConnectionManager() . |
protected CloseableHttpClient |
createHttpClient()
Creates an instance of an
HttpClient to be used to handle all HTTP communications with the target server. |
protected HttpClientBuilder |
createHttpClientBuilder()
Creates an instance of an
HttpClientBuilder to be used to create the HttpClient . |
RestClientBuilder |
date(Object value)
Sets the value for the
|
RestClientBuilder |
debug()
|
RestClientBuilder |
debugOutputLines(int value)
|
RestClientBuilder |
defaultAuthSchemeRegistry(Lookup<AuthSchemeProvider> authSchemeRegistry)
Assigns default
AuthScheme registry which will be used for request execution if not explicitly set in the client execution context. |
RestClientBuilder |
defaultConnectionConfig(ConnectionConfig config)
Assigns default
ConnectionConfig . |
RestClientBuilder |
defaultCookieSpecRegistry(Lookup<CookieSpecProvider> cookieSpecRegistry)
Assigns default
CookieSpec registry which will be used for request execution if not explicitly set in the client execution context. |
RestClientBuilder |
defaultCookieStore(CookieStore cookieStore)
Assigns default
CookieStore instance which will be used for request execution if not explicitly set in the client execution context. |
RestClientBuilder |
defaultCredentialsProvider(CredentialsProvider credentialsProvider)
Assigns default
CredentialsProvider instance which will be used for request execution if not explicitly set in the client execution context. |
RestClientBuilder |
defaultHeaders(Collection<? extends Header> defaultHeaders)
Assigns default request header values.
|
RestClientBuilder |
defaultRequestConfig(RequestConfig config)
Assigns default
RequestConfig instance which will be used for request execution if not explicitly set in the client execution context. |
RestClientBuilder |
defaultSocketConfig(SocketConfig config)
Assigns default
SocketConfig . |
RestClientBuilder |
detectRecursions()
|
RestClientBuilder |
dictionary(Object... values)
|
RestClientBuilder |
dictionaryOn(Class<?> on,
Class<?>... values)
|
RestClientBuilder |
disableAuthCaching()
Disables authentication scheme caching.
|
RestClientBuilder |
disableAutomaticRetries()
Disables automatic request recovery and re-execution.
|
RestClientBuilder |
disableConnectionState()
Disables connection state tracking.
|
RestClientBuilder |
disableContentCompression()
Disables automatic content decompression.
|
RestClientBuilder |
disableCookieManagement()
Disables state (cookie) management.
|
RestClientBuilder |
disableRedirectHandling()
Disables automatic redirect handling.
|
RestClientBuilder |
dontIgnorePropertiesWithoutSetters()
|
RestClientBuilder |
dontIgnoreTransientFields()
|
RestClientBuilder |
dontIgnoreUnknownNullBeanProperties()
|
RestClientBuilder |
dontUseInterfaceProxies()
|
RestClientBuilder |
errorCodes(Predicate<Integer> value)
|
RestClientBuilder |
evictExpiredConnections()
Makes this instance of
HttpClient proactively evict expired connections from the connection pool using a background thread. |
RestClientBuilder |
evictIdleConnections(long maxIdleTime,
TimeUnit maxIdleTimeUnit)
Makes this instance of
HttpClient proactively evict idle connections from the connection pool using a background thread. |
RestClientBuilder |
executorService(ExecutorService executorService,
boolean shutdownOnClose)
|
RestClientBuilder |
expect(Object value)
Sets the value for the
|
RestClientBuilder |
fluentSetters()
|
RestClientBuilder |
fluentSetters(Class<?> on)
|
RestClientBuilder |
formData(NameValuePair pair)
Adds a form-data parameter to all request bodies.
|
RestClientBuilder |
formData(String name,
Object value)
Adds a form-data parameter to all request bodies.
|
RestClientBuilder |
formData(String name,
Object value,
HttpPartSchema schema)
Adds a form-data parameter to all request bodies.
|
RestClientBuilder |
formData(String name,
Object value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Adds a form-data parameter to all request bodies.
|
RestClientBuilder |
formData(String name,
Supplier<?> value)
Adds a form-data parameter with a dynamic value to all request bodies.
|
RestClientBuilder |
formData(String name,
Supplier<?> value,
HttpPartSchema schema)
Adds a form-data parameter with a dynamic value to all request bodies.
|
RestClientBuilder |
formData(String name,
Supplier<?> value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Adds a form-data parameter with a dynamic value to all request bodies.
|
RestClientBuilder |
formDataPairs(Object... pairs)
Adds form-data parameters to all request bodies using free-form key/value pairs.
|
RestClientBuilder |
formDatas(Object... params)
Adds a form-data parameter to all request bodies.
|
RestClientBuilder |
forwarded(Object value)
Sets the value for the
|
RestClientBuilder |
from(Object value)
Sets the value for the
|
RestClientBuilder |
header(Header header)
Sets a header on all requests.
|
RestClientBuilder |
header(String name,
Object value)
Sets a header on all requests.
|
RestClientBuilder |
header(String name,
Object value,
HttpPartSchema schema)
Sets a header on all requests.
|
RestClientBuilder |
header(String name,
Object value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Sets a header on all requests.
|
RestClientBuilder |
header(String name,
Supplier<?> value)
Sets a header with a dynamic value on all requests.
|
RestClientBuilder |
header(String name,
Supplier<?> value,
HttpPartSchema schema)
Sets a header with a dynamic value on all requests.
|
RestClientBuilder |
header(String name,
Supplier<?> value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Sets a header with a dynamic value on all requests.
|
RestClientBuilder |
headerPairs(Object... pairs)
Sets multiple headers on all requests using freeform key/value pairs.
|
RestClientBuilder |
headers(Object... headers)
Sets multiple headers on all requests.
|
RestClientBuilder |
host(Object value)
Sets the value for the
|
RestClientBuilder |
html()
Convenience method for specifying HTML as the marshalling transmission media type.
|
RestClientBuilder |
htmlDoc()
Convenience method for specifying HTML DOC as the marshalling transmission media type.
|
RestClientBuilder |
htmlStrippedDoc()
Convenience method for specifying Stripped HTML DOC as the marshalling transmission media type.
|
RestClientBuilder |
httpClient(CloseableHttpClient value)
Sets the
HttpClient to be used to handle all HTTP communications with the target server. |
RestClientBuilder |
httpClientBuilder(HttpClientBuilder value)
|
RestClientBuilder |
httpProcessor(HttpProcessor httpprocessor)
Assigns
HttpProcessor instance. |
RestClientBuilder |
ifMatch(Object value)
Sets the value for the
|
RestClientBuilder |
ifModifiedSince(Object value)
Sets the value for the
|
RestClientBuilder |
ifNoneMatch(Object value)
Sets the value for the
|
RestClientBuilder |
ifRange(Object value)
Sets the value for the
|
RestClientBuilder |
ifUnmodifiedSince(Object value)
Sets the value for the
|
RestClientBuilder |
ignoreErrors()
|
RestClientBuilder |
ignoreErrors(boolean value)
|
RestClientBuilder |
ignoreInvocationExceptionsOnGetters()
|
RestClientBuilder |
ignoreInvocationExceptionsOnSetters()
|
RestClientBuilder |
ignoreRecursions()
|
RestClientBuilder |
ignoreUnknownBeanProperties()
|
RestClientBuilder |
implClass(Class<?> interfaceClass,
Class<?> implClass)
|
RestClientBuilder |
implClasses(Map<Class<?>,Class<?>> values)
|
RestClientBuilder |
initialDepth(int value)
|
RestClientBuilder |
interceptors(Class<?>... values)
|
RestClientBuilder |
interceptors(Object... value)
|
RestClientBuilder |
interfaceClass(Class<?> on,
Class<?> value)
Identifies a class to be used as the interface class for the specified class and all subclasses.
|
RestClientBuilder |
interfaces(Class<?>... value)
Identifies a set of interfaces.
|
RestClientBuilder |
json()
Convenience method for specifying JSON as the marshalling transmission media type.
|
RestClientBuilder |
keepAliveStrategy(ConnectionKeepAliveStrategy keepAliveStrategy)
Assigns
ConnectionKeepAliveStrategy instance. |
RestClientBuilder |
keepHttpClientOpen()
|
RestClientBuilder |
keepNullProperties()
|
RestClientBuilder |
leakDetection()
|
RestClientBuilder |
locale(Locale value)
|
RestClientBuilder |
logger(Logger value)
|
RestClientBuilder |
logRequests(DetailLevel detail,
Level level,
BiPredicate<RestRequest,RestResponse> test)
|
RestClientBuilder |
logToConsole()
|
RestClientBuilder |
marshall(Marshall value)
|
RestClientBuilder |
marshalls(Marshall... value)
|
RestClientBuilder |
maxConnPerRoute(int maxConnPerRoute)
Assigns maximum connection per route value.
|
RestClientBuilder |
maxConnTotal(int maxConnTotal)
Assigns maximum total connection value.
|
RestClientBuilder |
maxDepth(int value)
|
RestClientBuilder |
maxForwards(Object value)
Sets the value for the
|
RestClientBuilder |
maxIndent(int value)
|
RestClientBuilder |
mediaType(MediaType value)
|
RestClientBuilder |
msgPack()
Convenience method for specifying MessagePack as the marshalling transmission media type.
|
RestClientBuilder |
notBeanClasses(Object... values)
|
RestClientBuilder |
notBeanPackages(Object... values)
|
RestClientBuilder |
noTrace()
When called,
|
RestClientBuilder |
oapiCollectionFormat(HttpPartCollectionFormat value)
|
RestClientBuilder |
oapiFormat(HttpPartFormat value)
|
RestClientBuilder |
openApi()
Convenience method for specifying OpenAPI as the marshalling transmission media type.
|
RestClientBuilder |
origin(Object value)
Sets the value for the
|
RestClientBuilder |
paramFormat(ParamFormat value)
|
RestClientBuilder |
paramFormatPlain()
|
RestClientBuilder |
parser(Class<? extends Parser> value)
|
RestClientBuilder |
parser(Parser value)
|
RestClientBuilder |
parsers(Class<? extends Parser>... value)
|
RestClientBuilder |
parsers(Parser... value)
|
RestClientBuilder |
partParser(Class<? extends HttpPartParser> value)
|
RestClientBuilder |
partParser(HttpPartParser value)
|
RestClientBuilder |
partSerializer(Class<? extends HttpPartSerializer> value)
|
RestClientBuilder |
partSerializer(HttpPartSerializer value)
|
RestClientBuilder |
plainText()
Convenience method for specifying Plain Text as the marshalling transmission media type.
|
RestClientBuilder |
pooled()
When called, the
createConnectionManager() method will return a PoolingHttpClientConnectionManager
instead of a BasicHttpClientConnectionManager . |
RestClientBuilder |
pragma(Object value)
Sets the value for the
|
RestClientBuilder |
prependTo(String name,
Object value)
Adds a free-form value to the beginning of a LIST property.
|
RestClientBuilder |
propertyNamer(Class<?> on,
Class<? extends PropertyNamer> value)
Bean property namer
|
RestClientBuilder |
propertyNamer(Class<? extends PropertyNamer> value)
|
RestClientBuilder |
proxy(HttpHost proxy)
Assigns default proxy value.
|
RestClientBuilder |
proxyAuthenticationStrategy(AuthenticationStrategy proxyAuthStrategy)
Assigns
AuthenticationStrategy instance for proxy authentication. |
RestClientBuilder |
proxyAuthorization(Object value)
Sets the value for the
|
RestClientBuilder |
publicSuffixMatcher(PublicSuffixMatcher publicSuffixMatcher)
Assigns file containing public suffix matcher.
|
RestClientBuilder |
putAllTo(String name,
Object value)
Adds or overwrites multiple free-form entries in a MAP property.
|
RestClientBuilder |
putTo(String name,
String key,
Object value)
Adds or overwrites a free-form entry in a MAP property.
|
RestClientBuilder |
queries(Object... params)
Adds a query parameter to the URI.
|
RestClientBuilder |
query(NameValuePair pair)
Adds a query parameter to the URI.
|
RestClientBuilder |
query(String name,
Object value)
Adds a query parameter to the URI.
|
RestClientBuilder |
query(String name,
Object value,
HttpPartSchema schema)
Adds a query parameter to the URI.
|
RestClientBuilder |
query(String name,
Object value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Adds a query parameter to the URI.
|
RestClientBuilder |
query(String name,
Supplier<?> value)
Adds a query parameter with a dynamic value to the URI.
|
RestClientBuilder |
query(String name,
Supplier<?> value,
HttpPartSchema schema)
Adds a query parameter with a dynamic value to the URI.
|
RestClientBuilder |
query(String name,
Supplier<?> value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Adds a query parameter with a dynamic value to the URI.
|
RestClientBuilder |
queryPairs(Object... pairs)
Adds query parameters to the URI query using free-form key/value pairs.
|
RestClientBuilder |
quoteChar(char value)
|
RestClientBuilder |
range(Object value)
Sets the value for the
|
RestClientBuilder |
redirectStrategy(RedirectStrategy redirectStrategy)
Assigns
RedirectStrategy instance. |
RestClientBuilder |
referer(Object value)
Sets the value for the
|
RestClientBuilder |
removeFrom(String name,
Object value)
Removes a free-form value from a SET, LIST, or MAP property.
|
RestClientBuilder |
requestExecutor(HttpRequestExecutor requestExec)
Assigns
HttpRequestExecutor instance. |
RestClientBuilder |
retryHandler(HttpRequestRetryHandler retryHandler)
Assigns
HttpRequestRetryHandler instance. |
RestClientBuilder |
rootUri(Object value)
|
RestClientBuilder |
routePlanner(HttpRoutePlanner routePlanner)
Assigns
HttpRoutePlanner instance. |
RestClientBuilder |
schemePortResolver(SchemePortResolver schemePortResolver)
Assigns
SchemePortResolver instance. |
RestClientBuilder |
serializer(Class<? extends Serializer> value)
|
RestClientBuilder |
serializer(Serializer value)
|
RestClientBuilder |
serializers(Class<? extends Serializer>... value)
|
RestClientBuilder |
serializers(Serializer... value)
|
RestClientBuilder |
serviceUnavailableRetryStrategy(ServiceUnavailableRetryStrategy serviceUnavailStrategy)
Assigns
ServiceUnavailableRetryStrategy instance. |
RestClientBuilder |
set(Map<String,Object> properties)
Sets multiple free-form configuration properties on this object replacing all previous values.
|
RestClientBuilder |
set(String name,
Object value)
Sets a free-form configuration property on this object.
|
RestClientBuilder |
simpleJson()
Convenience method for specifying Simplified JSON as the marshalling transmission media type.
|
RestClientBuilder |
sortCollections()
|
RestClientBuilder |
sortMaps()
|
RestClientBuilder |
sortProperties()
|
RestClientBuilder |
sortProperties(Class<?>... on)
Sort bean properties.
|
RestClientBuilder |
sq()
|
RestClientBuilder |
sslContext(SSLContext sslContext)
Assigns
SSLContext instance. |
RestClientBuilder |
sslHostnameVerifier(HostnameVerifier hostnameVerifier)
Assigns
HostnameVerifier instance. |
RestClientBuilder |
sslSocketFactory(LayeredConnectionSocketFactory sslSocketFactory)
Assigns
LayeredConnectionSocketFactory instance. |
RestClientBuilder |
stopClass(Class<?> on,
Class<?> value)
Identifies a stop class for the annotated class.
|
RestClientBuilder |
strict()
|
RestClientBuilder |
swaps(Object... values)
|
RestClientBuilder |
targetAuthenticationStrategy(AuthenticationStrategy targetAuthStrategy)
Assigns
AuthenticationStrategy instance for target host authentication. |
RestClientBuilder |
te(Object value)
Sets the value for the
|
RestClientBuilder |
timeZone(TimeZone value)
|
RestClientBuilder |
trimEmptyCollections()
|
RestClientBuilder |
trimEmptyMaps()
|
RestClientBuilder |
trimStringsOnRead()
|
RestClientBuilder |
trimStringsOnWrite()
|
RestClientBuilder |
typeName(Class<?> on,
String value)
An identifying name for this class.
|
RestClientBuilder |
typePropertyName(Class<?> on,
String value)
|
RestClientBuilder |
typePropertyName(String value)
|
RestClientBuilder |
universal()
Convenience method for specifying all available transmission types.
|
RestClientBuilder |
uon()
Convenience method for specifying UON as the marshalling transmission media type.
|
RestClientBuilder |
upgrade(Object value)
Sets the value for the
|
RestClientBuilder |
uriContext(UriContext value)
|
RestClientBuilder |
uriRelativity(UriRelativity value)
|
RestClientBuilder |
uriResolution(UriResolution value)
|
RestClientBuilder |
urlEnc()
Convenience method for specifying URL-Encoding as the marshalling transmission media type.
|
RestClientBuilder |
useEnumNames()
|
RestClientBuilder |
useJavaBeanIntrospector()
|
RestClientBuilder |
userAgent(Object value)
Sets the value for the
|
RestClientBuilder |
userAgent(String userAgent)
Assigns
|
RestClientBuilder |
userTokenHandler(UserTokenHandler userTokenHandler)
Assigns
UserTokenHandler instance. |
RestClientBuilder |
useSystemProperties()
Use system properties when creating and configuring default implementations.
|
RestClientBuilder |
useWhitespace()
|
RestClientBuilder |
via(Object value)
Sets the value for the
|
RestClientBuilder |
warning(Object value)
Sets the value for the
|
RestClientBuilder |
ws()
|
RestClientBuilder |
xml()
Convenience method for specifying XML as the marshalling transmission media type.
|
beanDictionary, beanDictionary, beanDictionaryRemove, beanDictionaryRemove, beanDictionaryReplace, beanDictionaryReplace, beanFilters, beanFiltersRemove, beanFiltersReplace, beanMapPutReturnsOldValue, beanMapPutReturnsOldValue, beansRequireDefaultConstructor, beansRequireSerializable, beansRequireSettersForGetters, beansRequireSomeProperties, debug, example, exampleJson, excludeProperties, excludeProperties, excludeProperties, fluentSetters, ignoreInvocationExceptionsOnGetters, ignoreInvocationExceptionsOnSetters, ignorePropertiesWithoutSetters, ignoreTransientFields, ignoreUnknownBeanProperties, ignoreUnknownNullBeanProperties, includeProperties, includeProperties, includeProperties, pojoSwaps, pojoSwapsRemove, pojoSwapsReplace, sortProperties, useEnumNames, useInterfaceProxies, useJavaBeanIntrospector
getPropertyStore, getPropertyStoreBuilder, peek, peek
protected RestClientBuilder(PropertyStore ps)
ps
- Initial configuration properties for this builder.protected RestClientBuilder()
Provided so that this class can be easily subclassed.
public RestClient build()
ContextBuilder
build
in class BeanContextBuilder
public <T extends Context> T build(Class<T> c)
ContextBuilder
Creates a new instance of the specified context-based class, or an existing instance if one with the equivalent property store was already created.
build
in class ContextBuilder
c
- The subclass of Context
to instantiate.public RestClientBuilder json()
JsonSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
JsonParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as xml()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder simpleJson()
Simplified JSON is typically useful for automated tests because you can do simple string comparison of results without having to escape lots of quotes.
SimpleJsonSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
JsonParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as xml()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder xml()
XmlSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
XmlParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder html()
POJOs are converted to HTML without any sort of doc wrappers.
HtmlSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
HtmlParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder htmlDoc()
POJOs are converted to fully renderable HTML pages.
HtmlDocSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
HtmlParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder htmlStrippedDoc()
Same as htmlDoc()
but without the header and body tags and page title and description.
HtmlStrippedDocSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
HtmlParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder plainText()
Plain text marshalling typically only works on simple POJOs that can be converted to and from strings using swaps, swap methods, etc...
PlainTextSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
PlainTextParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder msgPack()
MessagePack is a binary equivalent to JSON that takes up considerably less space than JSON.
MsgPackSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
MsgPackParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder uon()
UON is Url-Encoding Object notation that is equivalent to JSON but suitable for transmission as URL-encoded query and form post values.
UonSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
UonParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder urlEnc()
UrlEncodingSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
RestRequest.formData(String, Object)
(and related) methods for constructing
the request body. Instead, the part serializer specified via partSerializer(Class)
is used.
UrlEncodingParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder openApi()
OpenAPI is a language that allows serialization to formats that use HttpPartSchema
objects to describe their structure.
OpenApiSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
RestRequest.body(Object, HttpPartSchema)
method will be used to specify the body of the request with the
schema describing it's structure.
OpenApiParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
RestResponseBody.schema(HttpPartSchema)
method will be used to specify the structure of the response body.
header(String,Object)
or accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
header(String,Object)
or contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as json()
to provide support for multiple languages.
Identical to calling
public RestClientBuilder universal()
All basic Juneau serializers will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
All basic Juneau parsers will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
header(String,Object)
or accept(Object)
, or per-request
via RestRequest.header(String,Object)
or RestRequest.accept(Object)
in order for the correct parser to be selected.
header(String,Object)
or contentType(Object)
,
or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
in order for the correct serializer to be selected.
Similar to calling
protected HttpClientBuilder createHttpClientBuilder()
HttpClientBuilder
to be used to create the HttpClient
.
Subclasses can override this method to provide their own client builder.
The builder can also be specified using the httpClientBuilder(HttpClientBuilder)
method.
public RestClientBuilder httpClientBuilder(HttpClientBuilder value)
HttpClientBuilder
that will be used to create the HttpClient
used by RestClient
.
This can be used to bypass the builder created by createHttpClientBuilder()
method.
value
- The HttpClientBuilder
that will be used to create the HttpClient
used by RestClient
.protected CloseableHttpClient createHttpClient()
HttpClient
to be used to handle all HTTP communications with the target server.
This HTTP client is used when the HTTP client is not specified through one of the constructors or the
httpClient(CloseableHttpClient)
method.
Subclasses can override this method to provide specially-configured HTTP clients to handle stuff such as SSL/TLS certificate handling, authentication, etc.
The default implementation returns an instance of HttpClient
using the client builder returned by
createHttpClientBuilder()
.
public RestClientBuilder httpClient(CloseableHttpClient value)
HttpClient
to be used to handle all HTTP communications with the target server.
This can be used to bypass the client created by createHttpClient()
method.
value
- The HttpClient
to be used to handle all HTTP communications with the target server.public RestClientBuilder logger(Logger value)
Specifies the logger to use for logging.
If not specified, uses the following logger:
Logger.
value
- The logger to use for logging.public RestClientBuilder logToConsole()
Specifies to log messages to the console.
public RestClientBuilder logRequests(DetailLevel detail, Level level, BiPredicate<RestRequest,RestResponse> test)
Causes requests/responses to be logged at the specified log level at the end of the request.
POST http://localhost:10000/testUrl, HTTP/1.1 200 OK
=== HTTP Call (outgoing) ======================================================= === REQUEST === POST http://localhost:10000/testUrl ---request headers--- Debug: true No-Trace: true Accept: application/json ---request entity--- Content-Type: application/json ---request content--- {"foo":"bar","baz":123} === RESPONSE === HTTP/1.1 200 OK ---response headers--- Content-Type: application/json;charset=utf-8 Content-Length: 21 Server: Jetty(8.1.0.v20120127) ---response content--- {"message":"OK then"} === END ========================================================================
By default, the message is logged to the default logger. It can be logged to a different logger via the
logger(Logger)
method or logged to the console using the
logToConsole()
method.
detail
- The detail level of logging.level
- The log level.test
- A predicate to use per-request to see if the request should be logged. If protected HttpClientConnectionManager createConnectionManager()
HttpClientConnectionManager
returned by createConnectionManager()
.
Subclasses can override this method to provide their own connection manager.
The default implementation returns an instance of a PoolingHttpClientConnectionManager
if pooled()
was called or BasicHttpClientConnectionManager
if not..
public RestClientBuilder pooled()
createConnectionManager()
method will return a PoolingHttpClientConnectionManager
instead of a BasicHttpClientConnectionManager
.
public RestClientBuilder basicAuth(String host, int port, String user, String pw)
host
- The auth scope hostname.port
- The auth scope port.user
- The username.pw
- The password.public RestClientBuilder header(String name, Object value, HttpPartSchema schema, HttpPartSerializer serializer)
String[]
name
- The header name.value
- The header value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
serializer
- The serializer to use for serializing the value to a string.
HttpPartSerializer
defined on the client is used (OpenApiSerializer
by default).
public RestClientBuilder header(String name, Supplier<?> value, HttpPartSchema schema, HttpPartSerializer serializer)
String[]
name
- The header name.value
- The header value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
serializer
- The serializer to use for serializing the value to a string.
HttpPartSerializer
defined on the client is used (OpenApiSerializer
by default).
public RestClientBuilder header(String name, Object value, HttpPartSchema schema)
String[]
name
- The header name.value
- The header value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public RestClientBuilder header(String name, Supplier<?> value, HttpPartSchema schema)
String[]
name
- The header name.value
- The header value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public RestClientBuilder header(String name, Object value)
RestClient
name
- The header name.value
- The header value.
public RestClientBuilder header(String name, Supplier<?> value)
RestClient
name
- The header name.value
- The header value supplier.
public RestClientBuilder header(Header header)
RestClient
header
- The header to set.public RestClientBuilder headers(Object... headers)
RestClient
headers
- The header to set.
Header
(including any subclasses such as Accept
)
Headerable
Map.Entry
HeaderSupplier
Map
public RestClientBuilder headerPairs(Object... pairs)
RestClient
pairs
- The header key/value pairs.
public RestClientBuilder accept(Object value)
This overrides the media type specified on the parser, but is overridden by calling
header(
value
- The new header value.public RestClientBuilder acceptCharset(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder acceptEncoding(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder acceptLanguage(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder authorization(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder cacheControl(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder clientVersion(Object value)
value
- The version string (e.g. public RestClientBuilder connection(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder contentLength(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder contentType(Object value)
This overrides the media type specified on the serializer, but is overridden by calling
header(
value
- The new header value.public RestClientBuilder contentEncoding(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder date(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder expect(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder forwarded(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder from(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder host(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder ifMatch(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder ifModifiedSince(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder ifNoneMatch(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder ifRange(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder ifUnmodifiedSince(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder maxForwards(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder noTrace()
This gives the opportunity for the servlet to not log errors on invalid requests. This is useful for testing purposes when you don't want your log file to show lots of errors that are simply the results of testing.
public RestClientBuilder origin(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder pragma(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder proxyAuthorization(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder range(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder referer(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder te(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder userAgent(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder upgrade(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder via(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder warning(Object value)
This is a shortcut for calling header(
value
- The new header value.public RestClientBuilder query(String name, Object value, HttpPartSchema schema, HttpPartSerializer serializer)
String[]
name
- The parameter name.value
- The parameter value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
serializer
- The serializer to use for serializing the value to a string.
HttpPartSerializer
defined on the client is used (OpenApiSerializer
by default).
public RestClientBuilder query(String name, Supplier<?> value, HttpPartSchema schema, HttpPartSerializer serializer)
String[]
name
- The parameter name.value
- The parameter value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
serializer
- The serializer to use for serializing the value to a string.
HttpPartSerializer
defined on the client is used (OpenApiSerializer
by default).
public RestClientBuilder query(String name, Object value, HttpPartSchema schema)
String[]
name
- The parameter name.value
- The parameter value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public RestClientBuilder query(String name, Supplier<?> value, HttpPartSchema schema)
String[]
name
- The parameter name.value
- The parameter value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public RestClientBuilder query(String name, Object value)
RestClient
name
- The parameter name.value
- The parameter value.
public RestClientBuilder query(NameValuePair pair)
RestClient
pair
- The query parameter.public RestClientBuilder query(String name, Supplier<?> value)
RestClient
name
- The parameter name.value
- The parameter value supplier.
public RestClientBuilder queries(Object... params)
RestClient
params
- The query parameters.
NameValuePair
NameValuePairable
Map.Entry
NameValuePairSupplier
Map
public RestClientBuilder queryPairs(Object... pairs)
RestClient
pairs
- The query key/value pairs.
public RestClientBuilder formData(String name, Object value, HttpPartSchema schema, HttpPartSerializer serializer)
String[]
name
- The parameter name.value
- The parameter value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
serializer
- The serializer to use for serializing the value to a string.
HttpPartSerializer
defined on the client is used (OpenApiSerializer
by default).
public RestClientBuilder formData(String name, Supplier<?> value, HttpPartSchema schema, HttpPartSerializer serializer)
String[]
name
- The parameter name.value
- The parameter value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
serializer
- The serializer to use for serializing the value to a string.
HttpPartSerializer
defined on the client is used (OpenApiSerializer
by default).
public RestClientBuilder formData(String name, Object value, HttpPartSchema schema)
String[]
name
- The parameter name.value
- The parameter value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public RestClientBuilder formData(String name, Supplier<?> value, HttpPartSchema schema)
String[]
name
- The parameter name.value
- The parameter value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public RestClientBuilder formData(String name, Object value)
RestClient
name
- The parameter name.value
- The parameter value.
public RestClientBuilder formData(NameValuePair pair)
RestClient
pair
- The form data parameter.public RestClientBuilder formData(String name, Supplier<?> value)
RestClient
name
- The parameter name.value
- The parameter value supplier.
public RestClientBuilder formDatas(Object... params)
RestClient
params
- The form-data parameters.
NameValuePair
NameValuePairable
Map.Entry
NameValuePairSupplier
Map
public RestClientBuilder formDataPairs(Object... pairs)
RestClient
pairs
- The form-data key/value pairs.
public RestClientBuilder callHandler(Class<? extends RestCallHandler> value)
Allows you to provide a custom handler for making HTTP calls.
RestClient.run(HttpHost, HttpRequest, HttpContext)
method can also be overridden to produce the same results.
value
- The new value for this setting.
public RestClientBuilder callHandler(RestCallHandler value)
Allows you to provide a custom handler for making HTTP calls.
RestClient.run(HttpHost, HttpRequest, HttpContext)
method can also be overridden to produce the same results.
value
- The new value for this setting.
public RestClientBuilder console(Class<? extends PrintStream> value)
Allows you to redirect the console output to a different print stream.
value
- The new value for this setting.public RestClientBuilder console(PrintStream value)
Allows you to redirect the console output to a different print stream.
value
- The new value for this setting.public RestClientBuilder errorCodes(Predicate<Integer> value)
Defines a predicate to test for error codes.
value
- The new value for this setting.
x -> x >= 400
.public RestClientBuilder executorService(ExecutorService executorService, boolean shutdownOnClose)
Defines the executor service to use when calling future methods on the RestRequest
class.
This executor service is used to create Future
objects on the following methods:
RestRequest.runFuture()
RestRequest.completeFuture()
RestResponseBody.asFuture(Class)
(and similar methods)
The default executor service is a single-threaded ThreadPoolExecutor
with a 30 second timeout
and a queue size of 10.
executorService
- The executor service.shutdownOnClose
- Call ExecutorService.shutdown()
when RestClient.close()
is called.public RestClientBuilder keepHttpClientOpen()
Don't close this client when the RestClient.close()
method is called.
public RestClientBuilder ignoreErrors()
When enabled, HTTP error response codes (e.g. RestCallException
to
be thrown.
Note that this is equivalent to
public RestClientBuilder ignoreErrors(boolean value)
When enabled, HTTP error response codes (e.g. RestCallException
to
be thrown.
Note that this is equivalent to
value
- The new value for this property.public RestClientBuilder interceptors(Class<?>... values) throws Exception
Adds an interceptor that can be called to hook into specified events in the lifecycle of a single request.
RestClient.onInit(RestRequest)
, RestClient.onConnect(RestRequest,RestResponse)
, and
RestClient.onClose(RestRequest,RestResponse)
methods can also be overridden to produce the same results.
values
- The values to add to this setting.
Exception
- If one or more interceptors could not be created.public RestClientBuilder interceptors(Object... value)
Adds an interceptor that gets called immediately after a connection is made.
RestClient.onInit(RestRequest)
, RestClient.onConnect(RestRequest,RestResponse)
, and
RestClient.onClose(RestRequest,RestResponse)
methods can also be overridden to produce the same results.
value
- The values to add to this setting.
public RestClientBuilder leakDetection()
Enable client and request/response leak detection.
Causes messages to be logged to the console if clients or request/response objects are not properly closed
when the
Automatically enabled with Context.CONTEXT_debug
.
public RestClientBuilder marshall(Marshall value)
Shortcut for specifying the RestClient.RESTCLIENT_serializers
and RestClient.RESTCLIENT_parsers
using the serializer and parser defined in a marshall.
sortCollections()
),
parser property setters (e.g. strict()
), bean context property setters (e.g. swaps(Object...)
),
or generic property setters (e.g. set(String, Object)
) defined on this builder class have no effect.
value
- The values to add to this setting.public RestClientBuilder marshalls(Marshall... value)
Shortcut for specifying the RestClient.RESTCLIENT_serializers
and RestClient.RESTCLIENT_parsers
using the serializer and parser defined in a marshall.
sortCollections()
),
parser property setters (e.g. strict()
), bean context property setters (e.g. swaps(Object...)
),
or generic property setters (e.g. set(String, Object)
) defined on this builder class have no effect.
value
- The values to add to this setting.public RestClientBuilder parser(Class<? extends Parser> value)
Associates the specified Parser
with the HTTP client.
The parser is used to parse the HTTP response body into a POJO.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
value
- The new value for this setting.
JsonParser.DEFAULT
.public RestClientBuilder parser(Parser value)
Associates the specified Parser
with the HTTP client.
The parser is used to parse the HTTP response body into a POJO.
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined
on this builder class have no effect.
value
- The new value for this setting.
JsonParser.DEFAULT
.public RestClientBuilder parsers(Class<? extends Parser>... value)
Associates the specified Parsers
with the HTTP client.
The parsers are used to parse the HTTP response body into a POJO.
The parser that best matches the
If no
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
value
- The new value for this setting.
JsonParser.DEFAULT
.public RestClientBuilder parsers(Parser... value)
Associates the specified Parsers
with the HTTP client.
The parsers are used to parse the HTTP response body into a POJO.
The parser that best matches the
If no
strict()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined
on this builder class have no effect.
value
- The new value for this setting.
JsonParser.DEFAULT
.public RestClientBuilder partParser(Class<? extends HttpPartParser> value)
The parser to use for parsing POJOs from form data, query parameters, headers, and path variables.
The default part parser is OpenApiParser
which allows for schema-driven marshalling.
value
- The new value for this setting.
OpenApiParser
.public RestClientBuilder partParser(HttpPartParser value)
The parser to use for parsing POJOs from form data, query parameters, headers, and path variables.
The default part parser is OpenApiParser
which allows for schema-driven marshalling.
value
- The new value for this setting.
OpenApiParser
.public RestClientBuilder partSerializer(Class<? extends HttpPartSerializer> value)
The serializer to use for serializing POJOs in form data, query parameters, headers, and path variables.
The default part serializer is OpenApiSerializer
which allows for schema-driven marshalling.
value
- The new value for this setting.
OpenApiSerializer
.public RestClientBuilder partSerializer(HttpPartSerializer value)
The serializer to use for serializing POJOs in form data, query parameters, headers, and path variables.
The default part serializer is OpenApiSerializer
which allows for schema-driven marshalling.
value
- The new value for this setting.
OpenApiSerializer
.public RestClientBuilder rootUri(Object value)
When set, relative URI strings passed in through the various rest call methods (e.g. RestClient.get(Object)
will be prefixed with the specified root.
This root URI is ignored on those methods if you pass in a URL
, URI
, or an absolute URI string.
value
- The root URI to prefix to relative URI strings.
public RestClientBuilder serializer(Class<? extends Serializer> value)
Associates the specified Serializer
with the HTTP client.
The serializer is used to serialize POJOs into the HTTP request body.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
value
- The new value for this setting.
JsonSerializer
.public RestClientBuilder serializer(Serializer value)
Associates the specified Serializer
with the HTTP client.
The serializer is used to serialize POJOs into the HTTP request body.
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined
on this builder class have no effect.
value
- The new value for this setting.
JsonSerializer
.public RestClientBuilder serializers(Class<? extends Serializer>... value)
Associates the specified Serializers
with the HTTP client.
The serializer is used to serialize POJOs into the HTTP request body.
The serializer that best matches the
If no
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined on this builder class.
value
- The new value for this setting.
JsonSerializer
.public RestClientBuilder serializers(Serializer... value)
Associates the specified Serializers
with the HTTP client.
The serializer is used to serialize POJOs into the HTTP request body.
The serializer that best matches the
If no
sortCollections()
),
bean context property setters (e.g. swaps(Object...)
), or generic property setters (e.g. set(String, Object)
) defined
on this builder class have no effect.
value
- The new value for this setting.
JsonSerializer
.public RestClientBuilder detectRecursions()
When enabled, specifies that recursions should be checked for during traversal.
Recursions can occur when traversing models that aren't true trees but rather contain loops.
In general, unchecked recursions cause stack-overflow-errors.
These show up as BeanRecursionException
with the message
public RestClientBuilder ignoreRecursions()
When enabled, when we encounter the same object when traversing a tree, we set the value to
For example, if a model contains the links A->B->C->A, then the JSON generated will look like
the following when
{A:{B:{C:
public RestClientBuilder initialDepth(int value)
The initial indentation level at the root.
Useful when constructing document fragments that need to be indented at a certain level when whitespace is enabled.
value
- The new value for this property.
public RestClientBuilder maxDepth(int value)
When enabled, abort traversal if specified depth is reached in the POJO tree.
If this depth is exceeded, an exception is thrown.
This prevents stack overflows from occurring when trying to traverse models with recursive references.
value
- The new value for this property.
public RestClientBuilder addBeanTypes()
When enabled,
This is used to recreate the correct objects during parsing if the object types cannot be inferred.
For example, when serializing a
Note the differences between the following settings:
addRootType()
- Affects whether addBeanTypes()
- Affects whether
public RestClientBuilder addRootType()
When enabled,
When disabled, it is assumed that the parser knows the exact Java POJO type being parsed, and therefore top-level type information that might normally be included to determine the data type will not be serialized.
For example, when serializing a top-level POJO with a @Bean(typeName)
value, a
Note the differences between the following settings:
addRootType()
- Affects whether addBeanTypes()
- Affects whether
public RestClientBuilder keepNullProperties()
When enabled, null bean values will be serialized to the output.
public RestClientBuilder sortCollections()
When enabled, copies and sorts the contents of arrays and collections before serializing them.
Note that this introduces a performance penalty since it requires copying the existing collection.
public RestClientBuilder sortMaps()
When enabled, copies and sorts the contents of maps by their keys before serializing them.
Note that this introduces a performance penalty.
public RestClientBuilder trimEmptyCollections()
When enabled, empty lists and arrays will not be serialized.
Note that enabling this setting has the following effects on parsing:
public RestClientBuilder trimEmptyMaps()
When enabled, empty map values will not be serialized to the output.
Note that enabling this setting has the following effects on parsing:
public RestClientBuilder trimStringsOnWrite()
When enabled, string values will be trimmed of whitespace using String.trim()
before being serialized.
public RestClientBuilder uriContext(UriContext value)
Bean used for resolution of URIs to absolute or root-relative form.
value
- The new value for this property.public RestClientBuilder uriRelativity(UriRelativity value)
Defines what relative URIs are relative to when serializing any of the following:
Possible values are:
UriRelativity.RESOURCE
- Relative URIs should be considered relative to the servlet URI.
UriRelativity.PATH_INFO
- Relative URIs should be considered relative to the request URI.
See uriContext(UriContext)
for examples.
value
- The new value for this property.
UriRelativity.RESOURCE
public RestClientBuilder uriResolution(UriResolution value)
Defines the resolution level for URIs when serializing any of the following:
Possible values are:
UriResolution.ABSOLUTE
- Resolve to an absolute URI (e.g. UriResolution.ROOT_RELATIVE
- Resolve to a root-relative URI (e.g. UriResolution.NONE
- Don't do any URI resolution.
See uriContext(UriContext)
for examples.
value
- The new value for this property.
UriResolution.NONE
public RestClientBuilder maxIndent(int value)
Specifies the maximum indentation level in the serialized document.
value
- The new value for this property.
public RestClientBuilder quoteChar(char value)
Specifies the character to use for quoting attributes and values.
value
- The new value for this property.
public RestClientBuilder sq()
Specifies to use single quotes for quoting attributes and values.
public RestClientBuilder useWhitespace()
When enabled, whitespace is added to the output to improve readability.
public RestClientBuilder ws()
When enabled, whitespace is added to the output to improve readability.
public RestClientBuilder debugOutputLines(int value)
When parse errors occur, this specifies the number of lines of input before and after the error location to be printed as part of the exception message.
value
- The new value for this property.
public RestClientBuilder strict()
When enabled, strict mode for the parser is enabled.
Strict mode can mean different things for different parsers.
Parser class | Strict behavior |
---|---|
All reader-based parsers |
When enabled, throws ParseExceptions on malformed charset input.
Otherwise, malformed input is ignored.
|
JsonParser |
When enabled, throws exceptions on the following invalid JSON syntax:
|
public RestClientBuilder trimStringsOnRead()
When enabled, string values will be trimmed of whitespace using String.trim()
before being added to
the POJO.
public RestClientBuilder oapiFormat(HttpPartFormat value)
Specifies the format to use for HTTP parts when not otherwise specified via Schema.format()
for
the OpenAPI serializer and parser on this client.
Possible values:
HttpPartFormat
UON
- UON notation (e.g. INT32
- Signed 32 bits.
INT64
- Signed 64 bits.
FLOAT
- 32-bit floating point number.
DOUBLE
- 64-bit floating point number.
BYTE
- BASE-64 encoded characters.
BINARY
- Hexadecimal encoded octets (e.g. BINARY_SPACED
- Spaced-separated hexadecimal encoded octets (e.g. DATE
- An RFC3339 full-date.
DATE_TIME
- An RFC3339 date-time.
PASSWORD
- Used to hint UIs the input needs to be obscured.
NO_FORMAT
- (default) Not specified.
value
- The new value for this property.
HttpPartFormat.NO_FORMAT
.public RestClientBuilder oapiCollectionFormat(HttpPartCollectionFormat value)
Specifies the collection format to use for HTTP parts when not otherwise specified via Schema.collectionFormat()
for the
OpenAPI serializer and parser on this client.
Possible values:
HttpPartFormat
CSV
- (default) Comma-separated values (e.g. SSV
- Space-separated values (e.g. TSV
- Tab-separated values (e.g. PIPES
- Pipe-separated values (e.g. MULTI
- Corresponds to multiple parameter instances instead of multiple values for a single instance (e.g. UONC
- UON collection notation (e.g.
value
- The new value for this property.
HttpPartCollectionFormat.NO_COLLECTION_FORMAT
.public RestClientBuilder paramFormat(ParamFormat value)
Specifies the format of parameters when using the UrlEncodingSerializer
to serialize Form Posts.
Specifies the format to use for GET parameter keys and values.
Possible values:
ParamFormat.UON
(default) - Use UON notation for parameters.
ParamFormat.PLAINTEXT
- Use plain text for parameters.
value
- The new value for this property.public RestClientBuilder paramFormatPlain()
Specifies the format of parameters when using the UrlEncodingSerializer
to serialize Form Posts.
Specifies plaintext as the format to use for GET parameter keys and values.
public RestClientBuilder add(Map<String,Object> properties)
ContextBuilder
Identical in function to ContextBuilder.set(String, Object)
but allows you to specify multiple values at once.
add
in class BeanContextBuilder
properties
- The properties to set on this class.
public RestClientBuilder addTo(String name, Object value)
ContextBuilder
SET properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_notBeanClasses
property which has the value
addTo
in class BeanContextBuilder
name
- The property name.value
- The new value to add to the SET property.
public RestClientBuilder appendTo(String name, Object value)
ContextBuilder
LIST properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_swaps
property which has the value
appendTo
in class BeanContextBuilder
name
- The property name.value
- The new value to add to the LIST property.
public RestClientBuilder apply(PropertyStore copyFrom)
ContextBuilder
apply
in class BeanContextBuilder
copyFrom
- The property store whose settings are being copied.public RestClientBuilder applyAnnotations(Class<?>... fromClasses)
ContextBuilder
Any annotations found that themselves are annotated with PropertyStoreApply
will be resolved and
applied as properties to this builder. These annotations include:
BeanConfig
CsvConfig
HtmlConfig
HtmlDocConfig
JsoConfig
JsonConfig
JsonSchemaConfig
MsgPackConfig
OpenApiConfig
ParserConfig
PlainTextConfig
SerializerConfig
SoapXmlConfig
UonConfig
UrlEncodingConfig
XmlConfig
Annotations on classes are appended in the following order:
The default var resolver VarResolver.DEFAULT
is used to resolve any variables in annotation field values.
applyAnnotations
in class BeanContextBuilder
fromClasses
- The classes on which the annotations are defined.public RestClientBuilder applyAnnotations(Method... fromMethods)
ContextBuilder
Any annotations found that themselves are annotated with PropertyStoreApply
will be resolved and
applied as properties to this builder. These annotations include:
BeanConfig
CsvConfig
HtmlConfig
HtmlDocConfig
JsoConfig
JsonConfig
JsonSchemaConfig
MsgPackConfig
OpenApiConfig
ParserConfig
PlainTextConfig
SerializerConfig
SoapXmlConfig
UonConfig
UrlEncodingConfig
XmlConfig
Annotations on methods are appended in the following order:
The default var resolver VarResolver.DEFAULT
is used to resolve any variables in annotation field values.
applyAnnotations
in class BeanContextBuilder
fromMethods
- The methods on which the annotations are defined.public RestClientBuilder applyAnnotations(AnnotationList al, VarResolverSession r)
ContextBuilder
The AnnotationList
object is an ordered list of annotations and the classes/methods/packages they were found on.
applyAnnotations
in class BeanContextBuilder
al
- The list of all annotations annotated with PropertyStoreApply
.r
- The string resolver for resolving variables in annotation values.public RestClientBuilder debug()
ContextBuilder
Enables the following additional information during serialization:
BeanTraverseContext.BEANTRAVERSE_detectRecursions
.
Enables the following additional information during parsing:
debug
in class BeanContextBuilder
public RestClientBuilder locale(Locale value)
ContextBuilder
Specifies the default locale for serializer and parser sessions when not specified via SessionArgs.locale(Locale)
.
Typically used for POJO swaps that need to deal with locales such as swaps that convert PojoSwap.swap(BeanSession, Object)
and
PojoSwap.unswap(BeanSession, Object, ClassMeta, String)
methods.
locale
in class BeanContextBuilder
value
- The new value for this property.public RestClientBuilder mediaType(MediaType value)
ContextBuilder
Specifies the default media type for serializer and parser sessions when not specified via SessionArgs.mediaType(MediaType)
.
Typically used for POJO swaps that need to serialize the same POJO classes differently depending on
the specific requested media type. For example, a swap could handle a request for media types
mediaType
in class BeanContextBuilder
value
- The new value for this property.public RestClientBuilder prependTo(String name, Object value)
ContextBuilder
LIST properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_swaps
property which has the value
prependTo
in class BeanContextBuilder
name
- The property name.value
- The new value to add to the LIST property.
public RestClientBuilder putAllTo(String name, Object value)
ContextBuilder
MAP properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_implClasses
property which has the value
putAllTo
in class BeanContextBuilder
name
- The property name.value
- Either a JSON Object string or a Map
whose valid value types depend on the property type:
public RestClientBuilder putTo(String name, String key, Object value)
ContextBuilder
MAP properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_implClasses
property which has the value
putTo
in class BeanContextBuilder
name
- The property name.key
- The property value map key.value
- The property value map value.
public RestClientBuilder removeFrom(String name, Object value)
ContextBuilder
removeFrom
in class BeanContextBuilder
name
- The property name.value
- The property value in the SET/LIST/MAP property.public RestClientBuilder set(Map<String,Object> properties)
ContextBuilder
Identical in function to ContextBuilder.set(String, Object)
but allows you to specify multiple values at once.
set
in class BeanContextBuilder
properties
- The properties to set on this class.
public RestClientBuilder set(String name, Object value)
ContextBuilder
Provides the ability to specify configuration property values in a generic fashion.
Property names must have the following format that identify their datatype...
...where the parts consist of the following...
For example,
Property values get 'normalized' when they get set.
For example, calling PropertyStore
class to be comparable
and useful in determining whether a cached instance of a context object can be returned.
As a general rule, builders don't typically have "unsetter" methods. For example, once you've set strict
mode on the
set
in class BeanContextBuilder
name
- The property name.value
- The property value.
public RestClientBuilder timeZone(TimeZone value)
ContextBuilder
Specifies the default time zone for serializer and parser sessions when not specified via SessionArgs.timeZone(TimeZone)
.
Typically used for POJO swaps that need to deal with timezones such as swaps that convert PojoSwap.swap(BeanSession, Object)
and
PojoSwap.unswap(BeanSession, Object, ClassMeta, String)
methods.
timeZone
in class BeanContextBuilder
value
- The new value for this property.public RestClientBuilder annotations(Annotation... values)
BeanContextBuilder
Defines annotations to apply to specific classes and methods.
Allows you to dynamically apply Juneau annotations typically applied directly to classes and methods. Useful in cases where you want to use the functionality of the annotation on beans and bean properties but do not have access to the code to do so.
As a rule, any Juneau annotation with an
The following example shows the equivalent methods for applying the @Bean
annotation:
In general, the underlying framework uses this method when it finds dynamically applied annotations on config annotations. However, concrete implementations of annotations are also provided that can be passed directly into builder classes like so:
The following is the list of concrete annotations provided that can be constructed and passed into the builder class:
BeanAnnotation
BeancAnnotation
BeanIgnoreAnnotation
BeanpAnnotation
ExampleAnnotation
NamePropertyAnnotation
ParentPropertyAnnotation
SwapAnnotation
UriAnnotation
CsvAnnotation
HtmlAnnotation
JsoAnnotation
JsonAnnotation
SchemaAnnotation
MsgPackAnnotation
OpenApiAnnotation
PlainTextAnnotation
SoapXmlAnnotation
UonAnnotation
UrlEncodingAnnotation
XmlAnnotation
The syntax for the
annotations
in class BeanContextBuilder
values
- The values to add to this property.public RestClientBuilder beanClassVisibility(Visibility value)
BeanContextBuilder
Classes are not considered beans unless they meet the minimum visibility requirements.
For example, if the visibility is
@Bean
annotation can be used on a non-public bean class to override this setting.
@BeanIgnore
annotation can also be used on a public bean class to ignore it as a bean.
beanClassVisibility
in class BeanContextBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public RestClientBuilder beanConstructorVisibility(Visibility value)
BeanContextBuilder
Only look for constructors with the specified minimum visibility.
This setting affects the logic for finding no-arg constructors for bean. Normally, only
@Beanc
annotation can also be used to expose a non-public constructor.
@BeanIgnore
annotation can also be used on a public bean constructor to ignore it.
beanConstructorVisibility
in class BeanContextBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public RestClientBuilder beanFieldVisibility(Visibility value)
BeanContextBuilder
Only look for bean fields with the specified minimum visibility.
This affects which fields on a bean class are considered bean properties. Normally only
Bean fields can be ignored as properties entirely by setting the value to Visibility.NONE
@Beanp
annotation can also be used to expose a non-public field.
@BeanIgnore
annotation can also be used on a public bean field to ignore it as a bean property.
beanFieldVisibility
in class BeanContextBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public RestClientBuilder beanInterceptor(Class<?> on, Class<? extends BeanInterceptor<?>> value)
BeanContextBuilder
Bean interceptors can be used to intercept calls to getters and setters and alter their values in transit.
beanInterceptor
in class BeanContextBuilder
on
- The bean that the filter applies to.value
- The new value for this property.public RestClientBuilder beanMethodVisibility(Visibility value)
BeanContextBuilder
Only look for bean methods with the specified minimum visibility.
This affects which methods are detected as getters and setters on a bean class. Normally only
@Beanp
annotation can also be used to expose a non-public method.
@BeanIgnore
annotation can also be used on a public bean getter/setter to ignore it as a bean property.
beanMethodVisibility
in class BeanContextBuilder
value
- The new value for this property.
Visibility.PUBLIC
public RestClientBuilder beansDontRequireSomeProperties()
BeanContextBuilder
When enabled, then a Java class must contain at least 1 property to be considered a bean.
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
The @Bean
annotation can be used on a class to override this setting when
@Bean
annotation can be used on the class to force it to be recognized as a bean class
even if it has no properties.
beansDontRequireSomeProperties
in class BeanContextBuilder
public RestClientBuilder beansRequireDefaultConstructor()
BeanContextBuilder
When enabled, a Java class must implement a default no-arg constructor to be considered a bean.
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
@Bean
annotation can be used on a bean class to override this setting.
@BeanIgnore
annotation can also be used on a class to ignore it as a bean.
beansRequireDefaultConstructor
in class BeanContextBuilder
public RestClientBuilder beansRequireSerializable()
BeanContextBuilder
When enabled, a Java class must implement the Serializable
interface to be considered a bean.
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
@Bean
annotation can be used on a bean class to override this setting.
@BeanIgnore
annotation can also be used on a class to ignore it as a bean.
beansRequireSerializable
in class BeanContextBuilder
public RestClientBuilder beansRequireSettersForGetters()
BeanContextBuilder
When enabled, ignore read-only properties (properties with getters but not setters).
@Beanp
annotation can be used on the getter to override this setting.
@BeanIgnore
annotation can also be used on getters to ignore them as bean properties.
beansRequireSettersForGetters
in class BeanContextBuilder
public RestClientBuilder bpi(Map<String,Object> values)
BeanContextBuilder
Specifies the set and order of names of properties associated with bean classes.
For example, BeanContextBuilder.ignoreUnknownBeanProperties()
has been called.
This value is entirely optional if you simply want to expose all the getters and public fields on a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, whereas on Oracle JREs, the order is entirely random.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code for each entry:
builder.annotations(
Bean.bpi()
- On an annotation on the bean class itself.
BeanConfig.bpi()
- On a bean config annotation (see BeanContextBuilder.annotations(Annotation...)
).
bpi
in class BeanContextBuilder
values
- The values to add to this builder.
public RestClientBuilder bpi(Class<?> beanClass, String properties)
BeanContextBuilder
Specifies the set and order of names of properties associated with the bean class.
For example, BeanContextBuilder.ignoreUnknownBeanProperties()
has been called.
This value is entirely optional if you simply want to expose all the getters and public fields on a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, whereas on Oracle JREs, the order is entirely random.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code:
builder.annotations(
Bean.bpi()
- On an annotation on the bean class itself.
BeanConfig.bpi()
- On a bean config annotation (see BeanContextBuilder.annotations(Annotation...)
).
bpi
in class BeanContextBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public RestClientBuilder bpi(String beanClassName, String properties)
BeanContextBuilder
Specifies the set and order of names of properties associated with the bean class.
For example, BeanContextBuilder.ignoreUnknownBeanProperties()
has been called.
This value is entirely optional if you simply want to expose all the getters and public fields on a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, whereas on Oracle JREs, the order is entirely random.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code:
builder.annotations(
Bean.bpi()
- On an annotation on the bean class itself.
BeanConfig.bpi()
- On a bean config annotation (see BeanContextBuilder.annotations(Annotation...)
).
bpi
in class BeanContextBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public RestClientBuilder bpro(Map<String,Object> values)
BeanContextBuilder
Specifies one or more properties on beans that are read-only despite having valid getters.
Serializers will serialize such properties as usual, but parsers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code for each entry:
builder.annotations(
bpro
in class BeanContextBuilder
values
- The values to add to this builder.
public RestClientBuilder bpro(Class<?> beanClass, String properties)
BeanContextBuilder
Specifies one or more properties on a bean that are read-only despite having valid getters.
Serializers will serialize such properties as usual, but parsers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code:
builder.annotations(
bpro
in class BeanContextBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public RestClientBuilder bpro(String beanClassName, String properties)
BeanContextBuilder
Specifies one or more properties on a bean that are read-only despite having valid getters.
Serializers will serialize such properties as usual, but parsers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code:
builder.annotations(
bpro
in class BeanContextBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public RestClientBuilder bpwo(Map<String,Object> values)
BeanContextBuilder
Specifies one or more properties on a bean that are write-only despite having valid setters.
Parsers will parse such properties as usual, but serializers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code for each entry:
builder.annotations(
bpwo
in class BeanContextBuilder
values
- The values to add to this builder.
public RestClientBuilder bpwo(Class<?> beanClass, String properties)
BeanContextBuilder
Specifies one or more properties on a bean that are write-only despite having valid setters.
Parsers will parse such properties as usual, but serializers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code:
builder.annotations(
bpwo
in class BeanContextBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public RestClientBuilder bpwo(String beanClassName, String properties)
BeanContextBuilder
Specifies one or more properties on a bean that are write-only despite having valid setters.
Parsers will parse such properties as usual, but serializers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code:
builder.annotations(
bpwo
in class BeanContextBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public RestClientBuilder bpx(Map<String,Object> values)
BeanContextBuilder
Specifies to exclude the specified list of properties for the specified bean classes.
Same as BeanContextBuilder.bpi(Map)
except you specify a list of bean property names that you want to exclude from
serialization.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code for each entry:
builder.annotations(
bpx
in class BeanContextBuilder
values
- The values to add to this builder.
public RestClientBuilder bpx(Class<?> beanClass, String properties)
BeanContextBuilder
Specifies to exclude the specified list of properties for the specified bean class.
Same as BeanContextBuilder.bpi(Class, String)
except you specify a list of bean property names that you want to exclude from
serialization.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code:
builder.annotations(
bpx
in class BeanContextBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public RestClientBuilder bpx(String beanClassName, String properties)
BeanContextBuilder
Specifies to exclude the specified list of properties for the specified bean class.
Same as BeanContextBuilder.bpx(String, String)
except you specify a list of bean property names that you want to exclude from
serialization.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code:
builder.annotations(
bpx
in class BeanContextBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public RestClientBuilder dictionary(Object... values)
BeanContextBuilder
The list of classes that make up the bean dictionary in this bean context.
A dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred
through reflection. The names are defined through the @Bean(typeName)
annotation defined
on the bean class. For example, if a class
This setting tells the parsers which classes to look for when resolving
Values can consist of any of the following types:
@Bean(typeName)
.
BeanDictionaryList
containing a collection of bean classes with type name annotations.
BeanDictionaryMap
containing a mapping of type names to classes without type name annotations.
Another option is to use the Bean.dictionary()
annotation on the POJO class itself:
A typical usage is to allow for HTML documents to be parsed back into HTML beans:
dictionary
in class BeanContextBuilder
values
- The values to add to this property.public RestClientBuilder dictionaryOn(Class<?> on, Class<?>... values)
BeanContextBuilder
This is identical to BeanContextBuilder.dictionary(Object...)
, but specifies a dictionary within the context of
a single class as opposed to globally.
This is functionally equivalent to the Bean.dictionary()
annotation.
dictionaryOn
in class BeanContextBuilder
on
- The class that the dictionary values apply to.values
- The new values for this property.public RestClientBuilder dontIgnorePropertiesWithoutSetters()
BeanContextBuilder
When enabled, trying to set a value on a bean property without a setter will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
@BeanIgnore
annotation can also be used on getters and fields to ignore them.
dontIgnorePropertiesWithoutSetters
in class BeanContextBuilder
public RestClientBuilder dontIgnoreTransientFields()
BeanContextBuilder
When enabled, methods and fields marked as
@Beanp
annotation can also be used on transient fields to keep them from being ignored.
dontIgnoreTransientFields
in class BeanContextBuilder
public RestClientBuilder dontIgnoreUnknownNullBeanProperties()
BeanContextBuilder
When enabled, trying to set a BeanRuntimeException
is thrown.
dontIgnoreUnknownNullBeanProperties
in class BeanContextBuilder
public RestClientBuilder dontUseInterfaceProxies()
BeanContextBuilder
When enabled, interfaces will be instantiated as proxy classes through the use of an
InvocationHandler
if there is no other way of instantiating them.
Otherwise, throws a BeanRuntimeException
.
dontUseInterfaceProxies
in class BeanContextBuilder
public RestClientBuilder fluentSetters()
BeanContextBuilder
When enabled, fluent setters are detected on beans during parsing.
Fluent setters must have the following attributes:
@Beanp
annotation can also be used on methods to individually identify them as fluent setters.
@Bean.fluentSetters()
annotation can also be used on classes to specify to look for fluent setters.
fluentSetters
in class BeanContextBuilder
public RestClientBuilder fluentSetters(Class<?> on)
BeanContextBuilder
Identical to BeanContextBuilder.fluentSetters()
but enables it on a specific class only.
Bean.fluentSetters()
annotation.
fluentSetters
in class BeanContextBuilder
on
- The class that this applies to.public RestClientBuilder ignoreInvocationExceptionsOnGetters()
BeanContextBuilder
When enabled, errors thrown when calling bean getter methods will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnGetters
in class BeanContextBuilder
public RestClientBuilder ignoreInvocationExceptionsOnSetters()
BeanContextBuilder
When enabled, errors thrown when calling bean setter methods will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnSetters
in class BeanContextBuilder
public RestClientBuilder ignoreUnknownBeanProperties()
BeanContextBuilder
When enabled, trying to set a value on a non-existent bean property will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
ignoreUnknownBeanProperties
in class BeanContextBuilder
public RestClientBuilder implClass(Class<?> interfaceClass, Class<?> implClass)
BeanContextBuilder
For interfaces and abstract classes this method can be used to specify an implementation class for the interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a parse).
implClass
in class BeanContextBuilder
interfaceClass
- The interface class.implClass
- The implementation class.public RestClientBuilder implClasses(Map<Class<?>,Class<?>> values)
BeanContextBuilder
For interfaces and abstract classes this method can be used to specify an implementation class for the interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a parse).
implClasses
in class BeanContextBuilder
values
- The new value for this property.public RestClientBuilder interfaceClass(Class<?> on, Class<?> value)
BeanContextBuilder
When specified, only the list of properties defined on the interface class will be used during serialization. Additional properties on subclasses will be ignored.
This annotation can be used on the parent class so that it filters to all child classes, or can be set individually on the child classes.
@Bean(interfaceClass)
annotation is the equivalent annotation-based solution.
interfaceClass
in class BeanContextBuilder
on
- The class that the interface class applies to.value
- The new value for this property.public RestClientBuilder interfaces(Class<?>... value)
BeanContextBuilder
When specified, only the list of properties defined on the interface class will be used during serialization of implementation classes. Additional properties on subclasses will be ignored.
This annotation can be used on the parent class so that it filters to all child classes, or can be set individually on the child classes.
@Bean(interfaceClass)
annotation is the equivalent annotation-based solution.
interfaces
in class BeanContextBuilder
value
- The new value for this property.public RestClientBuilder notBeanClasses(Object... values)
BeanContextBuilder
List of classes that should not be treated as beans even if they appear to be bean-like.
Not-bean classes are converted to
Values can consist of any of the following types:
@BeanIgnore
annotation can also be used on classes to prevent them from being recognized as beans.
notBeanClasses
in class BeanContextBuilder
values
- The values to add to this property.
public RestClientBuilder notBeanPackages(Object... values)
BeanContextBuilder
Used as a convenient way of defining the BeanContextBuilder.notBeanClasses(Object...)
property for entire packages.
Any classes within these packages will be serialized to strings using Object.toString()
.
Note that you can specify suffix patterns to include all subpackages.
Values can consist of any of the following types:
notBeanPackages
in class BeanContextBuilder
values
- The values to add to this property.
Package
objects.
public RestClientBuilder propertyNamer(Class<? extends PropertyNamer> value)
BeanContextBuilder
The class to use for calculating bean property names.
Predefined classes:
PropertyNamerDefault
- Default.
PropertyNamerDLC
- Dashed-lower-case names.
PropertyNamerULC
- Dashed-upper-case names.
propertyNamer
in class BeanContextBuilder
value
- The new value for this setting.
PropertyNamerDefault
.public RestClientBuilder propertyNamer(Class<?> on, Class<? extends PropertyNamer> value)
BeanContextBuilder
Same as BeanContextBuilder.propertyNamer(Class)
but allows you to specify a namer for a specific class.
propertyNamer
in class BeanContextBuilder
on
- The class that the namer applies to.value
- The new value for this setting.
PropertyNamerDefault
.public RestClientBuilder sortProperties()
BeanContextBuilder
When enabled, all bean properties will be serialized and access in alphabetical order. Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor. On IBM JVMs, the bean properties are ordered based on their ordering in the Java file. On Oracle JVMs, the bean properties are not ordered (which follows the official JVM specs).
This property is disabled by default so that IBM JVM users don't have to use @Bean
annotations
to force bean properties to be in a particular order and can just alter the order of the fields/methods
in the Java file.
@Bean.sort()
annotation can also be used to sort properties on just a single class.
sortProperties
in class BeanContextBuilder
public RestClientBuilder sortProperties(Class<?>... on)
BeanContextBuilder
Same as BeanContextBuilder.sortProperties()
but allows you to specify individual bean classes instead of globally.
sortProperties
in class BeanContextBuilder
on
- The bean classes to sort properties on.public RestClientBuilder stopClass(Class<?> on, Class<?> value)
BeanContextBuilder
Identical in purpose to the stop class specified by Introspector.getBeanInfo(Class, Class)
.
Any properties in the stop class or in its base classes will be ignored during analysis.
For example, in the following class hierarchy, instances of
stopClass
in class BeanContextBuilder
on
- The class on which the stop class is being applied.value
- The new value for this property.public RestClientBuilder swaps(Object... values)
BeanContextBuilder
Swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization, and "swap in" the non-serializable class during parsing.
An example of a swap would be a
Multiple swaps can be associated with a single class.
When multiple swaps are applicable to the same class, the media type pattern defined by
PojoSwap.forMediaTypes()
or @Swap(mediaTypes)
are used to come up with the best match.
Values can consist of any of the following types:
PojoSwap
.
PojoSwap
.
SurrogateSwap
.
swaps
in class BeanContextBuilder
values
- The values to add to this property.
PojoSwap
.
SurrogateSwap
.
public RestClientBuilder typeName(Class<?> on, String value)
BeanContextBuilder
The name is used to identify the class type during parsing when it cannot be inferred through reflection.
For example, if a bean property is of type
It is also used to specify element names in XML.
Bean(typeName)
annotation.
typeName
in class BeanContextBuilder
on
- The class the type name is being defined on.value
- The new value for this property.public RestClientBuilder typePropertyName(String value)
BeanContextBuilder
This specifies the name of the bean property used to store the dictionary name of a bean type so that the parser knows the data type to reconstruct.
typePropertyName
in class BeanContextBuilder
value
- The new value for this property.
public RestClientBuilder typePropertyName(Class<?> on, String value)
BeanContextBuilder
Same as BeanContextBuilder.typePropertyName(String)
except targets a specific bean class instead of globally.
typePropertyName
in class BeanContextBuilder
on
- The class the type property name applies to.value
- The new value for this property.
public RestClientBuilder useEnumNames()
BeanContextBuilder
When enabled, enums are always serialized by name, not using Object.toString()
.
useEnumNames
in class BeanContextBuilder
public RestClientBuilder useJavaBeanIntrospector()
BeanContextBuilder
Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters.
Most @Bean
annotations will be ignored.
useJavaBeanIntrospector
in class BeanContextBuilder
public RestClientBuilder disableRedirectHandling()
HttpClientBuilder.disableRedirectHandling()
public RestClientBuilder redirectStrategy(RedirectStrategy redirectStrategy)
RedirectStrategy
instance.
disableRedirectHandling()
method.
redirectStrategy
- New property value.HttpClientBuilder.setRedirectStrategy(RedirectStrategy)
public RestClientBuilder defaultCookieSpecRegistry(Lookup<CookieSpecProvider> cookieSpecRegistry)
CookieSpec
registry which will be used for request execution if not explicitly set in the client execution context.cookieSpecRegistry
- New property value.HttpClientBuilder.setDefaultCookieSpecRegistry(Lookup)
public RestClientBuilder requestExecutor(HttpRequestExecutor requestExec)
HttpRequestExecutor
instance.requestExec
- New property value.HttpClientBuilder.setRequestExecutor(HttpRequestExecutor)
public RestClientBuilder sslHostnameVerifier(HostnameVerifier hostnameVerifier)
HostnameVerifier
instance.
connectionManager(HttpClientConnectionManager)
and the sslSocketFactory(LayeredConnectionSocketFactory)
methods.
hostnameVerifier
- New property value.HttpClientBuilder.setSSLHostnameVerifier(HostnameVerifier)
public RestClientBuilder publicSuffixMatcher(PublicSuffixMatcher publicSuffixMatcher)
PublicSuffixMatcherLoader
.
publicSuffixMatcher
- New property value.HttpClientBuilder.setPublicSuffixMatcher(PublicSuffixMatcher)
public RestClientBuilder sslContext(SSLContext sslContext)
SSLContext
instance.
connectionManager(HttpClientConnectionManager)
and the sslSocketFactory(LayeredConnectionSocketFactory)
methods.
sslContext
- New property value.HttpClientBuilder.setSSLContext(SSLContext)
public RestClientBuilder sslSocketFactory(LayeredConnectionSocketFactory sslSocketFactory)
LayeredConnectionSocketFactory
instance.
connectionManager(HttpClientConnectionManager)
method.
sslSocketFactory
- New property value.HttpClientBuilder.setSSLSocketFactory(LayeredConnectionSocketFactory)
public RestClientBuilder maxConnTotal(int maxConnTotal)
connectionManager(HttpClientConnectionManager)
method.
maxConnTotal
- New property value.HttpClientBuilder.setMaxConnTotal(int)
public RestClientBuilder maxConnPerRoute(int maxConnPerRoute)
connectionManager(HttpClientConnectionManager)
method.
maxConnPerRoute
- New property value.HttpClientBuilder.setMaxConnPerRoute(int)
public RestClientBuilder defaultSocketConfig(SocketConfig config)
SocketConfig
.
connectionManager(HttpClientConnectionManager)
method.
config
- New property value.HttpClientBuilder.setDefaultSocketConfig(SocketConfig)
public RestClientBuilder defaultConnectionConfig(ConnectionConfig config)
ConnectionConfig
.
connectionManager(HttpClientConnectionManager)
method.
config
- New property value.HttpClientBuilder.setDefaultConnectionConfig(ConnectionConfig)
public RestClientBuilder connectionTimeToLive(long connTimeToLive, TimeUnit connTimeToLiveTimeUnit)
connectionManager(HttpClientConnectionManager)
method.
connTimeToLive
- New property value.connTimeToLiveTimeUnit
- New property value.HttpClientBuilder.setConnectionTimeToLive(long,TimeUnit)
public RestClientBuilder connectionManager(HttpClientConnectionManager connManager)
HttpClientConnectionManager
instance.connManager
- New property value.HttpClientBuilder.setConnectionManager(HttpClientConnectionManager)
public RestClientBuilder connectionManagerShared(boolean shared)
shared
- New property value.HttpClientBuilder.setConnectionManagerShared(boolean)
public RestClientBuilder connectionReuseStrategy(ConnectionReuseStrategy reuseStrategy)
ConnectionReuseStrategy
instance.reuseStrategy
- New property value.HttpClientBuilder.setConnectionReuseStrategy(ConnectionReuseStrategy)
public RestClientBuilder keepAliveStrategy(ConnectionKeepAliveStrategy keepAliveStrategy)
ConnectionKeepAliveStrategy
instance.keepAliveStrategy
- New property value.HttpClientBuilder.setKeepAliveStrategy(ConnectionKeepAliveStrategy)
public RestClientBuilder targetAuthenticationStrategy(AuthenticationStrategy targetAuthStrategy)
AuthenticationStrategy
instance for target host authentication.targetAuthStrategy
- New property value.HttpClientBuilder.setTargetAuthenticationStrategy(AuthenticationStrategy)
public RestClientBuilder proxyAuthenticationStrategy(AuthenticationStrategy proxyAuthStrategy)
AuthenticationStrategy
instance for proxy authentication.proxyAuthStrategy
- New property value.HttpClientBuilder.setProxyAuthenticationStrategy(AuthenticationStrategy)
public RestClientBuilder userTokenHandler(UserTokenHandler userTokenHandler)
UserTokenHandler
instance.
disableConnectionState()
method.
userTokenHandler
- New property value.HttpClientBuilder.setUserTokenHandler(UserTokenHandler)
public RestClientBuilder disableConnectionState()
HttpClientBuilder.disableConnectionState()
public RestClientBuilder schemePortResolver(SchemePortResolver schemePortResolver)
SchemePortResolver
instance.schemePortResolver
- New property value.HttpClientBuilder.setSchemePortResolver(SchemePortResolver)
public RestClientBuilder userAgent(String userAgent)
httpProcessor(HttpProcessor)
method.
userAgent(Object)
is an equivalent method.
userAgent
- New property value.HttpClientBuilder.setUserAgent(String)
public RestClientBuilder defaultHeaders(Collection<? extends Header> defaultHeaders)
httpProcessor(HttpProcessor)
method.
headers(Object...)
is an equivalent method.
defaultHeaders
- New property value.HttpClientBuilder.setDefaultHeaders(Collection)
public RestClientBuilder addInterceptorFirst(HttpResponseInterceptor itcp)
httpProcessor(HttpProcessor)
method.
itcp
- New property value.HttpClientBuilder.addInterceptorFirst(HttpResponseInterceptor)
public RestClientBuilder addInterceptorLast(HttpResponseInterceptor itcp)
httpProcessor(HttpProcessor)
method.
itcp
- New property value.HttpClientBuilder.addInterceptorLast(HttpResponseInterceptor)
public RestClientBuilder addInterceptorFirst(HttpRequestInterceptor itcp)
httpProcessor(HttpProcessor)
method.
itcp
- New property value.HttpClientBuilder.addInterceptorFirst(HttpRequestInterceptor)
public RestClientBuilder addInterceptorLast(HttpRequestInterceptor itcp)
httpProcessor(HttpProcessor)
method.
itcp
- New property value.HttpClientBuilder.addInterceptorLast(HttpRequestInterceptor)
public RestClientBuilder disableCookieManagement()
httpProcessor(HttpProcessor)
method.
HttpClientBuilder.disableCookieManagement()
public RestClientBuilder disableContentCompression()
httpProcessor(HttpProcessor)
method.
HttpClientBuilder.disableContentCompression()
public RestClientBuilder disableAuthCaching()
httpProcessor(HttpProcessor)
method.
HttpClientBuilder.disableAuthCaching()
public RestClientBuilder httpProcessor(HttpProcessor httpprocessor)
HttpProcessor
instance.httpprocessor
- New property value.HttpClientBuilder.setHttpProcessor(HttpProcessor)
public RestClientBuilder retryHandler(HttpRequestRetryHandler retryHandler)
HttpRequestRetryHandler
instance.
disableAutomaticRetries()
method.
retryHandler
- New property value.HttpClientBuilder.setRetryHandler(HttpRequestRetryHandler)
public RestClientBuilder disableAutomaticRetries()
HttpClientBuilder.disableAutomaticRetries()
public RestClientBuilder proxy(HttpHost proxy)
routePlanner(HttpRoutePlanner)
method.
proxy
- New property value.HttpClientBuilder.setProxy(HttpHost)
public RestClientBuilder routePlanner(HttpRoutePlanner routePlanner)
HttpRoutePlanner
instance.routePlanner
- New property value.HttpClientBuilder.setRoutePlanner(HttpRoutePlanner)
public RestClientBuilder connectionBackoffStrategy(ConnectionBackoffStrategy connectionBackoffStrategy)
ConnectionBackoffStrategy
instance.connectionBackoffStrategy
- New property value.HttpClientBuilder.setConnectionBackoffStrategy(ConnectionBackoffStrategy)
public RestClientBuilder backoffManager(BackoffManager backoffManager)
BackoffManager
instance.backoffManager
- New property value.HttpClientBuilder.setBackoffManager(BackoffManager)
public RestClientBuilder serviceUnavailableRetryStrategy(ServiceUnavailableRetryStrategy serviceUnavailStrategy)
ServiceUnavailableRetryStrategy
instance.serviceUnavailStrategy
- New property value.HttpClientBuilder.setServiceUnavailableRetryStrategy(ServiceUnavailableRetryStrategy)
public RestClientBuilder defaultCookieStore(CookieStore cookieStore)
CookieStore
instance which will be used for request execution if not explicitly set in the client execution context.cookieStore
- New property value.HttpClientBuilder.setDefaultCookieStore(CookieStore)
public RestClientBuilder defaultCredentialsProvider(CredentialsProvider credentialsProvider)
CredentialsProvider
instance which will be used for request execution if not explicitly set in the client execution context.credentialsProvider
- New property value.HttpClientBuilder.setDefaultCredentialsProvider(CredentialsProvider)
public RestClientBuilder defaultAuthSchemeRegistry(Lookup<AuthSchemeProvider> authSchemeRegistry)
AuthScheme
registry which will be used for request execution if not explicitly set in the client execution context.authSchemeRegistry
- New property value.HttpClientBuilder.setDefaultAuthSchemeRegistry(Lookup)
public RestClientBuilder contentDecoderRegistry(Map<String,InputStreamFactory> contentDecoderMap)
InputStreamFactories
to be used for automatic content decompression.contentDecoderMap
- New property value.HttpClientBuilder.setContentDecoderRegistry(Map)
public RestClientBuilder defaultRequestConfig(RequestConfig config)
RequestConfig
instance which will be used for request execution if not explicitly set in the client execution context.config
- New property value.HttpClientBuilder.setDefaultRequestConfig(RequestConfig)
public RestClientBuilder useSystemProperties()
HttpClientBuilder.useSystemProperties()
public RestClientBuilder evictExpiredConnections()
HttpClient
proactively evict expired connections from the connection pool using a background thread.
Closeable.close()
in order to stop and release the background thread.
HttpClient
is configured to use a shared connection manager.
HttpClient
is created inside an EJB container.
HttpClientBuilder.evictExpiredConnections()
public RestClientBuilder evictIdleConnections(long maxIdleTime, TimeUnit maxIdleTimeUnit)
HttpClient
proactively evict idle connections from the connection pool using a background thread.
Closeable.close()
in order to stop and release the background thread.
HttpClient
is configured to use a shared connection manager.
HttpClient
is created inside an EJB container.
maxIdleTime
- New property value.maxIdleTimeUnit
- New property value.HttpClientBuilder.evictIdleConnections(long,TimeUnit)
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.