@Path(value="client") public class ClientResource extends Object
@Uri annotation to query
external resources and resource from StandardResource.| Constructor and Description |
|---|
ClientResource() |
| Modifier and Type | Method and Description |
|---|---|
String |
animals(WebTarget dogWebTarget,
WebTarget catWebTarget,
WebTarget elefantWebTarget)
Query
StandardResource and return result based on the results from methods of the StandardResource. |
String |
car(WebTarget webTarget,
String id)
Query
StandardResource using a injected client. |
Response |
glassfish(WebTarget webTarget)
Make request to external web site using injected client.
|
@GET @Produces(value="text/html") @Path(value="glassfish") public Response glassfish(@Uri(value="http://glassfish.java.net/") WebTarget webTarget)
webTarget - Injected web target.@GET @Produces(value="text/plain") @Path(value="animals") public String animals(@Uri(value="resource/dog") WebTarget dogWebTarget, @Uri(value="resource/cat") WebTarget catWebTarget, @Uri(value="resource/elefant") WebTarget elefantWebTarget)
StandardResource and return result based on the results from methods of the StandardResource.dogWebTarget - Injected client.catWebTarget - Injected client.elefantWebTarget - Injected client.@GET @Produces(value="text/plain") @Path(value="car/{id}") public String car(@Uri(value="resource/car/{id}") WebTarget webTarget, @PathParam(value="id") String id)
StandardResource using a injected client. The client injection is using a template parameter id
which is filled by JAX-RS implementation using a path parameter of this resource method.webTarget - Injected client.id - Path parameter.Copyright © 2007-2024,Oracleand/or its affiliates.All Rights Reserved. Use is subject to license terms.