public class MockRestClientBuilder extends RestClientBuilder
MockRestClient
objects.
Modifier | Constructor and Description |
---|---|
protected |
MockRestClientBuilder()
No-arg constructor.
|
protected |
MockRestClientBuilder(PropertyStore ps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
MockRestClientBuilder |
accept(Object value)
Sets the value for the
|
MockRestClientBuilder |
acceptCharset(Object value)
Sets the value for the
|
MockRestClientBuilder |
acceptEncoding(Object value)
Sets the value for the
|
MockRestClientBuilder |
acceptLanguage(Object value)
Sets the value for the
|
MockRestClientBuilder |
add(Map<String,Object> properties)
Adds multiple free-form configuration properties on this object without first clearing out any previous values.
|
MockRestClientBuilder |
addBeanTypes()
|
MockRestClientBuilder |
addInterceptorFirst(HttpRequestInterceptor itcp)
Adds this protocol interceptor to the head of the protocol processing list.
|
MockRestClientBuilder |
addInterceptorFirst(HttpResponseInterceptor itcp)
Adds this protocol interceptor to the head of the protocol processing list.
|
MockRestClientBuilder |
addInterceptorLast(HttpRequestInterceptor itcp)
Adds this protocol interceptor to the tail of the protocol processing list.
|
MockRestClientBuilder |
addInterceptorLast(HttpResponseInterceptor itcp)
Adds this protocol interceptor to the tail of the protocol processing list.
|
MockRestClientBuilder |
addRootType()
|
MockRestClientBuilder |
addTo(String name,
Object value)
Adds a free-form value to a SET property.
|
MockRestClientBuilder |
annotations(Annotation... values)
|
MockRestClientBuilder |
appendTo(String name,
Object value)
Adds a free-form value to the end of a LIST property.
|
MockRestClientBuilder |
apply(PropertyStore copyFrom)
Copies the settings from the specified property store into this builder.
|
MockRestClientBuilder |
applyAnnotations(AnnotationList al,
VarResolverSession r)
Applies a set of annotations to this property store.
|
MockRestClientBuilder |
applyAnnotations(Class<?>... fromClasses)
Applies any of the various
|
MockRestClientBuilder |
applyAnnotations(Method... fromMethods)
Applies any of the various
|
MockRestClientBuilder |
authorization(Object value)
Sets the value for the
|
MockRestClientBuilder |
backoffManager(BackoffManager backoffManager)
Assigns
BackoffManager instance. |
MockRestClientBuilder |
basicAuth(String host,
int port,
String user,
String pw)
Set up this client to use BASIC auth.
|
MockRestClientBuilder |
beanClassVisibility(Visibility value)
|
MockRestClientBuilder |
beanConstructorVisibility(Visibility value)
|
MockRestClientBuilder |
beanFieldVisibility(Visibility value)
|
MockRestClientBuilder |
beanInterceptor(Class<?> on,
Class<? extends BeanInterceptor<?>> value)
Bean interceptor.
|
MockRestClientBuilder |
beanMethodVisibility(Visibility value)
|
MockRestClientBuilder |
beansDontRequireSomeProperties()
|
MockRestClientBuilder |
beansRequireDefaultConstructor()
|
MockRestClientBuilder |
beansRequireSerializable()
|
MockRestClientBuilder |
beansRequireSettersForGetters()
|
MockRestClientBuilder |
bpi(Class<?> beanClass,
String properties)
Bean property includes.
|
MockRestClientBuilder |
bpi(Map<String,Object> values)
Bean property includes.
|
MockRestClientBuilder |
bpi(String beanClassName,
String properties)
Bean property includes.
|
MockRestClientBuilder |
bpro(Class<?> beanClass,
String properties)
Read-only bean properties.
|
MockRestClientBuilder |
bpro(Map<String,Object> values)
Read-only bean properties.
|
MockRestClientBuilder |
bpro(String beanClassName,
String properties)
Read-only bean properties.
|
MockRestClientBuilder |
bpwo(Class<?> beanClass,
String properties)
Write-only bean properties.
|
MockRestClientBuilder |
bpwo(Map<String,Object> values)
Write-only bean properties.
|
MockRestClientBuilder |
bpwo(String beanClassName,
String properties)
Write-only bean properties.
|
MockRestClientBuilder |
bpx(Class<?> beanClass,
String properties)
Bean property excludes.
|
MockRestClientBuilder |
bpx(Map<String,Object> values)
Bean property excludes.
|
MockRestClientBuilder |
bpx(String beanClassName,
String properties)
Bean property excludes.
|
MockRestClient |
build()
Build the object.
|
<T extends Context> |
build(Class<T> c)
Build a new instance of the specified object.
|
MockRestClientBuilder |
cacheControl(Object value)
Sets the value for the
|
MockRestClientBuilder |
callHandler(Class<? extends RestCallHandler> value)
|
MockRestClientBuilder |
callHandler(RestCallHandler value)
|
MockRestClientBuilder |
clientVersion(Object value)
Sets the client version by setting the value for the
|
MockRestClientBuilder |
connection(Object value)
Sets the value for the
|
MockRestClientBuilder |
connectionBackoffStrategy(ConnectionBackoffStrategy connectionBackoffStrategy)
Assigns
ConnectionBackoffStrategy instance. |
MockRestClientBuilder |
connectionManager(HttpClientConnectionManager connManager)
Assigns
HttpClientConnectionManager instance. |
MockRestClientBuilder |
connectionManagerShared(boolean shared)
Defines the connection manager is to be shared by multiple client instances.
|
MockRestClientBuilder |
connectionReuseStrategy(ConnectionReuseStrategy reuseStrategy)
Assigns
ConnectionReuseStrategy instance. |
MockRestClientBuilder |
connectionTimeToLive(long connTimeToLive,
TimeUnit connTimeToLiveTimeUnit)
Sets maximum time to live for persistent connections.
|
MockRestClientBuilder |
console(Class<? extends PrintStream> value)
|
MockRestClientBuilder |
console(PrintStream value)
|
MockRestClientBuilder |
contentDecoderRegistry(Map<String,InputStreamFactory> contentDecoderMap)
Assigns a map of
InputStreamFactories to be used for automatic content decompression. |
MockRestClientBuilder |
contentEncoding(Object value)
Sets the value for the
|
MockRestClientBuilder |
contentLength(Object value)
Sets the value for the
|
MockRestClientBuilder |
contentType(Object value)
Sets the value for the
|
MockRestClientBuilder |
contextPath(String value)
Identifies the context path for the REST resource.
|
MockRestClientBuilder |
date(Object value)
Sets the value for the
|
MockRestClientBuilder |
debug()
|
MockRestClientBuilder |
debugOutputLines(int value)
|
MockRestClientBuilder |
defaultAuthSchemeRegistry(Lookup<AuthSchemeProvider> authSchemeRegistry)
Assigns default
AuthScheme registry which will be used for request execution if not explicitly set in the client execution context. |
MockRestClientBuilder |
defaultConnectionConfig(ConnectionConfig config)
Assigns default
ConnectionConfig . |
MockRestClientBuilder |
defaultCookieSpecRegistry(Lookup<CookieSpecProvider> cookieSpecRegistry)
Assigns default
CookieSpec registry which will be used for request execution if not explicitly set in the client execution context. |
MockRestClientBuilder |
defaultCookieStore(CookieStore cookieStore)
Assigns default
CookieStore instance which will be used for request execution if not explicitly set in the client execution context. |
MockRestClientBuilder |
defaultCredentialsProvider(CredentialsProvider credentialsProvider)
Assigns default
CredentialsProvider instance which will be used for request execution if not explicitly set in the client execution context. |
MockRestClientBuilder |
defaultHeaders(Collection<? extends Header> defaultHeaders)
Assigns default request header values.
|
MockRestClientBuilder |
defaultRequestConfig(RequestConfig config)
Assigns default
RequestConfig instance which will be used for request execution if not explicitly set in the client execution context. |
MockRestClientBuilder |
defaultSocketConfig(SocketConfig config)
Assigns default
SocketConfig . |
MockRestClientBuilder |
detectRecursions()
|
MockRestClientBuilder |
dictionary(Object... values)
|
MockRestClientBuilder |
dictionaryOn(Class<?> on,
Class<?>... values)
|
MockRestClientBuilder |
disableAuthCaching()
Disables authentication scheme caching.
|
MockRestClientBuilder |
disableAutomaticRetries()
Disables automatic request recovery and re-execution.
|
MockRestClientBuilder |
disableConnectionState()
Disables connection state tracking.
|
MockRestClientBuilder |
disableContentCompression()
Disables automatic content decompression.
|
MockRestClientBuilder |
disableCookieManagement()
Disables state (cookie) management.
|
MockRestClientBuilder |
disableRedirectHandling()
Disables automatic redirect handling.
|
MockRestClientBuilder |
dontIgnorePropertiesWithoutSetters()
|
MockRestClientBuilder |
dontIgnoreTransientFields()
|
MockRestClientBuilder |
dontIgnoreUnknownNullBeanProperties()
|
MockRestClientBuilder |
dontUseInterfaceProxies()
|
MockRestClientBuilder |
errorCodes(Predicate<Integer> value)
|
MockRestClientBuilder |
evictExpiredConnections()
Makes this instance of
HttpClient proactively evict expired connections from the connection pool using a background thread. |
MockRestClientBuilder |
evictIdleConnections(long maxIdleTime,
TimeUnit maxIdleTimeUnit)
Makes this instance of
HttpClient proactively evict idle connections from the connection pool using a background thread. |
MockRestClientBuilder |
executorService(ExecutorService executorService,
boolean shutdownOnClose)
|
MockRestClientBuilder |
expect(Object value)
Sets the value for the
|
MockRestClientBuilder |
fluentSetters()
|
MockRestClientBuilder |
fluentSetters(Class<?> on)
|
MockRestClientBuilder |
formData(NameValuePair pair)
Adds a form-data parameter to all request bodies.
|
MockRestClientBuilder |
formData(String name,
Object value)
Adds a form-data parameter to all request bodies.
|
MockRestClientBuilder |
formData(String name,
Object value,
HttpPartSchema schema)
Adds a form-data parameter to all request bodies.
|
MockRestClientBuilder |
formData(String name,
Object value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Adds a form-data parameter to all request bodies.
|
MockRestClientBuilder |
formData(String name,
Supplier<?> value)
Adds a form-data parameter with a dynamic value to all request bodies.
|
MockRestClientBuilder |
formData(String name,
Supplier<?> value,
HttpPartSchema schema)
Adds a form-data parameter with a dynamic value to all request bodies.
|
MockRestClientBuilder |
formData(String name,
Supplier<?> value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Adds a form-data parameter with a dynamic value to all request bodies.
|
MockRestClientBuilder |
formDataPairs(Object... pairs)
Adds form-data parameters to all request bodies using free-form key/value pairs.
|
MockRestClientBuilder |
formDatas(Object... params)
Adds a form-data parameter to all request bodies.
|
MockRestClientBuilder |
forwarded(Object value)
Sets the value for the
|
MockRestClientBuilder |
from(Object value)
Sets the value for the
|
MockRestClientBuilder |
header(Header header)
Sets a header on all requests.
|
MockRestClientBuilder |
header(String name,
Object value)
Sets a header on all requests.
|
MockRestClientBuilder |
header(String name,
Object value,
HttpPartSchema schema)
Sets a header on all requests.
|
MockRestClientBuilder |
header(String name,
Object value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Sets a header on all requests.
|
MockRestClientBuilder |
header(String name,
Supplier<?> value)
Sets a header with a dynamic value on all requests.
|
MockRestClientBuilder |
header(String name,
Supplier<?> value,
HttpPartSchema schema)
Sets a header with a dynamic value on all requests.
|
MockRestClientBuilder |
header(String name,
Supplier<?> value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Sets a header with a dynamic value on all requests.
|
MockRestClientBuilder |
headerPairs(Object... pairs)
Sets multiple headers on all requests using freeform key/value pairs.
|
MockRestClientBuilder |
headers(Object... headers)
Sets multiple headers on all requests.
|
MockRestClientBuilder |
host(Object value)
Sets the value for the
|
MockRestClientBuilder |
html()
Convenience method for specifying HTML as the marshalling transmission media type.
|
MockRestClientBuilder |
htmlDoc()
Convenience method for specifying HTML DOC as the marshalling transmission media type.
|
MockRestClientBuilder |
htmlStrippedDoc()
Convenience method for specifying Stripped HTML DOC as the marshalling transmission media type.
|
MockRestClientBuilder |
httpClient(CloseableHttpClient value)
Sets the
HttpClient to be used to handle all HTTP communications with the target server. |
MockRestClientBuilder |
httpClientBuilder(HttpClientBuilder value)
|
MockRestClientBuilder |
httpProcessor(HttpProcessor httpprocessor)
Assigns
HttpProcessor instance. |
MockRestClientBuilder |
ifMatch(Object value)
Sets the value for the
|
MockRestClientBuilder |
ifModifiedSince(Object value)
Sets the value for the
|
MockRestClientBuilder |
ifNoneMatch(Object value)
Sets the value for the
|
MockRestClientBuilder |
ifRange(Object value)
Sets the value for the
|
MockRestClientBuilder |
ifUnmodifiedSince(Object value)
Sets the value for the
|
MockRestClientBuilder |
ignoreErrors()
|
MockRestClientBuilder |
ignoreErrors(boolean value)
|
MockRestClientBuilder |
ignoreInvocationExceptionsOnGetters()
|
MockRestClientBuilder |
ignoreInvocationExceptionsOnSetters()
|
MockRestClientBuilder |
ignoreRecursions()
|
MockRestClientBuilder |
ignoreUnknownBeanProperties()
|
MockRestClientBuilder |
implClass(Class<?> interfaceClass,
Class<?> implClass)
|
MockRestClientBuilder |
implClasses(Map<Class<?>,Class<?>> values)
|
MockRestClientBuilder |
initialDepth(int value)
|
MockRestClientBuilder |
interceptors(Class<?>... values)
|
MockRestClientBuilder |
interceptors(Object... value)
|
MockRestClientBuilder |
interfaceClass(Class<?> on,
Class<?> value)
Identifies a class to be used as the interface class for the specified class and all subclasses.
|
MockRestClientBuilder |
interfaces(Class<?>... value)
Identifies a set of interfaces.
|
MockRestClientBuilder |
json()
Convenience method for specifying JSON as the marshalling transmission media type.
|
MockRestClientBuilder |
keepAliveStrategy(ConnectionKeepAliveStrategy keepAliveStrategy)
Assigns
ConnectionKeepAliveStrategy instance. |
MockRestClientBuilder |
keepHttpClientOpen()
|
MockRestClientBuilder |
keepNullProperties()
|
MockRestClientBuilder |
leakDetection()
|
MockRestClientBuilder |
locale(Locale value)
|
MockRestClientBuilder |
logger(Logger value)
|
MockRestClientBuilder |
logRequests(DetailLevel detail,
Level level,
BiPredicate<RestRequest,RestResponse> test)
|
MockRestClientBuilder |
logToConsole()
|
MockRestClientBuilder |
marshall(Marshall value)
|
MockRestClientBuilder |
marshalls(Marshall... value)
|
MockRestClientBuilder |
maxConnPerRoute(int maxConnPerRoute)
Assigns maximum connection per route value.
|
MockRestClientBuilder |
maxConnTotal(int maxConnTotal)
Assigns maximum total connection value.
|
MockRestClientBuilder |
maxDepth(int value)
|
MockRestClientBuilder |
maxForwards(Object value)
Sets the value for the
|
MockRestClientBuilder |
maxIndent(int value)
|
MockRestClientBuilder |
mediaType(MediaType value)
|
MockRestClientBuilder |
msgPack()
Convenience method for specifying MessagePack as the marshalling transmission media type.
|
MockRestClientBuilder |
notBeanClasses(Object... values)
|
MockRestClientBuilder |
notBeanPackages(Object... values)
|
MockRestClientBuilder |
noTrace()
When called,
|
MockRestClientBuilder |
oapiCollectionFormat(HttpPartCollectionFormat value)
|
MockRestClientBuilder |
oapiFormat(HttpPartFormat value)
|
MockRestClientBuilder |
openApi()
Convenience method for specifying OpenAPI as the marshalling transmission media type.
|
MockRestClientBuilder |
origin(Object value)
Sets the value for the
|
MockRestClientBuilder |
paramFormat(ParamFormat value)
|
MockRestClientBuilder |
paramFormatPlain()
|
MockRestClientBuilder |
parser(Class<? extends Parser> value)
|
MockRestClientBuilder |
parser(Parser value)
|
MockRestClientBuilder |
parsers(Class<? extends Parser>... value)
|
MockRestClientBuilder |
parsers(Parser... value)
|
MockRestClientBuilder |
partParser(Class<? extends HttpPartParser> value)
|
MockRestClientBuilder |
partParser(HttpPartParser value)
|
MockRestClientBuilder |
partSerializer(Class<? extends HttpPartSerializer> value)
|
MockRestClientBuilder |
partSerializer(HttpPartSerializer value)
|
MockRestClientBuilder |
pathVars(Map<String,String> value)
Add resolved path variables to this client.
|
MockRestClientBuilder |
pathVars(String... pairs)
Add resolved path variables to this client.
|
MockRestClientBuilder |
plainText()
Convenience method for specifying Plain Text as the marshalling transmission media type.
|
MockRestClientBuilder |
pooled()
When called, the
RestClientBuilder.createConnectionManager() method will return a PoolingHttpClientConnectionManager
instead of a BasicHttpClientConnectionManager . |
MockRestClientBuilder |
pragma(Object value)
Sets the value for the
|
MockRestClientBuilder |
prependTo(String name,
Object value)
Adds a free-form value to the beginning of a LIST property.
|
MockRestClientBuilder |
propertyNamer(Class<?> on,
Class<? extends PropertyNamer> value)
Bean property namer
|
MockRestClientBuilder |
propertyNamer(Class<? extends PropertyNamer> value)
|
MockRestClientBuilder |
proxy(HttpHost proxy)
Assigns default proxy value.
|
MockRestClientBuilder |
proxyAuthenticationStrategy(AuthenticationStrategy proxyAuthStrategy)
Assigns
AuthenticationStrategy instance for proxy authentication. |
MockRestClientBuilder |
proxyAuthorization(Object value)
Sets the value for the
|
MockRestClientBuilder |
publicSuffixMatcher(PublicSuffixMatcher publicSuffixMatcher)
Assigns file containing public suffix matcher.
|
MockRestClientBuilder |
putAllTo(String name,
Object value)
Adds or overwrites multiple free-form entries in a MAP property.
|
MockRestClientBuilder |
putTo(String name,
String key,
Object value)
Adds or overwrites a free-form entry in a MAP property.
|
MockRestClientBuilder |
queries(Object... params)
Adds a query parameter to the URI.
|
MockRestClientBuilder |
query(NameValuePair pair)
Adds a query parameter to the URI.
|
MockRestClientBuilder |
query(String name,
Object value)
Adds a query parameter to the URI.
|
MockRestClientBuilder |
query(String name,
Object value,
HttpPartSchema schema)
Adds a query parameter to the URI.
|
MockRestClientBuilder |
query(String name,
Object value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Adds a query parameter to the URI.
|
MockRestClientBuilder |
query(String name,
Supplier<?> value)
Adds a query parameter with a dynamic value to the URI.
|
MockRestClientBuilder |
query(String name,
Supplier<?> value,
HttpPartSchema schema)
Adds a query parameter with a dynamic value to the URI.
|
MockRestClientBuilder |
query(String name,
Supplier<?> value,
HttpPartSchema schema,
HttpPartSerializer serializer)
Adds a query parameter with a dynamic value to the URI.
|
MockRestClientBuilder |
queryPairs(Object... pairs)
Adds query parameters to the URI query using free-form key/value pairs.
|
MockRestClientBuilder |
quoteChar(char value)
|
MockRestClientBuilder |
range(Object value)
Sets the value for the
|
MockRestClientBuilder |
redirectStrategy(RedirectStrategy redirectStrategy)
Assigns
RedirectStrategy instance. |
MockRestClientBuilder |
referer(Object value)
Sets the value for the
|
MockRestClientBuilder |
removeFrom(String name,
Object value)
Removes a free-form value from a SET, LIST, or MAP property.
|
MockRestClientBuilder |
requestExecutor(HttpRequestExecutor requestExec)
Assigns
HttpRequestExecutor instance. |
MockRestClientBuilder |
restBean(Object bean)
Specifies the
Rest -annotated bean class or instance to test against. |
MockRestClientBuilder |
retryHandler(HttpRequestRetryHandler retryHandler)
Assigns
HttpRequestRetryHandler instance. |
MockRestClientBuilder |
rootUri(Object value)
|
MockRestClientBuilder |
routePlanner(HttpRoutePlanner routePlanner)
Assigns
HttpRoutePlanner instance. |
MockRestClientBuilder |
schemePortResolver(SchemePortResolver schemePortResolver)
Assigns
SchemePortResolver instance. |
MockRestClientBuilder |
serializer(Class<? extends Serializer> value)
|
MockRestClientBuilder |
serializer(Serializer value)
|
MockRestClientBuilder |
serializers(Class<? extends Serializer>... value)
|
MockRestClientBuilder |
serializers(Serializer... value)
|
MockRestClientBuilder |
serviceUnavailableRetryStrategy(ServiceUnavailableRetryStrategy serviceUnavailStrategy)
Assigns
ServiceUnavailableRetryStrategy instance. |
MockRestClientBuilder |
servletPath(String value)
Identifies the servlet path for the REST resource.
|
MockRestClientBuilder |
set(Map<String,Object> properties)
Sets multiple free-form configuration properties on this object replacing all previous values.
|
MockRestClientBuilder |
set(String name,
Object value)
Sets a free-form configuration property on this object.
|
MockRestClientBuilder |
simpleJson()
Convenience method for specifying Simplified JSON as the marshalling transmission media type.
|
MockRestClientBuilder |
sortCollections()
|
MockRestClientBuilder |
sortMaps()
|
MockRestClientBuilder |
sortProperties()
|
MockRestClientBuilder |
sortProperties(Class<?>... on)
Sort bean properties.
|
MockRestClientBuilder |
sq()
|
MockRestClientBuilder |
sslContext(SSLContext sslContext)
Assigns
SSLContext instance. |
MockRestClientBuilder |
sslHostnameVerifier(HostnameVerifier hostnameVerifier)
Assigns
HostnameVerifier instance. |
MockRestClientBuilder |
sslSocketFactory(LayeredConnectionSocketFactory sslSocketFactory)
Assigns
LayeredConnectionSocketFactory instance. |
MockRestClientBuilder |
stopClass(Class<?> on,
Class<?> value)
Identifies a stop class for the annotated class.
|
MockRestClientBuilder |
strict()
|
MockRestClientBuilder |
swaps(Object... values)
|
MockRestClientBuilder |
targetAuthenticationStrategy(AuthenticationStrategy targetAuthStrategy)
Assigns
AuthenticationStrategy instance for target host authentication. |
MockRestClientBuilder |
te(Object value)
Sets the value for the
|
MockRestClientBuilder |
timeZone(TimeZone value)
|
MockRestClientBuilder |
trimEmptyCollections()
|
MockRestClientBuilder |
trimEmptyMaps()
|
MockRestClientBuilder |
trimStringsOnRead()
|
MockRestClientBuilder |
trimStringsOnWrite()
|
MockRestClientBuilder |
typeName(Class<?> on,
String value)
An identifying name for this class.
|
MockRestClientBuilder |
typePropertyName(Class<?> on,
String value)
|
MockRestClientBuilder |
typePropertyName(String value)
|
MockRestClientBuilder |
uon()
Convenience method for specifying UON as the marshalling transmission media type.
|
MockRestClientBuilder |
upgrade(Object value)
Sets the value for the
|
MockRestClientBuilder |
uriContext(UriContext value)
|
MockRestClientBuilder |
uriRelativity(UriRelativity value)
|
MockRestClientBuilder |
uriResolution(UriResolution value)
|
MockRestClientBuilder |
urlEnc()
Convenience method for specifying URL-Encoding as the marshalling transmission media type.
|
MockRestClientBuilder |
useEnumNames()
|
MockRestClientBuilder |
useJavaBeanIntrospector()
|
MockRestClientBuilder |
userAgent(Object value)
Sets the value for the
|
MockRestClientBuilder |
userAgent(String userAgent)
Assigns
|
MockRestClientBuilder |
userTokenHandler(UserTokenHandler userTokenHandler)
Assigns
UserTokenHandler instance. |
MockRestClientBuilder |
useSystemProperties()
Use system properties when creating and configuring default implementations.
|
MockRestClientBuilder |
useWhitespace()
|
MockRestClientBuilder |
via(Object value)
Sets the value for the
|
MockRestClientBuilder |
warning(Object value)
Sets the value for the
|
MockRestClientBuilder |
ws()
|
MockRestClientBuilder |
xml()
Convenience method for specifying XML as the marshalling transmission media type.
|
createConnectionManager, createHttpClient, createHttpClientBuilder, universal
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 MockRestClientBuilder(PropertyStore ps)
ps
- Initial configuration properties for this builder.protected MockRestClientBuilder()
Provided so that this class can be easily subclassed.
public MockRestClientBuilder restBean(Object bean)
Rest
-annotated bean class or instance to test against.bean
- The Rest
-annotated bean class or instance.public MockRestClientBuilder contextPath(String value)
This value is used to deconstruct the request URL and set the appropriate URL getters on the HttpServletRequest
object correctly.
Should either be a value such as
The following fixes are applied to non-conforming strings.
value
- The context path.public MockRestClientBuilder servletPath(String value)
This value is used to deconstruct the request URL and set the appropriate URL getters on the HttpServletRequest
object correctly.
Should either be a value such as
The following fixes are applied to non-conforming strings.
value
- The context path.public MockRestClientBuilder pathVars(Map<String,String> value)
Allows you to add resolved parent path variables when performing tests on child resource classes.
value
- The path variables.MockServletRequest.pathVars(Map)
public MockRestClientBuilder pathVars(String... pairs)
Identical to pathVars(Map)
but allows you to specify as a list of key/value pairs.
pairs
- The key/value pairs. Must be an even number of parameters.public MockRestClient build()
ContextBuilder
build
in class RestClientBuilder
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 RestClientBuilder
c
- The subclass of Context
to instantiate.public MockRestClientBuilder 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 RestClientBuilder
properties
- The properties to set on this class.
public MockRestClientBuilder 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 RestClientBuilder
name
- The property name.value
- The new value to add to the SET property.
public MockRestClientBuilder 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 RestClientBuilder
name
- The property name.value
- The new value to add to the LIST property.
public MockRestClientBuilder apply(PropertyStore copyFrom)
ContextBuilder
apply
in class RestClientBuilder
copyFrom
- The property store whose settings are being copied.public MockRestClientBuilder 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 RestClientBuilder
fromClasses
- The classes on which the annotations are defined.public MockRestClientBuilder 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 RestClientBuilder
fromMethods
- The methods on which the annotations are defined.public MockRestClientBuilder 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 RestClientBuilder
al
- The list of all annotations annotated with PropertyStoreApply
.r
- The string resolver for resolving variables in annotation values.public MockRestClientBuilder debug()
ContextBuilder
Enables the following additional information during serialization:
BeanTraverseContext.BEANTRAVERSE_detectRecursions
.
Enables the following additional information during parsing:
debug
in class RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
name
- The property name.value
- The new value to add to the LIST property.
public MockRestClientBuilder 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 RestClientBuilder
name
- The property name.value
- Either a JSON Object string or a Map
whose valid value types depend on the property type:
public MockRestClientBuilder 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 RestClientBuilder
name
- The property name.key
- The property value map key.value
- The property value map value.
public MockRestClientBuilder removeFrom(String name, Object value)
ContextBuilder
removeFrom
in class RestClientBuilder
name
- The property name.value
- The property value in the SET/LIST/MAP property.public MockRestClientBuilder 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 RestClientBuilder
properties
- The properties to set on this class.
public MockRestClientBuilder 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 RestClientBuilder
name
- The property name.value
- The property value.
public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this property.public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public MockRestClientBuilder 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 RestClientBuilder
on
- The bean that the filter applies to.value
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.
Visibility.PUBLIC
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this builder.
public MockRestClientBuilder 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 RestClientBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public MockRestClientBuilder 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 RestClientBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this builder.
public MockRestClientBuilder 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 RestClientBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public MockRestClientBuilder 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 RestClientBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this builder.
public MockRestClientBuilder 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 RestClientBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public MockRestClientBuilder 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 RestClientBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this builder.
public MockRestClientBuilder 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 RestClientBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public MockRestClientBuilder 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 RestClientBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this property.public MockRestClientBuilder 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 RestClientBuilder
on
- The class that the dictionary values apply to.values
- The new values for this property.public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder dontIgnoreUnknownNullBeanProperties()
BeanContextBuilder
When enabled, trying to set a BeanRuntimeException
is thrown.
dontIgnoreUnknownNullBeanProperties
in class RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder fluentSetters(Class<?> on)
BeanContextBuilder
Identical to BeanContextBuilder.fluentSetters()
but enables it on a specific class only.
Bean.fluentSetters()
annotation.
fluentSetters
in class RestClientBuilder
on
- The class that this applies to.public MockRestClientBuilder ignoreInvocationExceptionsOnGetters()
BeanContextBuilder
When enabled, errors thrown when calling bean getter methods will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnGetters
in class RestClientBuilder
public MockRestClientBuilder ignoreInvocationExceptionsOnSetters()
BeanContextBuilder
When enabled, errors thrown when calling bean setter methods will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnSetters
in class RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
interfaceClass
- The interface class.implClass
- The implementation class.public MockRestClientBuilder 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 RestClientBuilder
values
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
on
- The class that the interface class applies to.value
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this property.
public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this property.
Package
objects.
public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this setting.
PropertyNamerDefault
.public MockRestClientBuilder 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 RestClientBuilder
on
- The class that the namer applies to.value
- The new value for this setting.
PropertyNamerDefault
.public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder sortProperties(Class<?>... on)
BeanContextBuilder
Same as BeanContextBuilder.sortProperties()
but allows you to specify individual bean classes instead of globally.
sortProperties
in class RestClientBuilder
on
- The bean classes to sort properties on.public MockRestClientBuilder 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 RestClientBuilder
on
- The class on which the stop class is being applied.value
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
values
- The values to add to this property.
PojoSwap
.
SurrogateSwap
.
public MockRestClientBuilder 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 RestClientBuilder
on
- The class the type name is being defined on.value
- The new value for this property.public MockRestClientBuilder 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 RestClientBuilder
value
- The new value for this property.
public MockRestClientBuilder typePropertyName(Class<?> on, String value)
BeanContextBuilder
Same as BeanContextBuilder.typePropertyName(String)
except targets a specific bean class instead of globally.
typePropertyName
in class RestClientBuilder
on
- The class the type property name applies to.value
- The new value for this property.
public MockRestClientBuilder useEnumNames()
BeanContextBuilder
When enabled, enums are always serialized by name, not using Object.toString()
.
useEnumNames
in class RestClientBuilder
public MockRestClientBuilder 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 RestClientBuilder
public MockRestClientBuilder accept(Object value)
RestClientBuilder
This overrides the media type specified on the parser, but is overridden by calling
header(
accept
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder acceptCharset(Object value)
RestClientBuilder
This is a shortcut for calling header(
acceptCharset
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder acceptEncoding(Object value)
RestClientBuilder
This is a shortcut for calling header(
acceptEncoding
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder acceptLanguage(Object value)
RestClientBuilder
This is a shortcut for calling header(
acceptLanguage
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder addBeanTypes()
RestClientBuilder
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:
RestClientBuilder.addRootType()
- Affects whether RestClientBuilder.addBeanTypes()
- Affects whether
addBeanTypes
in class RestClientBuilder
public MockRestClientBuilder addInterceptorFirst(HttpRequestInterceptor itcp)
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
addInterceptorFirst
in class RestClientBuilder
itcp
- New property value.HttpClientBuilder.addInterceptorFirst(HttpRequestInterceptor)
public MockRestClientBuilder addInterceptorFirst(HttpResponseInterceptor itcp)
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
addInterceptorFirst
in class RestClientBuilder
itcp
- New property value.HttpClientBuilder.addInterceptorFirst(HttpResponseInterceptor)
public MockRestClientBuilder addInterceptorLast(HttpRequestInterceptor itcp)
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
addInterceptorLast
in class RestClientBuilder
itcp
- New property value.HttpClientBuilder.addInterceptorLast(HttpRequestInterceptor)
public MockRestClientBuilder addInterceptorLast(HttpResponseInterceptor itcp)
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
addInterceptorLast
in class RestClientBuilder
itcp
- New property value.HttpClientBuilder.addInterceptorLast(HttpResponseInterceptor)
public MockRestClientBuilder addRootType()
RestClientBuilder
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:
RestClientBuilder.addRootType()
- Affects whether RestClientBuilder.addBeanTypes()
- Affects whether
addRootType
in class RestClientBuilder
public MockRestClientBuilder authorization(Object value)
RestClientBuilder
This is a shortcut for calling header(
authorization
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder backoffManager(BackoffManager backoffManager)
RestClientBuilder
BackoffManager
instance.backoffManager
in class RestClientBuilder
backoffManager
- New property value.HttpClientBuilder.setBackoffManager(BackoffManager)
public MockRestClientBuilder basicAuth(String host, int port, String user, String pw)
RestClientBuilder
basicAuth
in class RestClientBuilder
host
- The auth scope hostname.port
- The auth scope port.user
- The username.pw
- The password.public MockRestClientBuilder cacheControl(Object value)
RestClientBuilder
This is a shortcut for calling header(
cacheControl
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder callHandler(Class<? extends RestCallHandler> value)
RestClientBuilder
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.
callHandler
in class RestClientBuilder
value
- The new value for this setting.
public MockRestClientBuilder callHandler(RestCallHandler value)
RestClientBuilder
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.
callHandler
in class RestClientBuilder
value
- The new value for this setting.
public MockRestClientBuilder clientVersion(Object value)
RestClientBuilder
clientVersion
in class RestClientBuilder
value
- The version string (e.g. public MockRestClientBuilder connection(Object value)
RestClientBuilder
This is a shortcut for calling header(
connection
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder connectionBackoffStrategy(ConnectionBackoffStrategy connectionBackoffStrategy)
RestClientBuilder
ConnectionBackoffStrategy
instance.connectionBackoffStrategy
in class RestClientBuilder
connectionBackoffStrategy
- New property value.HttpClientBuilder.setConnectionBackoffStrategy(ConnectionBackoffStrategy)
public MockRestClientBuilder connectionManager(HttpClientConnectionManager connManager)
RestClientBuilder
HttpClientConnectionManager
instance.connectionManager
in class RestClientBuilder
connManager
- New property value.HttpClientBuilder.setConnectionManager(HttpClientConnectionManager)
public MockRestClientBuilder connectionManagerShared(boolean shared)
RestClientBuilder
connectionManagerShared
in class RestClientBuilder
shared
- New property value.HttpClientBuilder.setConnectionManagerShared(boolean)
public MockRestClientBuilder connectionReuseStrategy(ConnectionReuseStrategy reuseStrategy)
RestClientBuilder
ConnectionReuseStrategy
instance.connectionReuseStrategy
in class RestClientBuilder
reuseStrategy
- New property value.HttpClientBuilder.setConnectionReuseStrategy(ConnectionReuseStrategy)
public MockRestClientBuilder connectionTimeToLive(long connTimeToLive, TimeUnit connTimeToLiveTimeUnit)
RestClientBuilder
RestClientBuilder.connectionManager(HttpClientConnectionManager)
method.
connectionTimeToLive
in class RestClientBuilder
connTimeToLive
- New property value.connTimeToLiveTimeUnit
- New property value.HttpClientBuilder.setConnectionTimeToLive(long,TimeUnit)
public MockRestClientBuilder console(PrintStream value)
RestClientBuilder
Allows you to redirect the console output to a different print stream.
console
in class RestClientBuilder
value
- The new value for this setting.public MockRestClientBuilder console(Class<? extends PrintStream> value)
RestClientBuilder
Allows you to redirect the console output to a different print stream.
console
in class RestClientBuilder
value
- The new value for this setting.public MockRestClientBuilder contentDecoderRegistry(Map<String,InputStreamFactory> contentDecoderMap)
RestClientBuilder
InputStreamFactories
to be used for automatic content decompression.contentDecoderRegistry
in class RestClientBuilder
contentDecoderMap
- New property value.HttpClientBuilder.setContentDecoderRegistry(Map)
public MockRestClientBuilder contentEncoding(Object value)
RestClientBuilder
This is a shortcut for calling header(
contentEncoding
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder contentLength(Object value)
RestClientBuilder
This is a shortcut for calling header(
contentLength
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder contentType(Object value)
RestClientBuilder
This overrides the media type specified on the serializer, but is overridden by calling
header(
contentType
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder date(Object value)
RestClientBuilder
This is a shortcut for calling header(
date
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder debugOutputLines(int value)
RestClientBuilder
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.
debugOutputLines
in class RestClientBuilder
value
- The new value for this property.
public MockRestClientBuilder defaultAuthSchemeRegistry(Lookup<AuthSchemeProvider> authSchemeRegistry)
RestClientBuilder
AuthScheme
registry which will be used for request execution if not explicitly set in the client execution context.defaultAuthSchemeRegistry
in class RestClientBuilder
authSchemeRegistry
- New property value.HttpClientBuilder.setDefaultAuthSchemeRegistry(Lookup)
public MockRestClientBuilder defaultConnectionConfig(ConnectionConfig config)
RestClientBuilder
ConnectionConfig
.
RestClientBuilder.connectionManager(HttpClientConnectionManager)
method.
defaultConnectionConfig
in class RestClientBuilder
config
- New property value.HttpClientBuilder.setDefaultConnectionConfig(ConnectionConfig)
public MockRestClientBuilder defaultCookieSpecRegistry(Lookup<CookieSpecProvider> cookieSpecRegistry)
RestClientBuilder
CookieSpec
registry which will be used for request execution if not explicitly set in the client execution context.defaultCookieSpecRegistry
in class RestClientBuilder
cookieSpecRegistry
- New property value.HttpClientBuilder.setDefaultCookieSpecRegistry(Lookup)
public MockRestClientBuilder defaultCookieStore(CookieStore cookieStore)
RestClientBuilder
CookieStore
instance which will be used for request execution if not explicitly set in the client execution context.defaultCookieStore
in class RestClientBuilder
cookieStore
- New property value.HttpClientBuilder.setDefaultCookieStore(CookieStore)
public MockRestClientBuilder defaultCredentialsProvider(CredentialsProvider credentialsProvider)
RestClientBuilder
CredentialsProvider
instance which will be used for request execution if not explicitly set in the client execution context.defaultCredentialsProvider
in class RestClientBuilder
credentialsProvider
- New property value.HttpClientBuilder.setDefaultCredentialsProvider(CredentialsProvider)
public MockRestClientBuilder defaultHeaders(Collection<? extends Header> defaultHeaders)
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
RestClientBuilder.headers(Object...)
is an equivalent method.
defaultHeaders
in class RestClientBuilder
defaultHeaders
- New property value.HttpClientBuilder.setDefaultHeaders(Collection)
public MockRestClientBuilder defaultRequestConfig(RequestConfig config)
RestClientBuilder
RequestConfig
instance which will be used for request execution if not explicitly set in the client execution context.defaultRequestConfig
in class RestClientBuilder
config
- New property value.HttpClientBuilder.setDefaultRequestConfig(RequestConfig)
public MockRestClientBuilder defaultSocketConfig(SocketConfig config)
RestClientBuilder
SocketConfig
.
RestClientBuilder.connectionManager(HttpClientConnectionManager)
method.
defaultSocketConfig
in class RestClientBuilder
config
- New property value.HttpClientBuilder.setDefaultSocketConfig(SocketConfig)
public MockRestClientBuilder detectRecursions()
RestClientBuilder
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
detectRecursions
in class RestClientBuilder
public MockRestClientBuilder disableAuthCaching()
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
disableAuthCaching
in class RestClientBuilder
HttpClientBuilder.disableAuthCaching()
public MockRestClientBuilder disableAutomaticRetries()
RestClientBuilder
disableAutomaticRetries
in class RestClientBuilder
HttpClientBuilder.disableAutomaticRetries()
public MockRestClientBuilder disableConnectionState()
RestClientBuilder
disableConnectionState
in class RestClientBuilder
HttpClientBuilder.disableConnectionState()
public MockRestClientBuilder disableContentCompression()
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
disableContentCompression
in class RestClientBuilder
HttpClientBuilder.disableContentCompression()
public MockRestClientBuilder disableCookieManagement()
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
disableCookieManagement
in class RestClientBuilder
HttpClientBuilder.disableCookieManagement()
public MockRestClientBuilder disableRedirectHandling()
RestClientBuilder
disableRedirectHandling
in class RestClientBuilder
HttpClientBuilder.disableRedirectHandling()
public MockRestClientBuilder errorCodes(Predicate<Integer> value)
RestClientBuilder
Defines a predicate to test for error codes.
errorCodes
in class RestClientBuilder
value
- The new value for this setting.
x -> x >= 400
.public MockRestClientBuilder evictExpiredConnections()
RestClientBuilder
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.
evictExpiredConnections
in class RestClientBuilder
HttpClientBuilder.evictExpiredConnections()
public MockRestClientBuilder evictIdleConnections(long maxIdleTime, TimeUnit maxIdleTimeUnit)
RestClientBuilder
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.
evictIdleConnections
in class RestClientBuilder
maxIdleTime
- New property value.maxIdleTimeUnit
- New property value.HttpClientBuilder.evictIdleConnections(long,TimeUnit)
public MockRestClientBuilder executorService(ExecutorService executorService, boolean shutdownOnClose)
RestClientBuilder
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
in class RestClientBuilder
executorService
- The executor service.shutdownOnClose
- Call ExecutorService.shutdown()
when RestClient.close()
is called.public MockRestClientBuilder expect(Object value)
RestClientBuilder
This is a shortcut for calling header(
expect
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder formData(NameValuePair pair)
RestClientBuilder
RestClient
formData
in class RestClientBuilder
pair
- The form data parameter.public MockRestClientBuilder formData(String name, Object value)
RestClientBuilder
RestClient
formData
in class RestClientBuilder
name
- The parameter name.value
- The parameter value.
public MockRestClientBuilder formData(String name, Supplier<?> value)
RestClientBuilder
RestClient
formData
in class RestClientBuilder
name
- The parameter name.value
- The parameter value supplier.
public MockRestClientBuilder formData(String name, Object value, HttpPartSchema schema)
RestClientBuilder
String[]
formData
in class RestClientBuilder
name
- The parameter name.value
- The parameter value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public MockRestClientBuilder formData(String name, Supplier<?> value, HttpPartSchema schema)
RestClientBuilder
String[]
formData
in class RestClientBuilder
name
- The parameter name.value
- The parameter value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public MockRestClientBuilder formData(String name, Object value, HttpPartSchema schema, HttpPartSerializer serializer)
RestClientBuilder
String[]
formData
in class RestClientBuilder
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 MockRestClientBuilder formData(String name, Supplier<?> value, HttpPartSchema schema, HttpPartSerializer serializer)
RestClientBuilder
String[]
formData
in class RestClientBuilder
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 MockRestClientBuilder formDataPairs(Object... pairs)
RestClientBuilder
RestClient
formDataPairs
in class RestClientBuilder
pairs
- The form-data key/value pairs.
public MockRestClientBuilder formDatas(Object... params)
RestClientBuilder
RestClient
formDatas
in class RestClientBuilder
params
- The form-data parameters.
NameValuePair
NameValuePairable
Map.Entry
NameValuePairSupplier
Map
public MockRestClientBuilder forwarded(Object value)
RestClientBuilder
This is a shortcut for calling header(
forwarded
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder from(Object value)
RestClientBuilder
This is a shortcut for calling header(
from
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder header(Header header)
RestClientBuilder
RestClient
header
in class RestClientBuilder
header
- The header to set.public MockRestClientBuilder header(String name, Object value)
RestClientBuilder
RestClient
header
in class RestClientBuilder
name
- The header name.value
- The header value.
public MockRestClientBuilder header(String name, Supplier<?> value)
RestClientBuilder
RestClient
header
in class RestClientBuilder
name
- The header name.value
- The header value supplier.
public MockRestClientBuilder header(String name, Object value, HttpPartSchema schema)
RestClientBuilder
String[]
header
in class RestClientBuilder
name
- The header name.value
- The header value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public MockRestClientBuilder header(String name, Supplier<?> value, HttpPartSchema schema)
RestClientBuilder
String[]
header
in class RestClientBuilder
name
- The header name.value
- The header value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public MockRestClientBuilder header(String name, Object value, HttpPartSchema schema, HttpPartSerializer serializer)
RestClientBuilder
String[]
header
in class RestClientBuilder
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 MockRestClientBuilder header(String name, Supplier<?> value, HttpPartSchema schema, HttpPartSerializer serializer)
RestClientBuilder
String[]
header
in class RestClientBuilder
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 MockRestClientBuilder headerPairs(Object... pairs)
RestClientBuilder
RestClient
headerPairs
in class RestClientBuilder
pairs
- The header key/value pairs.
public MockRestClientBuilder headers(Object... headers)
RestClientBuilder
RestClient
headers
in class RestClientBuilder
headers
- The header to set.
Header
(including any subclasses such as Accept
)
Headerable
Map.Entry
HeaderSupplier
Map
public MockRestClientBuilder host(Object value)
RestClientBuilder
This is a shortcut for calling header(
host
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder html()
RestClientBuilder
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)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
html
in class RestClientBuilder
public MockRestClientBuilder htmlDoc()
RestClientBuilder
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)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
htmlDoc
in class RestClientBuilder
public MockRestClientBuilder htmlStrippedDoc()
RestClientBuilder
Same as RestClientBuilder.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)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
htmlStrippedDoc
in class RestClientBuilder
public MockRestClientBuilder httpClient(CloseableHttpClient value)
RestClientBuilder
HttpClient
to be used to handle all HTTP communications with the target server.
This can be used to bypass the client created by RestClientBuilder.createHttpClient()
method.
httpClient
in class RestClientBuilder
value
- The HttpClient
to be used to handle all HTTP communications with the target server.public MockRestClientBuilder httpClientBuilder(HttpClientBuilder value)
RestClientBuilder
HttpClientBuilder
that will be used to create the HttpClient
used by RestClient
.
This can be used to bypass the builder created by RestClientBuilder.createHttpClientBuilder()
method.
httpClientBuilder
in class RestClientBuilder
value
- The HttpClientBuilder
that will be used to create the HttpClient
used by RestClient
.public MockRestClientBuilder httpProcessor(HttpProcessor httpprocessor)
RestClientBuilder
HttpProcessor
instance.httpProcessor
in class RestClientBuilder
httpprocessor
- New property value.HttpClientBuilder.setHttpProcessor(HttpProcessor)
public MockRestClientBuilder ifMatch(Object value)
RestClientBuilder
This is a shortcut for calling header(
ifMatch
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder ifModifiedSince(Object value)
RestClientBuilder
This is a shortcut for calling header(
ifModifiedSince
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder ifNoneMatch(Object value)
RestClientBuilder
This is a shortcut for calling header(
ifNoneMatch
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder ifRange(Object value)
RestClientBuilder
This is a shortcut for calling header(
ifRange
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder ifUnmodifiedSince(Object value)
RestClientBuilder
This is a shortcut for calling header(
ifUnmodifiedSince
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder ignoreErrors()
RestClientBuilder
When enabled, HTTP error response codes (e.g. RestCallException
to
be thrown.
Note that this is equivalent to
ignoreErrors
in class RestClientBuilder
public MockRestClientBuilder ignoreErrors(boolean value)
RestClientBuilder
When enabled, HTTP error response codes (e.g. RestCallException
to
be thrown.
Note that this is equivalent to
ignoreErrors
in class RestClientBuilder
value
- The new value for this property.public MockRestClientBuilder ignoreRecursions()
RestClientBuilder
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:
ignoreRecursions
in class RestClientBuilder
public MockRestClientBuilder initialDepth(int value)
RestClientBuilder
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.
initialDepth
in class RestClientBuilder
value
- The new value for this property.
public MockRestClientBuilder interceptors(Class<?>... values) throws Exception
RestClientBuilder
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.
interceptors
in class RestClientBuilder
values
- The values to add to this setting.
Exception
- If one or more interceptors could not be created.public MockRestClientBuilder interceptors(Object... value)
RestClientBuilder
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.
interceptors
in class RestClientBuilder
value
- The values to add to this setting.
public MockRestClientBuilder json()
RestClientBuilder
JsonSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.xml()
to provide support for multiple languages.
Identical to calling
json
in class RestClientBuilder
public MockRestClientBuilder keepAliveStrategy(ConnectionKeepAliveStrategy keepAliveStrategy)
RestClientBuilder
ConnectionKeepAliveStrategy
instance.keepAliveStrategy
in class RestClientBuilder
keepAliveStrategy
- New property value.HttpClientBuilder.setKeepAliveStrategy(ConnectionKeepAliveStrategy)
public MockRestClientBuilder keepHttpClientOpen()
RestClientBuilder
Don't close this client when the RestClient.close()
method is called.
keepHttpClientOpen
in class RestClientBuilder
public MockRestClientBuilder keepNullProperties()
RestClientBuilder
When enabled, null bean values will be serialized to the output.
keepNullProperties
in class RestClientBuilder
public MockRestClientBuilder leakDetection()
RestClientBuilder
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
.
leakDetection
in class RestClientBuilder
public MockRestClientBuilder logRequests(DetailLevel detail, Level level, BiPredicate<RestRequest,RestResponse> test)
RestClientBuilder
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
RestClientBuilder.logger(Logger)
method or logged to the console using the
RestClientBuilder.logToConsole()
method.
logRequests
in class RestClientBuilder
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 public MockRestClientBuilder logToConsole()
RestClientBuilder
Specifies to log messages to the console.
logToConsole
in class RestClientBuilder
public MockRestClientBuilder logger(Logger value)
RestClientBuilder
Specifies the logger to use for logging.
If not specified, uses the following logger:
Logger.
logger
in class RestClientBuilder
value
- The logger to use for logging.public MockRestClientBuilder marshall(Marshall value)
RestClientBuilder
Shortcut for specifying the RestClient.RESTCLIENT_serializers
and RestClient.RESTCLIENT_parsers
using the serializer and parser defined in a marshall.
RestClientBuilder.sortCollections()
),
parser property setters (e.g. RestClientBuilder.strict()
), bean context property setters (e.g. RestClientBuilder.swaps(Object...)
),
or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class have no effect.
marshall
in class RestClientBuilder
value
- The values to add to this setting.public MockRestClientBuilder marshalls(Marshall... value)
RestClientBuilder
Shortcut for specifying the RestClient.RESTCLIENT_serializers
and RestClient.RESTCLIENT_parsers
using the serializer and parser defined in a marshall.
RestClientBuilder.sortCollections()
),
parser property setters (e.g. RestClientBuilder.strict()
), bean context property setters (e.g. RestClientBuilder.swaps(Object...)
),
or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class have no effect.
marshalls
in class RestClientBuilder
value
- The values to add to this setting.public MockRestClientBuilder maxConnPerRoute(int maxConnPerRoute)
RestClientBuilder
RestClientBuilder.connectionManager(HttpClientConnectionManager)
method.
maxConnPerRoute
in class RestClientBuilder
maxConnPerRoute
- New property value.HttpClientBuilder.setMaxConnPerRoute(int)
public MockRestClientBuilder maxConnTotal(int maxConnTotal)
RestClientBuilder
RestClientBuilder.connectionManager(HttpClientConnectionManager)
method.
maxConnTotal
in class RestClientBuilder
maxConnTotal
- New property value.HttpClientBuilder.setMaxConnTotal(int)
public MockRestClientBuilder maxDepth(int value)
RestClientBuilder
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.
maxDepth
in class RestClientBuilder
value
- The new value for this property.
public MockRestClientBuilder maxForwards(Object value)
RestClientBuilder
This is a shortcut for calling header(
maxForwards
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder maxIndent(int value)
RestClientBuilder
Specifies the maximum indentation level in the serialized document.
maxIndent
in class RestClientBuilder
value
- The new value for this property.
public MockRestClientBuilder msgPack()
RestClientBuilder
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)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
msgPack
in class RestClientBuilder
public MockRestClientBuilder noTrace()
RestClientBuilder
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.
noTrace
in class RestClientBuilder
public MockRestClientBuilder oapiCollectionFormat(HttpPartCollectionFormat value)
RestClientBuilder
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.
oapiCollectionFormat
in class RestClientBuilder
value
- The new value for this property.
HttpPartCollectionFormat.NO_COLLECTION_FORMAT
.public MockRestClientBuilder oapiFormat(HttpPartFormat value)
RestClientBuilder
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.
oapiFormat
in class RestClientBuilder
value
- The new value for this property.
HttpPartFormat.NO_FORMAT
.public MockRestClientBuilder openApi()
RestClientBuilder
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)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestResponseBody.schema(HttpPartSchema)
method will be used to specify the structure of the response body.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
openApi
in class RestClientBuilder
public MockRestClientBuilder origin(Object value)
RestClientBuilder
This is a shortcut for calling header(
origin
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder paramFormat(ParamFormat value)
RestClientBuilder
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.
paramFormat
in class RestClientBuilder
value
- The new value for this property.public MockRestClientBuilder paramFormatPlain()
RestClientBuilder
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.
paramFormatPlain
in class RestClientBuilder
public MockRestClientBuilder parser(Class<? extends Parser> value)
RestClientBuilder
Associates the specified Parser
with the HTTP client.
The parser is used to parse the HTTP response body into a POJO.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
parser
in class RestClientBuilder
value
- The new value for this setting.
JsonParser.DEFAULT
.public MockRestClientBuilder parser(Parser value)
RestClientBuilder
Associates the specified Parser
with the HTTP client.
The parser is used to parse the HTTP response body into a POJO.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined
on this builder class have no effect.
parser
in class RestClientBuilder
value
- The new value for this setting.
JsonParser.DEFAULT
.public MockRestClientBuilder parsers(Class<? extends Parser>... value)
RestClientBuilder
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
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
parsers
in class RestClientBuilder
value
- The new value for this setting.
JsonParser.DEFAULT
.public MockRestClientBuilder parsers(Parser... value)
RestClientBuilder
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
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined
on this builder class have no effect.
parsers
in class RestClientBuilder
value
- The new value for this setting.
JsonParser.DEFAULT
.public MockRestClientBuilder partParser(Class<? extends HttpPartParser> value)
RestClientBuilder
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.
partParser
in class RestClientBuilder
value
- The new value for this setting.
OpenApiParser
.public MockRestClientBuilder partParser(HttpPartParser value)
RestClientBuilder
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.
partParser
in class RestClientBuilder
value
- The new value for this setting.
OpenApiParser
.public MockRestClientBuilder partSerializer(Class<? extends HttpPartSerializer> value)
RestClientBuilder
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.
partSerializer
in class RestClientBuilder
value
- The new value for this setting.
OpenApiSerializer
.public MockRestClientBuilder partSerializer(HttpPartSerializer value)
RestClientBuilder
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.
partSerializer
in class RestClientBuilder
value
- The new value for this setting.
OpenApiSerializer
.public MockRestClientBuilder plainText()
RestClientBuilder
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)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
plainText
in class RestClientBuilder
public MockRestClientBuilder pooled()
RestClientBuilder
RestClientBuilder.createConnectionManager()
method will return a PoolingHttpClientConnectionManager
instead of a BasicHttpClientConnectionManager
.
pooled
in class RestClientBuilder
public MockRestClientBuilder pragma(Object value)
RestClientBuilder
This is a shortcut for calling header(
pragma
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder proxy(HttpHost proxy)
RestClientBuilder
RestClientBuilder.routePlanner(HttpRoutePlanner)
method.
proxy
in class RestClientBuilder
proxy
- New property value.HttpClientBuilder.setProxy(HttpHost)
public MockRestClientBuilder proxyAuthenticationStrategy(AuthenticationStrategy proxyAuthStrategy)
RestClientBuilder
AuthenticationStrategy
instance for proxy authentication.proxyAuthenticationStrategy
in class RestClientBuilder
proxyAuthStrategy
- New property value.HttpClientBuilder.setProxyAuthenticationStrategy(AuthenticationStrategy)
public MockRestClientBuilder proxyAuthorization(Object value)
RestClientBuilder
This is a shortcut for calling header(
proxyAuthorization
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder publicSuffixMatcher(PublicSuffixMatcher publicSuffixMatcher)
RestClientBuilder
PublicSuffixMatcherLoader
.
publicSuffixMatcher
in class RestClientBuilder
publicSuffixMatcher
- New property value.HttpClientBuilder.setPublicSuffixMatcher(PublicSuffixMatcher)
public MockRestClientBuilder queries(Object... params)
RestClientBuilder
RestClient
queries
in class RestClientBuilder
params
- The query parameters.
NameValuePair
NameValuePairable
Map.Entry
NameValuePairSupplier
Map
public MockRestClientBuilder query(NameValuePair pair)
RestClientBuilder
RestClient
query
in class RestClientBuilder
pair
- The query parameter.public MockRestClientBuilder query(String name, Object value)
RestClientBuilder
RestClient
query
in class RestClientBuilder
name
- The parameter name.value
- The parameter value.
public MockRestClientBuilder query(String name, Supplier<?> value)
RestClientBuilder
RestClient
query
in class RestClientBuilder
name
- The parameter name.value
- The parameter value supplier.
public MockRestClientBuilder query(String name, Object value, HttpPartSchema schema)
RestClientBuilder
String[]
query
in class RestClientBuilder
name
- The parameter name.value
- The parameter value.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public MockRestClientBuilder query(String name, Supplier<?> value, HttpPartSchema schema)
RestClientBuilder
String[]
query
in class RestClientBuilder
name
- The parameter name.value
- The parameter value supplier.
schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).
public MockRestClientBuilder query(String name, Object value, HttpPartSchema schema, HttpPartSerializer serializer)
RestClientBuilder
String[]
query
in class RestClientBuilder
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 MockRestClientBuilder query(String name, Supplier<?> value, HttpPartSchema schema, HttpPartSerializer serializer)
RestClientBuilder
String[]
query
in class RestClientBuilder
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 MockRestClientBuilder queryPairs(Object... pairs)
RestClientBuilder
RestClient
queryPairs
in class RestClientBuilder
pairs
- The query key/value pairs.
public MockRestClientBuilder quoteChar(char value)
RestClientBuilder
Specifies the character to use for quoting attributes and values.
quoteChar
in class RestClientBuilder
value
- The new value for this property.
public MockRestClientBuilder range(Object value)
RestClientBuilder
This is a shortcut for calling header(
range
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder redirectStrategy(RedirectStrategy redirectStrategy)
RestClientBuilder
RedirectStrategy
instance.
RestClientBuilder.disableRedirectHandling()
method.
redirectStrategy
in class RestClientBuilder
redirectStrategy
- New property value.HttpClientBuilder.setRedirectStrategy(RedirectStrategy)
public MockRestClientBuilder referer(Object value)
RestClientBuilder
This is a shortcut for calling header(
referer
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder requestExecutor(HttpRequestExecutor requestExec)
RestClientBuilder
HttpRequestExecutor
instance.requestExecutor
in class RestClientBuilder
requestExec
- New property value.HttpClientBuilder.setRequestExecutor(HttpRequestExecutor)
public MockRestClientBuilder retryHandler(HttpRequestRetryHandler retryHandler)
RestClientBuilder
HttpRequestRetryHandler
instance.
RestClientBuilder.disableAutomaticRetries()
method.
retryHandler
in class RestClientBuilder
retryHandler
- New property value.HttpClientBuilder.setRetryHandler(HttpRequestRetryHandler)
public MockRestClientBuilder rootUri(Object value)
RestClientBuilder
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.
rootUri
in class RestClientBuilder
value
- The root URI to prefix to relative URI strings.
public MockRestClientBuilder routePlanner(HttpRoutePlanner routePlanner)
RestClientBuilder
HttpRoutePlanner
instance.routePlanner
in class RestClientBuilder
routePlanner
- New property value.HttpClientBuilder.setRoutePlanner(HttpRoutePlanner)
public MockRestClientBuilder schemePortResolver(SchemePortResolver schemePortResolver)
RestClientBuilder
SchemePortResolver
instance.schemePortResolver
in class RestClientBuilder
schemePortResolver
- New property value.HttpClientBuilder.setSchemePortResolver(SchemePortResolver)
public MockRestClientBuilder serializer(Class<? extends Serializer> value)
RestClientBuilder
Associates the specified Serializer
with the HTTP client.
The serializer is used to serialize POJOs into the HTTP request body.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
serializer
in class RestClientBuilder
value
- The new value for this setting.
JsonSerializer
.public MockRestClientBuilder serializer(Serializer value)
RestClientBuilder
Associates the specified Serializer
with the HTTP client.
The serializer is used to serialize POJOs into the HTTP request body.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined
on this builder class have no effect.
serializer
in class RestClientBuilder
value
- The new value for this setting.
JsonSerializer
.public MockRestClientBuilder serializers(Class<? extends Serializer>... value)
RestClientBuilder
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
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
serializers
in class RestClientBuilder
value
- The new value for this setting.
JsonSerializer
.public MockRestClientBuilder serializers(Serializer... value)
RestClientBuilder
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
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined
on this builder class have no effect.
serializers
in class RestClientBuilder
value
- The new value for this setting.
JsonSerializer
.public MockRestClientBuilder serviceUnavailableRetryStrategy(ServiceUnavailableRetryStrategy serviceUnavailStrategy)
RestClientBuilder
ServiceUnavailableRetryStrategy
instance.serviceUnavailableRetryStrategy
in class RestClientBuilder
serviceUnavailStrategy
- New property value.HttpClientBuilder.setServiceUnavailableRetryStrategy(ServiceUnavailableRetryStrategy)
public MockRestClientBuilder simpleJson()
RestClientBuilder
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)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.xml()
to provide support for multiple languages.
Identical to calling
simpleJson
in class RestClientBuilder
public MockRestClientBuilder sortCollections()
RestClientBuilder
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.
sortCollections
in class RestClientBuilder
public MockRestClientBuilder sortMaps()
RestClientBuilder
When enabled, copies and sorts the contents of maps by their keys before serializing them.
Note that this introduces a performance penalty.
sortMaps
in class RestClientBuilder
public MockRestClientBuilder sq()
RestClientBuilder
Specifies to use single quotes for quoting attributes and values.
sq
in class RestClientBuilder
public MockRestClientBuilder sslContext(SSLContext sslContext)
RestClientBuilder
SSLContext
instance.
RestClientBuilder.connectionManager(HttpClientConnectionManager)
and the RestClientBuilder.sslSocketFactory(LayeredConnectionSocketFactory)
methods.
sslContext
in class RestClientBuilder
sslContext
- New property value.HttpClientBuilder.setSSLContext(SSLContext)
public MockRestClientBuilder sslHostnameVerifier(HostnameVerifier hostnameVerifier)
RestClientBuilder
HostnameVerifier
instance.
RestClientBuilder.connectionManager(HttpClientConnectionManager)
and the RestClientBuilder.sslSocketFactory(LayeredConnectionSocketFactory)
methods.
sslHostnameVerifier
in class RestClientBuilder
hostnameVerifier
- New property value.HttpClientBuilder.setSSLHostnameVerifier(HostnameVerifier)
public MockRestClientBuilder sslSocketFactory(LayeredConnectionSocketFactory sslSocketFactory)
RestClientBuilder
LayeredConnectionSocketFactory
instance.
RestClientBuilder.connectionManager(HttpClientConnectionManager)
method.
sslSocketFactory
in class RestClientBuilder
sslSocketFactory
- New property value.HttpClientBuilder.setSSLSocketFactory(LayeredConnectionSocketFactory)
public MockRestClientBuilder strict()
RestClientBuilder
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:
|
strict
in class RestClientBuilder
public MockRestClientBuilder targetAuthenticationStrategy(AuthenticationStrategy targetAuthStrategy)
RestClientBuilder
AuthenticationStrategy
instance for target host authentication.targetAuthenticationStrategy
in class RestClientBuilder
targetAuthStrategy
- New property value.HttpClientBuilder.setTargetAuthenticationStrategy(AuthenticationStrategy)
public MockRestClientBuilder te(Object value)
RestClientBuilder
This is a shortcut for calling header(
te
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder trimEmptyCollections()
RestClientBuilder
When enabled, empty lists and arrays will not be serialized.
Note that enabling this setting has the following effects on parsing:
trimEmptyCollections
in class RestClientBuilder
public MockRestClientBuilder trimEmptyMaps()
RestClientBuilder
When enabled, empty map values will not be serialized to the output.
Note that enabling this setting has the following effects on parsing:
trimEmptyMaps
in class RestClientBuilder
public MockRestClientBuilder trimStringsOnRead()
RestClientBuilder
When enabled, string values will be trimmed of whitespace using String.trim()
before being added to
the POJO.
trimStringsOnRead
in class RestClientBuilder
public MockRestClientBuilder trimStringsOnWrite()
RestClientBuilder
When enabled, string values will be trimmed of whitespace using String.trim()
before being serialized.
trimStringsOnWrite
in class RestClientBuilder
public MockRestClientBuilder uon()
RestClientBuilder
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)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
uon
in class RestClientBuilder
public MockRestClientBuilder upgrade(Object value)
RestClientBuilder
This is a shortcut for calling header(
upgrade
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder uriContext(UriContext value)
RestClientBuilder
Bean used for resolution of URIs to absolute or root-relative form.
uriContext
in class RestClientBuilder
value
- The new value for this property.public MockRestClientBuilder uriRelativity(UriRelativity value)
RestClientBuilder
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 RestClientBuilder.uriContext(UriContext)
for examples.
uriRelativity
in class RestClientBuilder
value
- The new value for this property.
UriRelativity.RESOURCE
public MockRestClientBuilder uriResolution(UriResolution value)
RestClientBuilder
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 RestClientBuilder.uriContext(UriContext)
for examples.
uriResolution
in class RestClientBuilder
value
- The new value for this property.
UriResolution.NONE
public MockRestClientBuilder urlEnc()
RestClientBuilder
UrlEncodingSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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 RestClientBuilder.partSerializer(Class)
is used.
UrlEncodingParser
will be used to parse POJOs from response bodies unless overridden per request via RestRequest.parser(Parser)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
urlEnc
in class RestClientBuilder
public MockRestClientBuilder useSystemProperties()
RestClientBuilder
useSystemProperties
in class RestClientBuilder
HttpClientBuilder.useSystemProperties()
public MockRestClientBuilder useWhitespace()
RestClientBuilder
When enabled, whitespace is added to the output to improve readability.
useWhitespace
in class RestClientBuilder
public MockRestClientBuilder userAgent(Object value)
RestClientBuilder
This is a shortcut for calling header(
userAgent
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder userAgent(String userAgent)
RestClientBuilder
RestClientBuilder.httpProcessor(HttpProcessor)
method.
RestClientBuilder.userAgent(Object)
is an equivalent method.
userAgent
in class RestClientBuilder
userAgent
- New property value.HttpClientBuilder.setUserAgent(String)
public MockRestClientBuilder userTokenHandler(UserTokenHandler userTokenHandler)
RestClientBuilder
UserTokenHandler
instance.
RestClientBuilder.disableConnectionState()
method.
userTokenHandler
in class RestClientBuilder
userTokenHandler
- New property value.HttpClientBuilder.setUserTokenHandler(UserTokenHandler)
public MockRestClientBuilder via(Object value)
RestClientBuilder
This is a shortcut for calling header(
via
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder warning(Object value)
RestClientBuilder
This is a shortcut for calling header(
warning
in class RestClientBuilder
value
- The new header value.public MockRestClientBuilder ws()
RestClientBuilder
When enabled, whitespace is added to the output to improve readability.
ws
in class RestClientBuilder
public MockRestClientBuilder xml()
RestClientBuilder
XmlSerializer
will be used to serialize POJOs to request bodies unless overridden per request via RestRequest.serializer(Serializer)
.
RestClientBuilder.sortCollections()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.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)
.
RestClientBuilder.strict()
),
bean context property setters (e.g. RestClientBuilder.swaps(Object...)
), or generic property setters (e.g. RestClientBuilder.set(String, Object)
) defined on this builder class.
RestClientBuilder.header(String,Object)
or RestClientBuilder.accept(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.accept(Object)
.
RestClientBuilder.header(String,Object)
or RestClientBuilder.contentType(Object)
, or per-request via RestRequest.header(String,Object)
or RestRequest.contentType(Object)
.
Can be combined with other marshaller setters such as RestClientBuilder.json()
to provide support for multiple languages.
Identical to calling
xml
in class RestClientBuilder
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.