• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java JAXRSBindingFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cxf.jaxrs.JAXRSBindingFactory的典型用法代码示例。如果您正苦于以下问题:Java JAXRSBindingFactory类的具体用法?Java JAXRSBindingFactory怎么用?Java JAXRSBindingFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JAXRSBindingFactory类属于org.apache.cxf.jaxrs包,在下文中一共展示了JAXRSBindingFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: NutchServer

import org.apache.cxf.jaxrs.JAXRSBindingFactory; //导入依赖的package包/类
private NutchServer() {
  configManager = new ConfManagerImpl();
  BlockingQueue<Runnable> runnables = Queues.newArrayBlockingQueue(JOB_CAPACITY);
  NutchServerPoolExecutor executor = new NutchServerPoolExecutor(10, JOB_CAPACITY, 1, TimeUnit.HOURS, runnables);
  jobManager = new JobManagerImpl(new JobFactory(), configManager, executor);
  fetchNodeDb = FetchNodeDb.getInstance();

  sf = new JAXRSServerFactoryBean();
  BindingFactoryManager manager = sf.getBus().getExtension(BindingFactoryManager.class);
  JAXRSBindingFactory factory = new JAXRSBindingFactory();
  factory.setBus(sf.getBus());
  manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, factory);
  sf.setResourceClasses(getClasses());
  sf.setResourceProviders(getResourceProviders());
  sf.setProvider(new JacksonJaxbJsonProvider());

}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:18,代码来源:NutchServer.java


示例2: shutdown

import org.apache.cxf.jaxrs.JAXRSBindingFactory; //导入依赖的package包/类
public static void shutdown() throws Exception {
	logger.warn("shutdown");
	if (restartNum > 0) {
		throw new Exception("Cannot support shutdown again");
	}		
	if (server != null) {
		server.stop();
		server.destroy();
		server = null;
	}
	if (serverFactoryBean != null) {
		serverFactoryBean.getBus().shutdown(true);
		BindingFactoryManager manager = serverFactoryBean.getBus().getExtension(BindingFactoryManager.class);
		manager.unregisterBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID);
		serverFactoryBean = null;
		bindingFactory.getBus().shutdown(true);
		bindingFactory = null;
	}
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:20,代码来源:CxfServerBean.java


示例3: startServices

import org.apache.cxf.jaxrs.JAXRSBindingFactory; //导入依赖的package包/类
/**
 * Helper method to start all rest services on a Jettison server as supplied
 * by the Apache cxf libraries.
 * 
 * @throws Exception
 */
private static void startServices() throws Exception {
	List<JSONProvider> providers = new ArrayList<JSONProvider>();
	JSONProvider jsonProvider = new JSONProvider();
	// jsonProvider.setSerializeAsArray(false);
	// jsonProvider.setConvertTypesToStrings(true);
	Map<String, String> map = new HashMap<String, String>();
	map.put("http://www.goodrick.ch", "brewcontrol");
	jsonProvider.setNamespaceMap(map);
	providers.add(jsonProvider);

	JAXRSServerFactoryBean factoryBean = new JAXRSServerFactoryBean();
	factoryBean.setResourceClasses(RestService.class, MashingService.class, InfoService.class);
	factoryBean.setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID);
	factoryBean.setAddress("http://" + getNetworkAddress() + ":8080/");
	factoryBean.setProviders(providers);
	factoryBean.create();
}
 
开发者ID:SebiGo,项目名称:BrewControlServer,代码行数:24,代码来源:BrewControl.java


示例4: prepareTestInstance

import org.apache.cxf.jaxrs.JAXRSBindingFactory; //导入依赖的package包/类
@Override
public void prepareTestInstance(TestContext testContext) throws Exception {
    JAXRSServerFactoryBean factory = testContext.getApplicationContext().getBean(JAXRSServerFactoryBean.class);
    String basePath = testContext.getApplicationContext().getEnvironment()
            .getProperty("basePath", "http://localhost:9080/api/");
    logger.debug("Creating JAX-RS Server for resource {} under {} ", testContext.getTestClass(), basePath);
    factory.setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID);
    factory.setAddress(basePath);
    server = factory.create();
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:11,代码来源:JAXRSServerExecutionListener.java


示例5: publishService

import org.apache.cxf.jaxrs.JAXRSBindingFactory; //导入依赖的package包/类
/**
	 * This publishes the cxf service onto the cxf bus.
	 *
	 * @param serviceImpl
	 * @throws Exception
	 */
	@Override
	public void publishService(ServiceDefinition serviceDefinition, Object serviceImpl, String address) {
		RestServiceDefinition restServiceDef = (RestServiceDefinition)serviceDefinition;

		LOG.info("Creating JAXRSService " + restServiceDef.getServiceName());
		JAXRSServerFactoryBean svrFactory = new JAXRSServerFactoryBean();
        svrFactory.setBus(getCXFBus());

        List<Object> resources = restServiceDef.getResources();
        if (resources != null && !resources.isEmpty()) {
        	svrFactory.setServiceBeans(resources);
        } else {
        	try {
        		Class<?> resourceClass = this.getClass().getClassLoader().loadClass(restServiceDef.getResourceClass());
        		svrFactory.setResourceClasses(resourceClass);
        		svrFactory.setResourceProvider(resourceClass, new SingletonResourceProvider(serviceImpl));
        	} catch (ClassNotFoundException e) {
        		throw new RiceRuntimeException("Failed to publish the service because resource class could not be loaded: " + restServiceDef.getResourceClass(), e);
        	}
        }

        svrFactory.setServiceName(restServiceDef.getServiceName());
        svrFactory.setAddress(address);
        svrFactory.setExtensionMappings(restServiceDef.getExtensionMappings());
        svrFactory.setLanguageMappings(restServiceDef.getLanguageMappings());

        List<Object> providers = restServiceDef.getProviders();
        if (providers != null) {
        	svrFactory.setProviders(providers);
        }

        BindingFactoryManager bindingFactoryManager = getCXFBus().getExtension(BindingFactoryManager.class);
        JAXRSBindingFactory bindingFactory = new JAXRSBindingFactory();
        bindingFactory.setBus(getCXFBus());
        bindingFactoryManager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, bindingFactory);

		//Set logging interceptors
        if (LOG.isDebugEnabled()) {
        	svrFactory.getInInterceptors().add(new LoggingInInterceptor());
        }
//        svrFactory.getInInterceptors().add(new RESTConnector.VerifyingInInterceptor());
        if (LOG.isDebugEnabled()) {
        	svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
        }
//		svrFactory.getOutInterceptors().add(new RESTConnector.SigningOutInterceptor());

        svrFactory.setPublishedEndpointUrl(restServiceDef.getEndpointUrl().toExternalForm());
		svrFactory.create();
	}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:56,代码来源:RESTServiceExporter.java


示例6: messageTo

import org.apache.cxf.jaxrs.JAXRSBindingFactory; //导入依赖的package包/类
private Message messageTo(String requestBaseURL, String requestPath) {
	Message message = new SoapMessage(Soap11.getInstance());
	String requestURL = requestBaseURL + requestPath;
	message.put(Message.ENDPOINT_ADDRESS, requestURL);
	message.put(Message.BASE_PATH, requestBaseURL);
	message.put(Message.REQUEST_URI, requestURL);

	HashMap<String, Object> ctx = new HashMap<String, Object>();
	ctx.put(Client.REQUEST_CONTEXT, new HashMap<String, Object>());
	message.put(Message.INVOCATION_CONTEXT, ctx);

	CXFBusImpl bus = new CXFBusImpl();
	BindingFactoryManagerImpl bindingFactoryManager = new BindingFactoryManagerImpl();
	bindingFactoryManager.registerBindingFactory("abc", new JAXRSBindingFactory());
	bus.setExtension(bindingFactoryManager, BindingFactoryManager.class);
	Map<String, ConduitInitiator> conduitInitiators = new HashMap<String, ConduitInitiator>();
	ConduitInitiator ci = new HTTPTransportFactory(bus);
	conduitInitiators.put(ENDPOINT_TRANSPORT_ID, ci);
	ConduitInitiatorManagerImpl cim = new ConduitInitiatorManagerImpl(conduitInitiators);
	bus.setExtension(cim, ConduitInitiatorManager.class);

	Exchange exchange = exchange(message);
	exchange.put(Bus.class, bus);
	EndpointInfo ei = new EndpointInfo();
	ei.setAddress("http://abc123");
	BindingInfo b = new BindingInfo(null, "abc");
	ei.setBinding(b);
	Endpoint endpointMock = mock(Endpoint.class);
	when(endpointMock.getEndpointInfo()).thenReturn(ei);
	exchange.put(Endpoint.class, endpointMock);

	message.setExchange(exchange);
	message.setContent(List.class, new ArrayList<String>());
	circuitBreakerTargetSelector.prepare(message);

	InvocationKey key = new InvocationKey(exchange);
	InvocationContext invocation = circuitBreakerTargetSelector.getInvocation(key);

	invocation.getContext().put(Message.ENDPOINT_ADDRESS, requestPath);
	invocation.getContext().put("org.apache.cxf.request.uri", requestPath);
	return message;
}
 
开发者ID:jaceko,项目名称:cxf-circuit-switcher,代码行数:43,代码来源:CircuitSwitcherTargetSelectorTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LocalizerEvent类代码示例发布时间:2022-05-22
下一篇:
Java SpotifyService类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap