public abstract class AbstractCxfRestClient extends Object implements JaxRsClient
JaxRsClient that are based on CXF.JaxRsClient.ErrorHandler| Modifier and Type | Field and Description |
|---|---|
protected URI |
endpoint |
EMPTY_CONTENTS| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCxfRestClient(AbstractCxfRestClient client) |
protected |
AbstractCxfRestClient(URI endpoint) |
protected |
AbstractCxfRestClient(URI endpoint,
AbstractCxfRestClient client) |
protected |
AbstractCxfRestClient(URI endpoint,
CxfClientSecurityContext cxfClientSecurityContext) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureClient(Object client) |
protected abstract void |
configureHttpRequestHeaders(org.apache.cxf.jaxrs.client.Client client)
A method that must be implemented by derived classes to set any
HTTP request headers that the REST API implemented in such derived classes
require for proper operation.
|
protected void |
configureSSLTrustManager(org.apache.cxf.jaxrs.client.ClientConfiguration config)
Set the appropriate ssl context and https hostname verification for this client
|
<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 type)
Returns a CXF
WebClient corresponding to the specified URI. |
javax.ws.rs.core.Response |
deleteResource(URI uri)
Deletes the specified resource.
|
<ResponseClass> |
deleteResource(URI uri,
Class<ResponseClass> responseClass)
Deletes the specified contents to the specified resource.
|
void |
deleteResourceVoid(URI uri)
Deletes the specified resource and expects a HTTP 204 response status.
|
protected abstract List<?> |
getCxfProviders() |
URI |
getEndpoint()
Retrieves the endpoint used to create this client
|
javax.ws.rs.core.Response |
getResource(URI uri)
Gets the specified contents to the specified resource.
|
<ResourceClass> |
getResource(URI uri,
Class<ResourceClass> resourceClass)
Gets the contents of the specified resource.
|
protected RuntimeException |
makeException(javax.ws.rs.WebApplicationException exception) |
javax.ws.rs.core.Response |
optionsResource(URI uri)
Gets OPTIONS response of the specified resource.
|
<ContentsClass> |
postResource(URI uri,
String type,
JAXBElement<ContentsClass> contents)
Posts the specified contents to the specified resource.
|
<ContentsClass,ResponseClass> |
postResource(URI uri,
String type,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Posts the specified contents to the specified resource.
|
<ContentsClass> |
postResourceVoid(URI uri,
String type,
JAXBElement<ContentsClass> contents)
Posts the specified contents to the specified resource.
|
javax.ws.rs.core.Response |
putFile(URI uri,
File file,
String type)
Puts the contents of the specified
file to the specified uri. |
<ContentsClass> |
putResource(URI uri,
String type,
JAXBElement<ContentsClass> contents)
Puts the specified contents to the specified resource.
|
<ContentsClass,ResponseClass> |
putResource(URI uri,
String type,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Puts the specified contents to the specified resource.
|
<ContentsClass> |
putResourceVoid(URI uri,
String type,
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.
|
protected final URI endpoint
protected AbstractCxfRestClient(URI endpoint)
protected AbstractCxfRestClient(URI endpoint, CxfClientSecurityContext cxfClientSecurityContext)
protected AbstractCxfRestClient(AbstractCxfRestClient client)
protected AbstractCxfRestClient(URI endpoint, AbstractCxfRestClient client)
protected abstract List<?> getCxfProviders()
WebClients we create.protected abstract void configureHttpRequestHeaders(org.apache.cxf.jaxrs.client.Client client)
public <JaxRsClass> JaxRsClass createProxy(Class<JaxRsClass> jaxRsClass)
JaxRsClientcreateProxy in interface JaxRsClientJaxRsClass - the JAXRS-annotated classjaxRsClass - the JAXRS-annotated classpublic URI getEndpoint()
JaxRsClientgetEndpoint in interface JaxRsClientURI of the endpoint this client talks topublic javax.ws.rs.core.Response getResource(URI uri)
JaxRsClientgetResource in interface JaxRsClienturi - reference to the resourcepublic <ResourceClass> ResourceClass getResource(URI uri, Class<ResourceClass> resourceClass)
JaxRsClientgetResource in interface JaxRsClientResourceClass - JAXB-generated class of the resourceuri - reference to the resourceresourceClass - JAXB-generated class of the resourcepublic <ContentsClass> javax.ws.rs.core.Response putResource(URI uri, String type, JAXBElement<ContentsClass> contents)
JaxRsClientputResource in interface JaxRsClientContentsClass - JAXB-generated class of the request contentsuri - reference to the resourcetype - media type of contentcontents - contents to be putpublic <ContentsClass> void putResourceVoid(URI uri, String type, JAXBElement<ContentsClass> contents)
JaxRsClientputResourceVoid in interface JaxRsClientContentsClass - JAXB-generated class of the request contentsuri - reference to the resourcetype - media type of contentcontents - contents to be putpublic <ContentsClass,ResponseClass> ResponseClass putResource(URI uri, String type, JAXBElement<ContentsClass> contents, Class<ResponseClass> responseClass)
JaxRsClientputResource in interface JaxRsClientContentsClass - JAXB-generated class of the request contentsResponseClass - JAXB-generated class of the responseuri - reference to the resourcetype - media type of contentcontents - contents to be putresponseClass - JAXB-generated class of the responsepublic javax.ws.rs.core.Response putFile(URI uri, File file, String type)
JaxRsClientfile to the specified uri. (Does an HTTP PUT.)putFile in interface JaxRsClienturi - HTTP PUT target URIfile - File to uploadtype - media type of contentpublic <ContentsClass> javax.ws.rs.core.Response postResource(URI uri, String type, JAXBElement<ContentsClass> contents)
JaxRsClientpostResource in interface JaxRsClientContentsClass - JAXB-generated class of the request contentsuri - reference to the resourcetype - media type of contentcontents - contents to be postpublic <ContentsClass> void postResourceVoid(URI uri, String type, JAXBElement<ContentsClass> contents)
JaxRsClientpostResourceVoid in interface JaxRsClientContentsClass - JAXB-generated class of the request contentsuri - reference to the resourcetype - media type of contentcontents - contents to be postpublic <ContentsClass,ResponseClass> ResponseClass postResource(URI uri, String type, JAXBElement<ContentsClass> contents, Class<ResponseClass> responseClass)
JaxRsClientpostResource in interface JaxRsClientContentsClass - JAXB-generated class of the request contentsResponseClass - JAXB-generated class of the responseuri - reference to the resourcetype - media type of contentcontents - contents to be postresponseClass - JAXB-generated class of the responsepublic javax.ws.rs.core.Response deleteResource(URI uri)
JaxRsClientdeleteResource in interface JaxRsClienturi - reference to the resourceprotected RuntimeException makeException(javax.ws.rs.WebApplicationException exception)
public void deleteResourceVoid(URI uri)
JaxRsClientdeleteResourceVoid in interface JaxRsClienturi - reference to the resourcepublic <ResponseClass> ResponseClass deleteResource(URI uri, Class<ResponseClass> responseClass)
JaxRsClientdeleteResource in interface JaxRsClientResponseClass - JAXB-generated class of the responseuri - reference to the resourceresponseClass - JAXB-generated class of the responsepublic javax.ws.rs.core.Response optionsResource(URI uri)
JaxRsClientoptionsResource in interface JaxRsClienturi - reference to the resourcepublic org.apache.cxf.jaxrs.client.WebClient createWebClient(URI uri)
JaxRsClientWebClient corresponding to the specified URI.createWebClient in interface JaxRsClientpublic org.apache.cxf.jaxrs.client.WebClient createWebClient(URI uri, String type)
JaxRsClientWebClient corresponding to the specified URI. Requests on the
resulting WebClient will have their "Content-Type" header set to the specified media type.createWebClient in interface JaxRsClientpublic void setErrorHandler(JaxRsClient.ErrorHandler errorHandler)
JaxRsClientsetErrorHandler in interface JaxRsClientprotected final void configureSSLTrustManager(org.apache.cxf.jaxrs.client.ClientConfiguration config)
protected void configureClient(Object client)
Copyright © 2019 VMware. All rights reserved.