本文整理汇总了Java中org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.setClassLoader方法的典型用法代码示例。如果您正苦于以下问题:Java JAXRSClientFactoryBean.setClassLoader方法的具体用法?Java JAXRSClientFactoryBean.setClassLoader怎么用?Java JAXRSClientFactoryBean.setClassLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean
的用法示例。
在下文中一共展示了JAXRSClientFactoryBean.setClassLoader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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();
}
示例4: 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();
}
示例5: 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();
}
示例6: 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;
}