Class ClientProperties
- java.lang.Object
-
- org.glassfish.jersey.client.ClientProperties
-
public final class ClientProperties extends Object
Jersey client implementation configuration properties.- Author:
- Marek Potociar, Libor Kramolis
-
-
Field Summary
Fields Modifier and Type Field Description static StringASYNC_THREADPOOL_SIZEAsynchronous thread pool size.static StringBACKGROUND_SCHEDULER_THREADPOOL_SIZEScheduler thread pool size.static StringCHUNKED_ENCODING_SIZEThe value MUST be an instance convertible toInteger.static StringCONNECT_TIMEOUTConnect timeout interval, in milliseconds.static StringCONNECTOR_PROVIDERSets theConnectorProviderclass.static intDEFAULT_CHUNK_SIZEDefault chunk size in HTTP chunk-encoded messages.static LongDEFAULT_EXPECT_100_CONTINUE_THRESHOLD_SIZEDefault threshold size (64kb) after which Expect:100-Continue header would be applied before the main request.static StringDIGESTAUTH_URI_CACHE_SIZELIMITThe property defines the size of digest cache in theHttpAuthenticationFeature.digest()digest filter}.static StringEXPECT_100_CONTINUEAllows for HTTP Expect:100-Continue being handled by the HttpUrlConnector (default Jersey connector).static StringEXPECT_100_CONTINUE_THRESHOLD_SIZEProperty for threshold size for content length after which Expect:100-Continue header would be applied before the main request.static StringFEATURE_AUTO_DISCOVERY_DISABLEIftruethen disable auto-discovery on the client.static StringFOLLOW_REDIRECTSAutomatic redirection.static StringIGNORE_EXCEPTION_RESPONSEIgnore a response in an exception thrown by the client API by not forwarding it to this service's client.static StringJSON_PROCESSING_FEATURE_DISABLEIftruethen disable configuration of Json Processing (JSR-353) feature on client.static StringMETAINF_SERVICES_LOOKUP_DISABLEIftruethen disable META-INF/services lookup on client.static StringMOXY_JSON_FEATURE_DISABLEIftruethen disable configuration of MOXy Json feature on client.static StringOUTBOUND_CONTENT_LENGTH_BUFFERAn integer value that defines the buffer size used to buffer client-side request entity in order to determine its size and set the value of HTTP "Content-Length" header.static StringPROXY_PASSWORDThe property defines a user password which will be used for HTTP proxy authentication.static StringPROXY_URIThe property defines a URI of a HTTP proxy the client connector should use.static StringPROXY_USERNAMEThe property defines a user name which will be used for HTTP proxy authentication.static StringQUERY_PARAM_STYLEThe property defines the desired format of query parameters.static StringREAD_TIMEOUTRead timeout interval, in milliseconds.static StringREQUEST_ENTITY_PROCESSINGThe property specified how the entity should be serialized to the output stream by theconnector; if the buffering should be used or the entity is streamed in chunked encoding.static StringSNI_HOST_NAMEMost connectors support HOST header value to be used as an SNIHostName.static StringSUPPRESS_HTTP_COMPLIANCE_VALIDATIONIftrue, the strict validation of HTTP specification compliance will be suppressed.static StringUSE_ENCODINGIfEncodingFilteris registered, this property indicates the value of Content-Encoding property the filter should be adding.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TgetValue(Map<String,?> properties, String key, Class<T> type)Get the value of the specified property.static <T> TgetValue(Map<String,?> properties, String key, T defaultValue)Get the value of the specified property.static <T> TgetValue(Map<String,?> properties, String key, T defaultValue, Class<T> type)Get the value of the specified property.
-
-
-
Field Detail
-
FOLLOW_REDIRECTS
public static final String FOLLOW_REDIRECTS
Automatic redirection. A value oftruedeclares that the client will automatically redirect to the URI declared in 3xx responses.The value MUST be an instance convertible to
Boolean.The default value is
true.The name of the configuration property is "jersey.config.client.followRedirects".
- See Also:
- Constant Field Values
-
READ_TIMEOUT
public static final String READ_TIMEOUT
Read timeout interval, in milliseconds.The value MUST be an instance convertible to
Integer. A value of zero (0) is equivalent to an interval of infinity.The default value is infinity (0).
The name of the configuration property is "jersey.config.client.readTimeout".
- See Also:
- Constant Field Values
-
CONNECT_TIMEOUT
public static final String CONNECT_TIMEOUT
Connect timeout interval, in milliseconds.The value MUST be an instance convertible to
Integer. A value of zero (0) is equivalent to an interval of infinity.The default value is infinity (0).
The name of the configuration property is "jersey.config.client.connectTimeout".
- See Also:
- Constant Field Values
-
CHUNKED_ENCODING_SIZE
public static final String CHUNKED_ENCODING_SIZE
The value MUST be an instance convertible toInteger.The property defines the size of the chunk in bytes. The property does not enable chunked encoding (it is controlled by
REQUEST_ENTITY_PROCESSINGproperty).A default value is 4096 (since Jersey 2.16).
The name of the configuration property is "jersey.config.client.chunkedEncodingSize".
- See Also:
- Constant Field Values
-
DEFAULT_CHUNK_SIZE
public static final int DEFAULT_CHUNK_SIZE
Default chunk size in HTTP chunk-encoded messages.- Since:
- 2.16
- See Also:
- Constant Field Values
-
ASYNC_THREADPOOL_SIZE
public static final String ASYNC_THREADPOOL_SIZE
Asynchronous thread pool size.The value MUST be an instance of
Integer.If the property is absent then thread pool used for async requests will be initialized as default cached thread pool, which creates new thread for every new request, see
Executors. When a value > 0 is provided, the created cached thread pool limited to that number of threads will be utilized. Zero or negative values will be ignored.Note that the property may be ignored if a custom
ExecutorServiceProvideris configured to execute asynchronous requests in the client runtime (seeClientAsyncExecutor).A default value is not set.
The name of the configuration property is "jersey.config.client.async.threadPoolSize".
- See Also:
- Constant Field Values
-
BACKGROUND_SCHEDULER_THREADPOOL_SIZE
public static final String BACKGROUND_SCHEDULER_THREADPOOL_SIZE
Scheduler thread pool size.The value MUST be an instance of
Integer.If the property is absent then thread pool used for background task scheduling will be initialized as default scheduled thread pool executor, which creates new thread for every new request, see
Executors. When a value > 0 is provided, the created scheduled thread pool executor limited to that number of threads will be utilized. Zero or negative values will be ignored.Note that the property may be ignored if a custom
ExecutorServiceProvideris configured to execute background tasks scheduling in the client runtime (seeClientBackgroundScheduler).A default value is not set.
The name of the configuration property is "jersey.config.client.backgroundScheduler.threadPoolSize".
- See Also:
- Constant Field Values
-
USE_ENCODING
public static final String USE_ENCODING
IfEncodingFilteris registered, this property indicates the value of Content-Encoding property the filter should be adding.The value MUST be an instance of
String.The default value is
null.The name of the configuration property is "jersey.config.client.useEncoding".
- See Also:
- Constant Field Values
-
IGNORE_EXCEPTION_RESPONSE
public static final String IGNORE_EXCEPTION_RESPONSE
Ignore a response in an exception thrown by the client API by not forwarding it to this service's client. A value oftrueindicates that responses will be ignored, and only the response status will return to the client. This property will normally be specified as a system property; note that system properties are only visible ifCommonProperties.ALLOW_SYSTEM_PROPERTIES_PROVIDERis set totrue.The value MUST be an instance convertible to
Boolean.The default value is
false.The name of the configuration property is "jersey.config.client.ignoreExceptionResponse".
-
FEATURE_AUTO_DISCOVERY_DISABLE
public static final String FEATURE_AUTO_DISCOVERY_DISABLE
Iftruethen disable auto-discovery on the client.By default auto-discovery on client is automatically enabled if global property "jersey.config.disableAutoDiscovery" is not disabled. If set then the client property value overrides the global property value.
The default value is
false.The name of the configuration property is "jersey.config.client.disableAutoDiscovery".
This constant is an alias for
CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE_CLIENT.
-
OUTBOUND_CONTENT_LENGTH_BUFFER
public static final String OUTBOUND_CONTENT_LENGTH_BUFFER
An integer value that defines the buffer size used to buffer client-side request entity in order to determine its size and set the value of HTTP "Content-Length" header.If the entity size exceeds the configured buffer size, the buffering would be cancelled and the entity size would not be determined. Value less or equal to zero disable the buffering of the entity at all.
This property can be used on the client side to override the outbound message buffer size value - default or the global custom value set using the "jersey.config.contentLength.buffer" global property.The default value is 8192.
The name of the configuration property is "jersey.config.client.contentLength.buffer".
This constant is an alias for
CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER_CLIENT.- Since:
- 2.2
- See Also:
- Constant Field Values
-
JSON_PROCESSING_FEATURE_DISABLE
public static final String JSON_PROCESSING_FEATURE_DISABLE
Iftruethen disable configuration of Json Processing (JSR-353) feature on client.By default Json Processing on client is automatically enabled if global property "jersey.config.disableJsonProcessing" is not disabled. If set then the client property value overrides the global property value.
The default value is
false.The name of the configuration property is "jersey.config.client.disableJsonProcessing".
This constant is an alias for
CommonProperties.JSON_PROCESSING_FEATURE_DISABLE_CLIENT.
-
METAINF_SERVICES_LOOKUP_DISABLE
public static final String METAINF_SERVICES_LOOKUP_DISABLE
Iftruethen disable META-INF/services lookup on client.By default Jersey looks up SPI implementations described by
META-INF/services/*files. Then you can register appropriate provider classes byApplication.The default value is
false.The name of the configuration property is "jersey.config.client.disableMetainfServicesLookup".
This constant is an alias for
CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE_CLIENT.
-
MOXY_JSON_FEATURE_DISABLE
public static final String MOXY_JSON_FEATURE_DISABLE
Iftruethen disable configuration of MOXy Json feature on client.By default MOXy Json on client is automatically enabled if global property "jersey.config.disableMoxyJson" is not disabled. If set then the client property value overrides the global property value.
The default value is
false.The name of the configuration property is "jersey.config.client.disableMoxyJson".
This constant is an alias for
CommonProperties.MOXY_JSON_FEATURE_DISABLE_CLIENT.- Since:
- 2.1
- See Also:
CommonProperties.MOXY_JSON_FEATURE_DISABLE, Constant Field Values
-
SUPPRESS_HTTP_COMPLIANCE_VALIDATION
public static final String SUPPRESS_HTTP_COMPLIANCE_VALIDATION
Iftrue, the strict validation of HTTP specification compliance will be suppressed.By default, Jersey client runtime performs certain HTTP compliance checks (such as which HTTP methods can facilitate non-empty request entities etc.) in order to fail fast with an exception when user tries to establish a communication non-compliant with HTTP specification. Users who need to override these compliance checks and avoid the exceptions being thrown by Jersey client runtime for some reason, can set this property to
true. As a result, the compliance issues will be merely reported in a log and no exceptions will be thrown.Note that the property suppresses the Jersey layer exceptions. Chances are that the non-compliant behavior will cause different set of exceptions being raised in the underlying I/O connector layer.
This property can be configured in a client runtime configuration or directly on an individual request. In case of conflict, request-specific property value takes precedence over value configured in the runtime configuration.
The default value is
false.The name of the configuration property is "jersey.config.client.suppressHttpComplianceValidation".
- Since:
- 2.2
- See Also:
- Constant Field Values
-
DIGESTAUTH_URI_CACHE_SIZELIMIT
public static final String DIGESTAUTH_URI_CACHE_SIZELIMIT
The property defines the size of digest cache in theHttpAuthenticationFeature.digest()digest filter}. Cache contains authentication schemes for different request URIs.The value MUST be an instance of
Integerand it must be higher or equal to 1.The default value is
1000.The name of the configuration property is "jersey.config.client.digestAuthUriCacheSizeLimit".
- Since:
- 2.3
- See Also:
- Constant Field Values
-
PROXY_URI
public static final String PROXY_URI
The property defines a URI of a HTTP proxy the client connector should use.If the port component of the URI is absent then a default port of
8080is assumed. If the property absent then no proxy will be utilized.The value MUST be an instance of
String.The default value is
null.The name of the configuration property is "jersey.config.client.proxy.uri".
- Since:
- 2.5
- See Also:
- Constant Field Values
-
PROXY_USERNAME
public static final String PROXY_USERNAME
The property defines a user name which will be used for HTTP proxy authentication.The property is ignored if no
HTTP proxy URIhas been set. If the property absent then no proxy authentication will be utilized.The value MUST be an instance of
String.The default value is
null.The name of the configuration property is "jersey.config.client.proxy.username".
- Since:
- 2.5
- See Also:
- Constant Field Values
-
PROXY_PASSWORD
public static final String PROXY_PASSWORD
The property defines a user password which will be used for HTTP proxy authentication.The property is ignored if no
HTTP proxy URIhas been set. If the property absent then no proxy authentication will be utilized.The value MUST be an instance of
String.The default value is
null.The name of the configuration property is "jersey.config.client.proxy.password".
- Since:
- 2.5
- See Also:
- Constant Field Values
-
REQUEST_ENTITY_PROCESSING
public static final String REQUEST_ENTITY_PROCESSING
The property specified how the entity should be serialized to the output stream by theconnector; if the buffering should be used or the entity is streamed in chunked encoding.The value MUST be an instance of
Stringor an enum valueRequestEntityProcessingin the case of programmatic definition of the property. Allowed values are:BUFFERED: the entity will be buffered and content length will be send in Content-length header.CHUNKED: chunked encoding will be used and entity will be streamed.
Default value is
CHUNKED. However, due to limitations some connectors can define different default value (usually if the chunked encoding cannot be properly supported on theConnector). This detail should be specified in the javadoc of particular connector. For example,HttpUrlConnectoruse buffering as the default mode.The name of the configuration property is "jersey.config.client.request.entity.processing".
- Since:
- 2.5
- See Also:
- Constant Field Values
-
EXPECT_100_CONTINUE
public static final String EXPECT_100_CONTINUE
Allows for HTTP Expect:100-Continue being handled by the HttpUrlConnector (default Jersey connector).- Since:
- 2.32
- See Also:
- Constant Field Values
-
EXPECT_100_CONTINUE_THRESHOLD_SIZE
public static final String EXPECT_100_CONTINUE_THRESHOLD_SIZE
Property for threshold size for content length after which Expect:100-Continue header would be applied before the main request.- Since:
- 2.32
- See Also:
- Constant Field Values
-
DEFAULT_EXPECT_100_CONTINUE_THRESHOLD_SIZE
public static final Long DEFAULT_EXPECT_100_CONTINUE_THRESHOLD_SIZE
Default threshold size (64kb) after which Expect:100-Continue header would be applied before the main request.- Since:
- 2.32
-
QUERY_PARAM_STYLE
public static final String QUERY_PARAM_STYLE
The property defines the desired format of query parameters.The value MUST be an instance of
JerseyQueryParamStyle.If the property is not set,
JerseyQueryParamStyle.MULTI_PAIRSis selected.- See Also:
- Constant Field Values
-
SNI_HOST_NAME
public static final String SNI_HOST_NAME
Most connectors support HOST header value to be used as an SNIHostName. However, the HOST header is restricted in JDK.
HttpUrlConnectorandJavaNetHttpConnectorneed to have an extra System Property set to allow HOST header. As an option to HOST header, this property allows the HOST name to be pre-set on a Client and does not need to be set on each request.The value MUST be an instance of
String.The name of the configuration property is "jersey.config.client.sniHostName".
- Since:
- 3.1.2
- See Also:
- Constant Field Values
-
CONNECTOR_PROVIDER
public static final String CONNECTOR_PROVIDER
Sets theConnectorProviderclass. Overrides the value from META-INF/services.The value MUST be an instance of
String.The property is recognized by
ClientBuilder.The name of the configuration property is "jersey.config.client.connector.provider".
- Since:
- 2.40
- See Also:
- Constant Field Values
-
-
Method Detail
-
getValue
public static <T> T getValue(Map<String,?> properties, String key, T defaultValue)
Get the value of the specified property.If the property is not set or the real value type is not compatible with
defaultValuetype, the specifieddefaultValueis returned. Calling this method is equivalent to calling ClientProperties.getValue(properties, key, defaultValue, (Class<T>) defaultValue.getClass()).- Type Parameters:
T- Type of the property value.- Parameters:
properties- Map of properties to get the property value from.key- Name of the property.defaultValue- Default value if property is not registered- Returns:
- Value of the property or
null. - Since:
- 2.8
-
getValue
public static <T> T getValue(Map<String,?> properties, String key, T defaultValue, Class<T> type)
Get the value of the specified property. If the property is not set or the real value type is not compatible with the specified value type, returnsdefaultValue.- Type Parameters:
T- Type of the property value.- Parameters:
properties- Map of properties to get the property value from.key- Name of the property.defaultValue- Default value if property is not registeredtype- Type to retrieve the value as.- Returns:
- Value of the property or
null. - Since:
- 2.8
-
getValue
public static <T> T getValue(Map<String,?> properties, String key, Class<T> type)
Get the value of the specified property. If the property is not set or the actual property value type is not compatible with the specified type, the method will returnnull.- Type Parameters:
T- Type of the property value.- Parameters:
properties- Map of properties to get the property value from.key- Name of the property.type- Type to retrieve the value as.- Returns:
- Value of the property or
null. - Since:
- 2.8
-
-