public interface JaxRsClient
Response object. The latter is primarily
for use by callers that need the response's metadata (perhaps in addition to it body). It can
also be used in cases where the response has no body, although an equivalent approach is to
specify Void as the "ResponseClass" generic parameter and Void.class as the
"requestType" method parameter.
Users of this interface can use setErrorHandler(ErrorHandler) to set an
JaxRsClient.ErrorHandler to control whether retries happen or not when HTTP request fail. (If there's
no handler, no retry is attempted).
Largely a wrapper around Apache CXF WebClient.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
JaxRsClient.ErrorHandler
The interface used when requests fail.
|
| Modifier and Type | Field and Description |
|---|---|
static JAXBElement<?> |
EMPTY_CONTENTS |
| Modifier and Type | Method and Description |
|---|---|
<JaxRsClass> |
createProxy(Class<JaxRsClass> jaxRsClass)
Gets a proxy for the specified service.
|
org.apache.cxf.jaxrs.client.WebClient |
createWebClient(URI uri)
Returns a CXF
WebClient corresponding to the specified URI. |
org.apache.cxf.jaxrs.client.WebClient |
createWebClient(URI uri,
String mediaType)
Returns a CXF
WebClient corresponding to the specified URI. |
javax.ws.rs.core.Response |
deleteResource(URI ref)
Deletes the specified resource.
|
<ResponseClass> |
deleteResource(URI ref,
Class<ResponseClass> responseClass)
Deletes the specified contents to the specified resource.
|
void |
deleteResourceVoid(URI ref)
Deletes the specified resource and expects a HTTP 204 response status.
|
URI |
getEndpoint()
Retrieves the endpoint used to create this client
|
<ContentsClass> |
getResource(URI ref)
Gets the specified contents to the specified resource.
|
<ResourceClass> |
getResource(URI ref,
Class<ResourceClass> resourceClass)
Gets the contents of the specified resource.
|
javax.ws.rs.core.Response |
optionsResource(URI ref)
Gets OPTIONS response of the specified resource.
|
<ContentsClass> |
postResource(URI ref,
String mediaType,
JAXBElement<ContentsClass> contents)
Posts the specified contents to the specified resource.
|
<ContentsClass,ResponseClass> |
postResource(URI ref,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Posts the specified contents to the specified resource.
|
<ContentsClass> |
postResourceVoid(URI ref,
String mediaType,
JAXBElement<ContentsClass> contents)
Posts the specified contents to the specified resource.
|
javax.ws.rs.core.Response |
putFile(URI uri,
File file,
String mediaType)
Puts the contents of the specified
file to the specified uri. |
<ContentsClass> |
putResource(URI ref,
String mediaType,
JAXBElement<ContentsClass> contents)
Puts the specified contents to the specified resource.
|
<ContentsClass,ResponseClass> |
putResource(URI ref,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Puts the specified contents to the specified resource.
|
<ContentsClass> |
putResourceVoid(URI ref,
String mediaType,
JAXBElement<ContentsClass> contents)
Puts the specified contents to the specified resource.
|
void |
setErrorHandler(JaxRsClient.ErrorHandler errorHandler)
Sets the handler to be called when requests made with this client fail.
|
static final JAXBElement<?> EMPTY_CONTENTS
<JaxRsClass> JaxRsClass createProxy(Class<JaxRsClass> jaxRsClass)
JaxRsClass - the JAXRS-annotated classjaxRsClass - the JAXRS-annotated classURI getEndpoint()
URI of the endpoint this client talks to<ContentsClass> javax.ws.rs.core.Response getResource(URI ref)
ContentsClass - JAXB-generated class of the request contentsref - reference to the resource<ResourceClass> ResourceClass getResource(URI ref, Class<ResourceClass> resourceClass)
ResourceClass - JAXB-generated class of the resourceref - reference to the resourceresourceClass - JAXB-generated class of the resource<ContentsClass> javax.ws.rs.core.Response putResource(URI ref, String mediaType, JAXBElement<ContentsClass> contents)
ContentsClass - JAXB-generated class of the request contentsref - reference to the resourcemediaType - media type of contentcontents - contents to be put<ContentsClass> void putResourceVoid(URI ref, String mediaType, JAXBElement<ContentsClass> contents)
ContentsClass - JAXB-generated class of the request contentsref - reference to the resourcemediaType - media type of contentcontents - contents to be put<ContentsClass,ResponseClass> ResponseClass putResource(URI ref, String mediaType, JAXBElement<ContentsClass> contents, Class<ResponseClass> responseClass)
ContentsClass - JAXB-generated class of the request contentsResponseClass - JAXB-generated class of the responseref - reference to the resourcemediaType - media type of contentcontents - contents to be putresponseClass - JAXB-generated class of the responsejavax.ws.rs.core.Response putFile(URI uri, File file, String mediaType)
file to the specified uri. (Does an HTTP PUT.)<ContentsClass> javax.ws.rs.core.Response postResource(URI ref, String mediaType, JAXBElement<ContentsClass> contents)
ContentsClass - JAXB-generated class of the request contentsref - reference to the resourcemediaType - media type of contentcontents - contents to be post<ContentsClass> void postResourceVoid(URI ref, String mediaType, JAXBElement<ContentsClass> contents)
ContentsClass - JAXB-generated class of the request contentsref - reference to the resourcemediaType - media type of contentcontents - contents to be post<ContentsClass,ResponseClass> ResponseClass postResource(URI ref, String mediaType, JAXBElement<ContentsClass> contents, Class<ResponseClass> responseClass)
ContentsClass - JAXB-generated class of the request contentsResponseClass - JAXB-generated class of the responseref - reference to the resourcemediaType - media type of contentcontents - contents to be postresponseClass - JAXB-generated class of the responsejavax.ws.rs.core.Response deleteResource(URI ref)
ref - reference to the resourcevoid deleteResourceVoid(URI ref)
ref - reference to the resource<ResponseClass> ResponseClass deleteResource(URI ref, Class<ResponseClass> responseClass)
ResponseClass - JAXB-generated class of the responseref - reference to the resourceresponseClass - JAXB-generated class of the responsejavax.ws.rs.core.Response optionsResource(URI ref)
ref - reference to the resourcevoid setErrorHandler(JaxRsClient.ErrorHandler errorHandler)
org.apache.cxf.jaxrs.client.WebClient createWebClient(URI uri, String mediaType)
WebClient corresponding to the specified URI. Requests on the
resulting WebClient will have their "Content-Type" header set to the specified media type.org.apache.cxf.jaxrs.client.WebClient createWebClient(URI uri)
WebClient corresponding to the specified URI.Copyright © 2019 VMware. All rights reserved.