Class WebResourceFactory
java.lang.Object
org.glassfish.jersey.client.proxy.WebResourceFactory
- All Implemented Interfaces:
InvocationHandler
Factory for client-side representation of a resource.
See the package overview
for an example on how to use this class.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
WebResourceFactory
(javax.ws.rs.client.WebTarget target, javax.ws.rs.core.MultivaluedMap<String, Object> headers, List<javax.ws.rs.core.Cookie> cookies, javax.ws.rs.core.Form form) -
Method Summary
Modifier and TypeMethodDescriptionprivate static javax.ws.rs.client.WebTarget
addPathFromAnnotation
(AnnotatedElement ae, javax.ws.rs.client.WebTarget target) private Object[]
convert
(Collection value) private static String
private boolean
hasAnyParamAnnotation
(Map<Class, Annotation> anns) static <C> C
newResource
(Class<C> resourceInterface, javax.ws.rs.client.WebTarget target) Creates a new client-side representation of a resource described by the interface passed in the first argument.static <C> C
newResource
(Class<C> resourceInterface, javax.ws.rs.client.WebTarget target, boolean ignoreResourcePath, javax.ws.rs.core.MultivaluedMap<String, Object> headers, List<javax.ws.rs.core.Cookie> cookies, javax.ws.rs.core.Form form) Creates a new client-side representation of a resource described by the interface passed in the first argument.toString()
-
Field Details
-
EMPTY
-
target
private final javax.ws.rs.client.WebTarget target -
headers
-
cookies
-
form
private final javax.ws.rs.core.Form form -
EMPTY_HEADERS
-
EMPTY_FORM
private static final javax.ws.rs.core.Form EMPTY_FORM -
PARAM_ANNOTATION_CLASSES
-
-
Constructor Details
-
WebResourceFactory
-
-
Method Details
-
newResource
Creates a new client-side representation of a resource described by the interface passed in the first argument. Calling this method has the same effect as callingWebResourceFactory.newResource(resourceInterface, rootTarget, false)
.- Type Parameters:
C
- Type of the resource to be created.- Parameters:
resourceInterface
- Interface describing the resource to be created.target
- WebTarget pointing to the resource or the parent of the resource.- Returns:
- Instance of a class implementing the resource interface that can be used for making requests to the server.
-
newResource
public static <C> C newResource(Class<C> resourceInterface, javax.ws.rs.client.WebTarget target, boolean ignoreResourcePath, javax.ws.rs.core.MultivaluedMap<String, Object> headers, List<javax.ws.rs.core.Cookie> cookies, javax.ws.rs.core.Form form) Creates a new client-side representation of a resource described by the interface passed in the first argument.- Type Parameters:
C
- Type of the resource to be created.- Parameters:
resourceInterface
- Interface describing the resource to be created.target
- WebTarget pointing to the resource or the parent of the resource.ignoreResourcePath
- If set to true, ignores path annotation on the resource interface (this is used when creating sub-resources)headers
- Header params collected from parent resources (used when creating a sub-resource)cookies
- Cookie params collected from parent resources (used when creating a sub-resource)form
- Form params collected from parent resources (used when creating a sub-resource)- Returns:
- Instance of a class implementing the resource interface that can be used for making requests to the server.
-
invoke
- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-
hasAnyParamAnnotation
-
convert
-
addPathFromAnnotation
private static javax.ws.rs.client.WebTarget addPathFromAnnotation(AnnotatedElement ae, javax.ws.rs.client.WebTarget target) -
toString
-
getHttpMethodName
-