本文整理汇总了Java中org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.setResourceClass方法的典型用法代码示例。如果您正苦于以下问题:Java JAXRSClientFactoryBean.setResourceClass方法的具体用法?Java JAXRSClientFactoryBean.setResourceClass怎么用?Java JAXRSClientFactoryBean.setResourceClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean
的用法示例。
在下文中一共展示了JAXRSClientFactoryBean.setResourceClass方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupJAXRSClientFactoryBean
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
protected void setupJAXRSClientFactoryBean(JAXRSClientFactoryBean cfb, String address) {
// address
if (address != null) {
cfb.setAddress(address);
}
if (modelRef != null) {
cfb.setModelRef(modelRef);
}
if (getResourceClasses() != null && !getResourceClasses().isEmpty()) {
cfb.setResourceClass(getResourceClasses().get(0));
cfb.getServiceFactory().setResourceClasses(getResourceClasses());
}
setupCommonFactoryProperties(cfb);
cfb.setThreadSafe(true);
getNullSafeCxfRsEndpointConfigurer().configure(cfb);
}
示例2: createClient
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
public IOpenDaylightStaticFlowPusherClient createClient(ProtocolSessionContext sessionContext) {
String uri = (String) sessionContext.getSessionParameters().get(ProtocolSessionContext.PROTOCOL_URI);
String switchId = (String) sessionContext.getSessionParameters().get(OpenDaylightProtocolSession.SWITCHID_CONTEXT_PARAM_NAME);
// TODO use switch id to instantiate the client
// create CXF client
ProxyClassLoader classLoader = new ProxyClassLoader();
classLoader.addLoader(IOpenDaylightStaticFlowPusherClient.class.getClassLoader());
classLoader.addLoader(JAXRSClientFactoryBean.class.getClassLoader());
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(uri);
bean.setUsername(odlUserName);
bean.setPassword(odlPassword);
bean.setProvider(new CustomJSONProvider());
bean.setResourceClass(IOpenDaylightStaticFlowPusherClient.class);
bean.setClassLoader(classLoader);
IOpenDaylightStaticFlowPusherClient cxfClient = (IOpenDaylightStaticFlowPusherClient) bean.create();
// create mixed client using CXF and custom Java clients
IOpenDaylightStaticFlowPusherClient client = new OpenDaylightStaticFlowPusherClient(cxfClient, sessionContext);
return client;
}
示例3: createClient
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
public IFloodlightStaticFlowPusherClient createClient(ProtocolSessionContext sessionContext) {
String uri = (String) sessionContext.getSessionParameters().get(ProtocolSessionContext.PROTOCOL_URI);
String switchId = (String) sessionContext.getSessionParameters().get(FloodlightProtocolSession.SWITCHID_CONTEXT_PARAM_NAME);
// TODO use switch id to instantiate the client
// create CXF client
ProxyClassLoader classLoader = new ProxyClassLoader();
classLoader.addLoader(IFloodlightStaticFlowPusherClient.class.getClassLoader());
classLoader.addLoader(JAXRSClientFactoryBean.class.getClassLoader());
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(uri);
bean.setProvider(new CustomJSONProvider());
bean.setResourceClass(IFloodlightStaticFlowPusherClient.class);
bean.setClassLoader(classLoader);
IFloodlightStaticFlowPusherClient cxfClient = (IFloodlightStaticFlowPusherClient) bean.create();
// create mixed client using CXF and custom Java clients
IFloodlightStaticFlowPusherClient client = new FloodlightStaticFlowPusherClient(cxfClient, sessionContext);
return client;
}
示例4: createRestClient
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
/**
* Creates a JAXRSClient with given clientInterface.
*
* @param uri
* the URI where the service is running
* @param clientInterface
* interface class the client should has.
* @param providers
* custom JAX-RS providers
* @param username
* Basic authentication username
* @param password
* Basic authentication password
* @return JAX-RX Client configured with given parameters.
*/
@SuppressWarnings("unchecked")
public static <T> T createRestClient(String uri, Class<T> clientInterface, List<? extends Object> providers, String username, String password) {
ProxyClassLoader classLoader = new ProxyClassLoader();
classLoader.addLoader(clientInterface.getClassLoader());
classLoader.addLoader(JAXRSClientFactoryBean.class.getClassLoader());
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(uri);
if (providers != null && !providers.isEmpty())
bean.setProviders(providers);
bean.setResourceClass(clientInterface);
bean.setClassLoader(classLoader);
if (username != null && password != null) {
bean.setUsername(username);
bean.setPassword(password);
}
return (T) bean.create();
}
示例5: load
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
@Override
public JAXRSClientFactoryBean load(Class<?> proxyType) throws Exception {
JAXRSClientFactoryBean clientFactoryBean = new JAXRSClientFactoryBean();
clientFactoryBean.setResourceClass(proxyType);
clientFactoryBean.setProvider(new TextJacksonJsonProvider(new ApiObjectMapper()));
return clientFactoryBean;
}
示例6: createClient
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
private IResourceModelReader createClient(String addressUri) {
// create CXF client
ProxyClassLoader classLoader = new ProxyClassLoader(IResourceModelReader.class.getClassLoader());
classLoader.addLoader(JAXRSClientFactoryBean.class.getClassLoader());
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(addressUri);
bean.setResourceClass(IResourceModelReader.class);
bean.setClassLoader(classLoader);
return (IResourceModelReader) bean.create();
}
示例7: createClient
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
public IOpenDaylightFlowProgrammerNorthbound createClient(String addressUri, String username, String password) {
// create CXF client
ProxyClassLoader classLoader = new ProxyClassLoader(IOpenDaylightFlowProgrammerNorthbound.class.getClassLoader());
classLoader.addLoader(JAXRSClientFactoryBean.class.getClassLoader());
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(addressUri);
bean.setUsername(username);
bean.setPassword(password);
bean.setResourceClass(IOpenDaylightFlowProgrammerNorthbound.class);
bean.setClassLoader(classLoader);
return (IOpenDaylightFlowProgrammerNorthbound) bean.create();
}
示例8: getClient
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
private static ISwitchNorthboundAPI getClient(String baseURL, String username, String password) {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(baseURL);
bean.setResourceClass(ISwitchNorthboundAPI.class);
bean.setUsername(username);
bean.setPassword(password);
return bean.create(ISwitchNorthboundAPI.class);
}
示例9: WebserviceMockControler
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
public WebserviceMockControler(String mockServiceRootAddress) {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(mockServiceRootAddress);
bean.setResourceClass(MockService.class);
mockServiceProxy = bean.create(MockService.class);
}
示例10: createClient
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
public IOpenDaylightvtnAPIClient createClient(ProtocolSessionContext sessionContext) {
String uri = (String) sessionContext.getSessionParameters().get(ProtocolSessionContext.PROTOCOL_URI);
// TODO use switch id to instantiate the client
// create CXF client
ProxyClassLoader classLoader = new ProxyClassLoader();
classLoader.addLoader(IOpenDaylightvtnAPIClient.class.getClassLoader());
classLoader.addLoader(JAXRSClientFactoryBean.class.getClassLoader());
Map user = new HashMap<String, String>();
user.put("username", odlUserName);
user.put("password", odlPassword);
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(uri);
bean.setHeaders(user);
// bean.setUsername(odlUserName);
// bean.setPassword(odlPassword);
bean.setProvider(new CustomJSONProvider());
bean.setResourceClass(IOpenDaylightvtnAPIClient.class);
bean.setClassLoader(classLoader);
IOpenDaylightvtnAPIClient cxfClient = (IOpenDaylightvtnAPIClient) bean.create();
// create mixed client using CXF and custom Java clients
IOpenDaylightvtnAPIClient client = new OpenDaylightvtnAPIClient(cxfClient, sessionContext);
return client;
}
示例11: JaxRsFailoverIntegrationTest
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
public JaxRsFailoverIntegrationTest() {
bean = new JAXRSClientFactoryBean();
bean.setResourceClass(Library.class);
bean.setAddress("http://dummy:8380");
}