Class ClientWebTarget
- All Implemented Interfaces:
WebTarget,Configurable<WebTarget>,ResteasyWebTarget
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected ResteasyClientprotected ClientConfigurationprotected UriBuilder -
Constructor Summary
ConstructorsModifierConstructorDescriptionClientWebTarget(ResteasyClient client, UriBuilder uriBuilder, ClientConfiguration configuration) ClientWebTarget(ResteasyClient client, String uri, ClientConfiguration configuration) ClientWebTarget(ResteasyClient client, URI uri, ClientConfiguration configuration) protectedClientWebTarget(ResteasyClient client, ClientConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionclone()protected ClientInvocationBuildercreateClientInvocationBuilder(ResteasyClient client, URI uri, ClientConfiguration configuration) protected <T> ProxyBuilder<T>createProxyBuilder(Class<T> proxyInterface, ClientWebTarget cwt) Get a live view of an internal configuration state of this configurable instance.getUri()Get the URI identifying the resource.Get the URI builder initialized with theURIof the current resource target.matrixParam(String name, Object... values) Create a newWebTargetinstance by appending a matrix parameter to the existing set of matrix parameters of the current final segment of the URI of the current target instance.protected ClientWebTargetnewInstance(ResteasyClient client, UriBuilder uriBuilder, ClientConfiguration configuration) Create a newWebTargetinstance by appending path to the URI of the current target instance.Set the new configuration property, if already set, the existing value of the property will be updated.<T> T<T> ProxyBuilder<T>proxyBuilder(Class<T> proxyInterface) queryParam(String name, Object... values) Create a newWebTargetinstance by configuring a query parameter on the URI of the current target instance.queryParamNoTemplate(String name, Object... values) Will encode any '{}' characters and not treat them as template parameters.queryParams(MultivaluedMap<String, Object> parameters) queryParamsNoTemplate(MultivaluedMap<String, Object> parameters) Will encode any '{}' characters and not treat them as template parameters.Register a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.Register a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.Register a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.Register a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.Register an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.Register an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.Register an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.Register an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.request()Start building a request to the targeted web resource.Start building a request to the targeted web resource and define the accepted response media types.Start building a request to the targeted web resource and define the accepted response media types.resolveTemplate(String name, Object value) Create a newWebTargetinstance by resolving a URI template with a givennamein the URI of the current target instance using a supplied value.resolveTemplate(String name, Object value, boolean encodeSlashInPath) Create a newWebTargetinstance by resolving a URI template with a givennamein the URI of the current target instance using a supplied value.resolveTemplateFromEncoded(String name, Object value) Create a newWebTargetinstance by resolving a URI template with a givennamein the URI of the current target instance using a supplied encoded value.resolveTemplates(Map<String, Object> templateValues) Create a newWebTargetinstance by resolving one or more URI templates in the URI of the current target instance using supplied name-value pairs.resolveTemplates(Map<String, Object> templateValues, boolean encodeSlashInPath) Create a newWebTargetinstance by resolving one or more URI templates in the URI of the current target instance using supplied name-value pairs.resolveTemplatesFromEncoded(Map<String, Object> templateValues) Create a newWebTargetinstance by resolving one or more URI templates in the URI of the current target instance using supplied name-encoded value pairs.setChunked(boolean chunked)
-
Field Details
-
client
-
uriBuilder
-
configuration
-
chunked
protected boolean chunked
-
-
Constructor Details
-
ClientWebTarget
-
ClientWebTarget
public ClientWebTarget(ResteasyClient client, String uri, ClientConfiguration configuration) throws IllegalArgumentException, NullPointerException -
ClientWebTarget
public ClientWebTarget(ResteasyClient client, URI uri, ClientConfiguration configuration) throws NullPointerException - Throws:
NullPointerException
-
ClientWebTarget
public ClientWebTarget(ResteasyClient client, UriBuilder uriBuilder, ClientConfiguration configuration) throws NullPointerException - Throws:
NullPointerException
-
-
Method Details
-
clone
- Specified by:
clonein interfaceResteasyWebTarget- Overrides:
clonein classObject
-
getResteasyClient
- Specified by:
getResteasyClientin interfaceResteasyWebTarget
-
proxy
- Specified by:
proxyin interfaceResteasyWebTarget
-
proxyBuilder
- Specified by:
proxyBuilderin interfaceResteasyWebTarget
-
createProxyBuilder
-
getUri
Description copied from interface:WebTargetGet the URI identifying the resource. -
getUriBuilder
Description copied from interface:WebTargetGet the URI builder initialized with theURIof the current resource target. The returned URI builder is detached from the target, i.e. any updates in the URI builder MUST NOT have any effects on the URI of the originating target.- Specified by:
getUriBuilderin interfaceWebTarget- Returns:
- the initialized URI builder.
-
getConfiguration
Description copied from interface:ConfigurableGet a live view of an internal configuration state of this configurable instance. Any changes made using methods of thisConfigurableinstance will be reflected in the returnedConfigurationinstance.The returned
Configurationinstance and the collection data it provides are not thread-safe wrt. modification made using methods on the parent configurable object.- Specified by:
getConfigurationin interfaceConfigurable<WebTarget>- Returns:
- configuration live view of the internal configuration state.
-
path
Description copied from interface:WebTargetCreate a newWebTargetinstance by appending path to the URI of the current target instance.When constructing the final path, a '/' separator will be inserted between the existing path and the supplied path if necessary. Existing '/' characters are preserved thus a single value can represent multiple URI path segments.
A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
pathin interfaceResteasyWebTarget- Specified by:
pathin interfaceWebTarget- Parameters:
path- the path, may contain URI template parameters.- Returns:
- a new target instance.
- Throws:
NullPointerException- if path isnull.
-
path
- Specified by:
pathin interfaceResteasyWebTarget- Throws:
IllegalArgumentException
-
path
- Specified by:
pathin interfaceResteasyWebTarget- Throws:
IllegalArgumentException
-
resolveTemplate
Description copied from interface:WebTargetCreate a newWebTargetinstance by resolving a URI template with a givennamein the URI of the current target instance using a supplied value. In case anulltemplate name or value is entered aNullPointerExceptionis thrown.A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
resolveTemplatein interfaceResteasyWebTarget- Specified by:
resolveTemplatein interfaceWebTarget- Parameters:
name- name of the URI template.value- value to be used to resolve the template.- Returns:
- a new target instance.
- Throws:
NullPointerException- if the resolved template name or value isnull.
-
resolveTemplates
public ResteasyWebTarget resolveTemplates(Map<String, Object> templateValues) throws NullPointerExceptionDescription copied from interface:WebTargetCreate a newWebTargetinstance by resolving one or more URI templates in the URI of the current target instance using supplied name-value pairs. A call to the method with an empty parameter map is ignored, i.e. sameWebTargetinstance is returned.A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
resolveTemplatesin interfaceResteasyWebTarget- Specified by:
resolveTemplatesin interfaceWebTarget- Parameters:
templateValues- a map of URI template names and their values.- Returns:
- a new target instance or the same target instance in case the input name-value map is empty.
- Throws:
NullPointerException- if the name-value map or any of the names or values in the map isnull.
-
resolveTemplate
public ResteasyWebTarget resolveTemplate(String name, Object value, boolean encodeSlashInPath) throws NullPointerException Description copied from interface:WebTargetCreate a newWebTargetinstance by resolving a URI template with a givennamein the URI of the current target instance using a supplied value. In case anulltemplate name or value is entered aNullPointerExceptionis thrown.A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
resolveTemplatein interfaceResteasyWebTarget- Specified by:
resolveTemplatein interfaceWebTarget- Parameters:
name- name of the URI template.value- value to be used to resolve the template.encodeSlashInPath- iftrue, the slash ('/') characters in template values will be encoded if the template is placed in the URI path component, otherwise the slash characters will not be encoded in path templates.- Returns:
- a new target instance.
- Throws:
NullPointerException- if the resolved template name or value isnull.
-
resolveTemplateFromEncoded
public ResteasyWebTarget resolveTemplateFromEncoded(String name, Object value) throws NullPointerException Description copied from interface:WebTargetCreate a newWebTargetinstance by resolving a URI template with a givennamein the URI of the current target instance using a supplied encoded value. A template with a matching name will be replaced by the supplied value. Value is converted toStringusing itstoString()method and is then encoded to match the rules of the URI component to which they pertain. All % characters in the stringified values that are not followed by two hexadecimal numbers will be encoded. In case anulltemplate name or value is entered aNullPointerExceptionis thrown.A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
resolveTemplateFromEncodedin interfaceResteasyWebTarget- Specified by:
resolveTemplateFromEncodedin interfaceWebTarget- Parameters:
name- name of the URI template.value- encoded value to be used to resolve the template.- Returns:
- a new target instance.
- Throws:
NullPointerException- if the resolved template name or value isnull.
-
resolveTemplatesFromEncoded
public ResteasyWebTarget resolveTemplatesFromEncoded(Map<String, Object> templateValues) throws NullPointerExceptionDescription copied from interface:WebTargetCreate a newWebTargetinstance by resolving one or more URI templates in the URI of the current target instance using supplied name-encoded value pairs. All templates with their name matching one of the keys in the supplied map will be replaced by the value in the supplied map. Values are converted toStringusing theirtoString()method and are then encoded to match the rules of the URI component to which they pertain. All % characters in the stringified values that are not followed by two hexadecimal numbers will be encoded. A call to the method with an empty parameter map is ignored, i.e. sameWebTargetinstance is returned.A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
resolveTemplatesFromEncodedin interfaceResteasyWebTarget- Specified by:
resolveTemplatesFromEncodedin interfaceWebTarget- Parameters:
templateValues- a map of URI template names and their encoded values.- Returns:
- a new target instance or the same target instance in case the input name-value map is empty.
- Throws:
NullPointerException- if the name-value map or any of the names or encoded values in the map isnull.
-
resolveTemplates
public ResteasyWebTarget resolveTemplates(Map<String, Object> templateValues, boolean encodeSlashInPath) throws NullPointerExceptionDescription copied from interface:WebTargetCreate a newWebTargetinstance by resolving one or more URI templates in the URI of the current target instance using supplied name-value pairs. A call to the method with an empty parameter map is ignored, i.e. sameWebTargetinstance is returned.A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
resolveTemplatesin interfaceResteasyWebTarget- Specified by:
resolveTemplatesin interfaceWebTarget- Parameters:
templateValues- a map of URI template names and their values.encodeSlashInPath- iftrue, the slash ('/') characters in template values will be encoded if the template is placed in the URI path component, otherwise the slash characters will not be encoded in path templates.- Returns:
- a new target instance or the same target instance in case the input name-value map is empty.
- Throws:
NullPointerException- if the name-value map or any of the names or values in the map isnull.
-
matrixParam
Description copied from interface:WebTargetCreate a newWebTargetinstance by appending a matrix parameter to the existing set of matrix parameters of the current final segment of the URI of the current target instance. If multiple values are supplied the parameter will be added once per value. In case a singlenullvalue is entered, all parameters with that name in the current final path segment are removed (if present) from the collection of last segment matrix parameters inherited from the current target.Note that the matrix parameters are tied to a particular path segment; appending a value to an existing matrix parameter name will not affect the position of the matrix parameter in the URI path.
A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
matrixParamin interfaceResteasyWebTarget- Specified by:
matrixParamin interfaceWebTarget- Parameters:
name- the matrix parameter name, may contain URI template parameters.values- the matrix parameter value(s), each object will be converted to aStringusing itstoString()method. Stringified values may contain URI template parameters.- Returns:
- a new target instance.
- Throws:
NullPointerException- if the parameter name isnullor if there are multiple values present and any of those values isnull.- See Also:
-
queryParam
Description copied from interface:WebTargetCreate a newWebTargetinstance by configuring a query parameter on the URI of the current target instance. If multiple values are supplied the parameter will be added once per value. In case a singlenullvalue is entered, all parameters with that name are removed (if present) from the collection of query parameters inherited from the current target.A snapshot of the present configuration of the current (parent) target instance is taken and is inherited by the newly constructed (child) target instance.
- Specified by:
queryParamin interfaceResteasyWebTarget- Specified by:
queryParamin interfaceWebTarget- Parameters:
name- the query parameter name, may contain URI template parametersvalues- the query parameter value(s), each object will be converted to aStringusing itstoString()method. Stringified values may contain URI template parameters.- Returns:
- a new target instance.
- Throws:
NullPointerException- if the parameter name isnullor if there are multiple values present and any of those values isnull.
-
queryParams
public ResteasyWebTarget queryParams(MultivaluedMap<String, Object> parameters) throws IllegalArgumentException, NullPointerException- Specified by:
queryParamsin interfaceResteasyWebTarget- Throws:
IllegalArgumentExceptionNullPointerException
-
queryParamNoTemplate
public ResteasyWebTarget queryParamNoTemplate(String name, Object... values) throws NullPointerException Description copied from interface:ResteasyWebTargetWill encode any '{}' characters and not treat them as template parameters.- Specified by:
queryParamNoTemplatein interfaceResteasyWebTarget- Parameters:
name- namevalues- values- Returns:
- web resource target
- Throws:
NullPointerException
-
queryParamsNoTemplate
public ResteasyWebTarget queryParamsNoTemplate(MultivaluedMap<String, Object> parameters) throws IllegalArgumentException, NullPointerExceptionDescription copied from interface:ResteasyWebTargetWill encode any '{}' characters and not treat them as template parameters.- Specified by:
queryParamsNoTemplatein interfaceResteasyWebTarget- Parameters:
parameters- parameters map- Returns:
- web resource target
- Throws:
IllegalArgumentExceptionNullPointerException
-
newInstance
protected ClientWebTarget newInstance(ResteasyClient client, UriBuilder uriBuilder, ClientConfiguration configuration) -
request
Description copied from interface:WebTargetStart building a request to the targeted web resource. -
request
Description copied from interface:WebTargetStart building a request to the targeted web resource and define the accepted response media types.Invoking this method is identical to:
webTarget.request().accept(types);
-
request
Description copied from interface:WebTargetStart building a request to the targeted web resource and define the accepted response media types.Invoking this method is identical to:
webTarget.request().accept(types);
-
createClientInvocationBuilder
protected ClientInvocationBuilder createClientInvocationBuilder(ResteasyClient client, URI uri, ClientConfiguration configuration) -
property
Description copied from interface:ConfigurableSet the new configuration property, if already set, the existing value of the property will be updated. Setting anullvalue into a property effectively removes the property from the property bag.- Specified by:
propertyin interfaceConfigurable<WebTarget>- Specified by:
propertyin interfaceResteasyWebTarget- Parameters:
name- property name.value- (new) property value.nullvalue removes the property with the given name.- Returns:
- the updated configurable instance.
-
register
Description copied from interface:ConfigurableRegister a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context. Implementations SHOULD warn about and ignore registrations that do not conform to the requirements of supported JAX-RS component types in the given configurable context. Any subsequent registration attempts for a component type, for which a class or instance-based registration already exists in the system MUST be rejected by the JAX-RS implementation and a warning SHOULD be raised to inform the user about the rejected registration. The registered JAX-RS component class is registered as a contract provider of all the recognized JAX-RS or implementation-specific extension contracts including meta-provider contracts, such asFeatureorDynamicFeature.As opposed to component instances registered via
Configurable.register(Object)method, the lifecycle of components registered using this class-basedregister(...)method is fully managed by the JAX-RS implementation or any underlying IoC container supported by the implementation.- Specified by:
registerin interfaceConfigurable<WebTarget>- Specified by:
registerin interfaceResteasyWebTarget- Parameters:
componentClass- JAX-RS component class to be configured in the scope of this configurable context.- Returns:
- the updated configurable context.
-
register
Description copied from interface:ConfigurableRegister a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.This registration method provides the same functionality as
Configurable.register(Class)except that any priority specified on the registered JAX-RS component class viajakarta.annotation.Priorityannotation is overridden with the suppliedpriorityvalue.Note that in case the priority is not applicable to a particular provider contract implemented by the class of the registered component, the supplied
priorityvalue will be ignored for that contract.- Specified by:
registerin interfaceConfigurable<WebTarget>- Specified by:
registerin interfaceResteasyWebTarget- Parameters:
componentClass- JAX-RS component class to be configured in the scope of this configurable context.priority- the overriding priority for the registered component and all the provider contracts the component implements.- Returns:
- the updated configurable context.
-
register
Description copied from interface:ConfigurableRegister a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.This registration method provides the same functionality as
Configurable.register(Class)except the JAX-RS component class is only registered as a provider of the listed extension provider or meta-providercontracts. All explicitly enumerated contract types must represent a class or an interface implemented or extended by the registered component. Contracts that are notassignable fromthe registered component class MUST be ignored and implementations SHOULD raise a warning to inform users about the ignored contract(s).- Specified by:
registerin interfaceConfigurable<WebTarget>- Specified by:
registerin interfaceResteasyWebTarget- Parameters:
componentClass- JAX-RS component class to be configured in the scope of this configurable context.contracts- the specific extension provider or meta-provider contracts implemented by the component for which the component should be registered. Implementations MUST ignore attempts to register a component class for an empty ornullcollection of contracts via this method and SHOULD raise a warning about such event.- Returns:
- the updated configurable context.
-
register
Description copied from interface:ConfigurableRegister a class of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.This registration method provides same functionality as
Configurable.register(Class, Class[])except that any priority specified on the registered JAX-RS component class viajakarta.annotation.Priorityannotation is overridden for each extension provider contract type separately with an integer priority value specified as a value in the supplied map of [contract type, priority] pairs.Note that in case a priority is not applicable to a provider contract registered for the JAX-RS component, the supplied priority value is ignored for such contract.
- Specified by:
registerin interfaceConfigurable<WebTarget>- Specified by:
registerin interfaceResteasyWebTarget- Parameters:
componentClass- JAX-RS component class to be configured in the scope of this configurable context.contracts- map of the specific extension provider and meta-provider contracts and their associated priorities for which the JAX-RS component is registered. All contracts in the map must represent a class or an interface implemented or extended by the JAX-RS component. Contracts that are notassignable fromthe registered component class MUST be ignored and implementations SHOULD raise a warning to inform users about the ignored contract(s).- Returns:
- the updated configurable context.
-
register
Description copied from interface:ConfigurableRegister an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context. Implementations SHOULD warn about and ignore registrations that do not conform to the requirements of supported JAX-RS component types in the given configurable context. Any subsequent registration attempts for a component type, for which a class or instance-based registration already exists in the system MUST be rejected by the JAX-RS implementation and a warning SHOULD be raised to inform the user about the rejected registration. The registered JAX-RS component is registered as a contract provider of all the recognized JAX-RS or implementation-specific extension contracts including meta-provider contracts, such asFeatureorDynamicFeature.As opposed to components registered via
Configurable.register(Class)method, the lifecycle of providers registered using this instance-basedregister(...)is not managed by JAX-RS runtime. The same registered component instance is used during the whole lifespan of the configurable context. Fields and properties of all registered JAX-RS component instances are injected with their declared dependencies (seeContext) by the JAX-RS runtime prior to use.- Specified by:
registerin interfaceConfigurable<WebTarget>- Specified by:
registerin interfaceResteasyWebTarget- Parameters:
component- JAX-RS component instance to be configured in the scope of this configurable context.- Returns:
- the updated configurable context.
-
register
Description copied from interface:ConfigurableRegister an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.This registration method provides the same functionality as
Configurable.register(Object)except that any priority specified on the registered JAX-RS component class viajakarta.annotation.Priorityannotation is overridden with the suppliedpriorityvalue.Note that in case the priority is not applicable to a particular provider contract implemented by the class of the registered component, the supplied
priorityvalue will be ignored for that contract.- Specified by:
registerin interfaceConfigurable<WebTarget>- Specified by:
registerin interfaceResteasyWebTarget- Parameters:
component- JAX-RS component instance to be configured in the scope of this configurable context.priority- the overriding priority for the registered component and all the provider contracts the component implements.- Returns:
- the updated configurable context.
-
register
Description copied from interface:ConfigurableRegister an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.This registration method provides the same functionality as
Configurable.register(Object)except the JAX-RS component class is only registered as a provider of the listed extension provider or meta-providercontracts. All explicitly enumerated contract types must represent a class or an interface implemented or extended by the registered component. Contracts that are notassignable fromthe registered component class MUST be ignored and implementations SHOULD raise a warning to inform users about the ignored contract(s).- Specified by:
registerin interfaceConfigurable<WebTarget>- Specified by:
registerin interfaceResteasyWebTarget- Parameters:
component- JAX-RS component instance to be configured in the scope of this configurable context.contracts- the specific extension provider or meta-provider contracts implemented by the component for which the component should be registered. Implementations MUST ignore attempts to register a component class for an empty ornullcollection of contracts via this method and SHOULD raise a warning about such event.- Returns:
- the updated configurable context.
-
register
Description copied from interface:ConfigurableRegister an instance of a custom JAX-RS component (such as an extension provider or afeaturemeta-provider) to be instantiated and used in the scope of this configurable context.This registration method provides same functionality as
Configurable.register(Object, Class[])except that any priority specified on the registered JAX-RS component class viajakarta.annotation.Priorityannotation is overridden for each extension provider contract type separately with an integer priority value specified as a value in the supplied map of [contract type, priority] pairs.Note that in case a priority is not applicable to a provider contract registered for the JAX-RS component, the supplied priority value is ignored for such contract.
- Specified by:
registerin interfaceConfigurable<WebTarget>- Specified by:
registerin interfaceResteasyWebTarget- Parameters:
component- JAX-RS component instance to be configured in the scope of this configurable context.contracts- map of the specific extension provider and meta-provider contracts and their associated priorities for which the JAX-RS component is registered. All contracts in the map must represent a class or an interface implemented or extended by the JAX-RS component. Contracts that are notassignable fromthe registered component class MUST be ignored and implementations SHOULD raise a warning to inform users about the ignored contract(s).- Returns:
- the updated configurable context.
-
setChunked
- Specified by:
setChunkedin interfaceResteasyWebTarget
-