当前位置: 首页>>代码示例>>Java>>正文


Java JAXRSClientFactoryBean.setResourceClass方法代码示例

本文整理汇总了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);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:CxfRsEndpoint.java

示例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;
  }
 
开发者ID:dana-i2cat,项目名称:opennaas-routing-nfv,代码行数:26,代码来源:OpenDaylightClientFactory.java

示例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;
	}
 
开发者ID:dana-i2cat,项目名称:opennaas-routing-nfv,代码行数:25,代码来源:FloodlightClientFactory.java

示例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();
}
 
开发者ID:dana-i2cat,项目名称:opennaas-routing-nfv,代码行数:36,代码来源:InitializerTestHelper.java

示例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;
}
 
开发者ID:Talend,项目名称:components,代码行数:8,代码来源:AmbariClientBuilder.java

示例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();
	}
 
开发者ID:dana-i2cat,项目名称:mqnaas,代码行数:14,代码来源:ResourceModelReaderTest.java

示例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();
    }
 
开发者ID:dana-i2cat,项目名称:mqnaas,代码行数:16,代码来源:OpenDaylightClientFactory.java

示例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);
}
 
开发者ID:dana-i2cat,项目名称:mqnaas,代码行数:11,代码来源:SwitchNorthboundAPITests.java

示例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);

}
 
开发者ID:jaceko,项目名称:cxf-circuit-switcher,代码行数:8,代码来源:WebserviceMockControler.java

示例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;
    }
 
开发者ID:dana-i2cat,项目名称:opennaas-routing-nfv,代码行数:30,代码来源:OpenDaylightClientFactory.java

示例11: JaxRsFailoverIntegrationTest

import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; //导入方法依赖的package包/类
public JaxRsFailoverIntegrationTest() {
	bean = new JAXRSClientFactoryBean();
	bean.setResourceClass(Library.class);
	bean.setAddress("http://dummy:8380");
}
 
开发者ID:jaceko,项目名称:cxf-circuit-switcher,代码行数:6,代码来源:JaxRsFailoverIntegrationTest.java


注:本文中的org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.setResourceClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。