當前位置: 首頁>>代碼示例>>Java>>正文


Java JAXRSServerFactoryBean.setServiceBean方法代碼示例

本文整理匯總了Java中org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setServiceBean方法的典型用法代碼示例。如果您正苦於以下問題:Java JAXRSServerFactoryBean.setServiceBean方法的具體用法?Java JAXRSServerFactoryBean.setServiceBean怎麽用?Java JAXRSServerFactoryBean.setServiceBean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.cxf.jaxrs.JAXRSServerFactoryBean的用法示例。


在下文中一共展示了JAXRSServerFactoryBean.setServiceBean方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createJaxrsServer

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Override
public JaxrsServer createJaxrsServer(Class<?> serviceInterface, Object serviceImplementation) {
    final String serviceName = namingStrategy.get().serviceName(serviceInterface);
    final Config serverConfig = configService.createServerConfig(serviceInterface, serviceName);
    final String baseAddress = serverConfig.value(BASE_ADDRESS_PROP).orElse(StringUtils.EMPTY);
    final String serverAddress = serverConfig.value(SERVER_ADDRESS_PROP).orElse(namingStrategy.get().serverAddress(serviceInterface));
    final String fullAddress = baseAddress + serverAddress;
    LOGGER.info("Starting {} JAX-RS server ({})...", serviceInterface.getSimpleName(), fullAddress);

    final DefaultJaxrsServiceDescriptor descriptor = new DefaultJaxrsServiceDescriptor(serviceInterface, serviceName);
    decorate(descriptor, serverConfig);
    final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setBus(BusFactory.getDefaultBus(true));
    sf.setServiceBean(serviceImplementation);

    sf.setAddress(fullAddress);
    sf.setFeatures(descriptor.getFeatures());
    sf.setProviders(descriptor.getProviders());
    final Server server = sf.create();
    LOGGER.info("Successfully started {} JAX-RS server ({}).", serviceInterface.getSimpleName(), serverAddress);
    return server::destroy;
}
 
開發者ID:Microbule,項目名稱:microbule,代碼行數:23,代碼來源:DefaultJaxrsServerFactory.java

示例2: publishRest

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
private static int publishRest(JAXRSServerFactoryBean sf, List<TbSysWsConfig> configs) {
	int c = 0;
	for (TbSysWsConfig config : configs) {
		if (!WSConfig.TYPE_REST.equals(config.getType())) {
			continue;
		}
		try {
			sf.setServiceBean(AppContext.getBean(config.getBeanId()));
			c++;				
		} catch (Exception e) {
			e.printStackTrace();
		}
	}		
	sf.setProviders(getProvider());
	sf.setAddress(WSConfig.getJAXRSServerFactoryBeanAddress());
	return c;
}
 
開發者ID:billchen198318,項目名稱:bamboobsc,代碼行數:18,代碼來源:CxfServerBean.java

示例3: createServerValidationRestService

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Bean
public Server createServerValidationRestService() {
	JAXRSServerFactoryBean sfb = new JAXRSServerFactoryBean();
	sfb.setServiceBean(restValidationService());
	sfb.setAddress(REST_VALIDATION);
	sfb.setProvider(jacksonJsonProvider());
	return sfb.create();
}
 
開發者ID:esig,項目名稱:dss-demonstrations,代碼行數:9,代碼來源:CXFConfig.java

示例4: createServerSigningRestService

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Bean
public Server createServerSigningRestService() {
	JAXRSServerFactoryBean sfb = new JAXRSServerFactoryBean();
	sfb.setServiceBean(restServerSigningService());
	sfb.setAddress(REST_SERVER_SIGNING);
	sfb.setProvider(jacksonJsonProvider());
	return sfb.create();
}
 
開發者ID:esig,項目名稱:dss-demonstrations,代碼行數:9,代碼來源:CXFConfig.java

示例5: createOneDocumentSignatureRestService

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Bean
public Server createOneDocumentSignatureRestService() {
	JAXRSServerFactoryBean sfb = new JAXRSServerFactoryBean();
	sfb.setServiceBean(restSignatureService());
	sfb.setAddress(REST_SIGNATURE_ONE_DOCUMENT);
	sfb.setProvider(jacksonJsonProvider());
	return sfb.create();
}
 
開發者ID:esig,項目名稱:dss-demonstrations,代碼行數:9,代碼來源:CXFConfig.java

示例6: createMultipleDocumentRestService

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Bean
public Server createMultipleDocumentRestService() {
	JAXRSServerFactoryBean sfb = new JAXRSServerFactoryBean();
	sfb.setServiceBean(restMultipleDocumentsSignatureService());
	sfb.setAddress(REST_SIGNATURE_MULTIPLE_DOCUMENTS);
	sfb.setProvider(jacksonJsonProvider());
	return sfb.create();
}
 
開發者ID:esig,項目名稱:dss-demonstrations,代碼行數:9,代碼來源:CXFConfig.java

示例7: deploy

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
private void deploy(final String contextRoot, final Class<?> clazz, final String address, final ResourceProvider rp, final Object serviceBean,
                    final Application app, final Invoker invoker, final Collection<Object> additionalProviders, final ServiceConfiguration configuration,
                    final WebBeansContext webBeansContext) {
    final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(CxfUtil.initBusLoader());
    try {
        final JAXRSServerFactoryBean factory = newFactory(address, createServiceJmxName(clazz.getClassLoader()), createEndpointName(app));
        configureFactory(additionalProviders, configuration, factory, webBeansContext);
        factory.setResourceClasses(clazz);
        context = contextRoot;
        if (context == null) {
            context = "";
        }
        if (!context.startsWith("/")) {
            context = "/" + context;
        }

        if (rp != null) {
            factory.setResourceProvider(rp);
        }
        if (app != null) {
            factory.setApplication(app);
        }
        if (invoker != null) {
            factory.setInvoker(invoker);
        }
        if (serviceBean != null) {
            factory.setServiceBean(serviceBean);
        } else {
            factory.setServiceClass(clazz);
        }

        server = factory.create();
        destination = (HttpDestination) server.getDestination();

        fireServerCreated(oldLoader);
    } finally {
        if (oldLoader != null) {
            CxfUtil.clearBusLoader(oldLoader);
        }
    }
}
 
開發者ID:apache,項目名稱:tomee,代碼行數:43,代碼來源:CxfRsHttpListener.java


注:本文中的org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setServiceBean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。