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


Java JAXRSServerFactoryBean.setProvider方法代碼示例

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


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

示例1: NutchServer

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的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: serverEndPoint

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Bean
public Server serverEndPoint(final SpringBus bus)
{
	final JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();

	final JMSConfigFeature jmsConfigFeature = createJMSConfigFeature();

	final JAXRSServerFactoryBean svrFactory = new JAXRSServerFactoryBean();
	svrFactory.setBus(bus);
	svrFactory.setResourceClasses(AgentSync.class);

	svrFactory.getFeatures().add(jmsConfigFeature);
	svrFactory.getFeatures().add(loggingFeature);

	svrFactory.setProvider(jacksonJaxbJsonProvider);
	svrFactory.setAddress("/");
	svrFactory.setTransportId("http://cxf.apache.org/transports/jms");

	final Server server = svrFactory.create();
	return server;
}
 
開發者ID:metasfresh,項目名稱:metasfresh-procurement-webui,代碼行數:22,代碼來源:SyncConfiguration.java

示例3: jaxRsServer

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Bean
  @DependsOn("cxf")
  public Server jaxRsServer() {
      JAXRSServerFactoryBean serverFactory = RuntimeDelegate.getInstance().createEndpoint(jaxRsApiApplication(), JAXRSServerFactoryBean.class);
      
      //factory.setServiceBean(new DenialCategoryRest());
      
// get all the class annotated with @JaxrsService
      List<Object> beans = configUtil.findBeans( JaxrsService.class );

if (beans.size() > 0) {
	
	// add all the CXF service classes into the CXF stack
	serverFactory.setServiceBeans( beans );
	serverFactory.setAddress("/"+ serverFactory.getAddress());
	serverFactory.setBus(springBus);
	serverFactory.setStart(true);
	
	// set JSON as the response serializer
	JacksonJsonProvider provider = new JacksonJsonProvider();
	serverFactory.setProvider(provider);
       
}
      
return serverFactory.create();
  }
 
開發者ID:amoldavsky,項目名稱:restful-api-cxf-spring-java,代碼行數:27,代碼來源:CxfConfig.java

示例4: setup

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Before
public void setup() {
    catalog = new CamelCatalogRest();

    port = AvailablePortFinder.getNextAvailable(9000);

    // setup Apache CXF REST server
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(CamelCatalogRest.class);
    sf.setResourceProvider(CamelCatalogRest.class, new SingletonResourceProvider(catalog));
    // to use jackson for json
    sf.setProvider(JacksonJsonProvider.class);
    sf.setAddress("http://localhost:" + port);

    // create and start the CXF server (non blocking)
    server = sf.create();
    server.start();
}
 
開發者ID:fabric8io,項目名稱:django,代碼行數:19,代碼來源:CamelCatalogRestTest.java

示例5: doPublishRestful

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
private void doPublishRestful(Map<Class<?>, ResourceProvider> springResources) {
		JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
		sf.setBus(getBus());
		for (Entry<Class<?>, ResourceProvider> e : springResources.entrySet()) {
			sf.setResourceClasses(e.getKey());
			sf.setResourceProvider(e.getKey(), e.getValue());
			log.info("Publishing JAX-RS Service {} at {}", e, httpPrefix + restBasePath);
		}
		sf.setAddress(httpPrefix + restBasePath);
//		if (restUseFastJson == 1) {
//			sf.setProvider(new FastJSONProvider(false, restJsonWithClassname));
//		} else {
			sf.setProvider(new FastJSONProvider(true, restJsonWithClassname));
//		}
		sf.getInInterceptors().add(new LoggingInInterceptor());
		sf.getOutInterceptors().add(new LoggingOutInterceptor());
		sf.create();

	}
 
開發者ID:GeeQuery,項目名稱:cxf-plus,代碼行數:20,代碼來源:CXFPlusServlet.java

示例6: addingService

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Override
public Object addingService(ServiceReference serviceReference) {
    final Object trackedService = context.getService(serviceReference);

    if (trackedService instanceof EntityService) {
        final EntityServiceRest restApi = new EntityServiceRest();
        restApi.setEntityService((EntityService) trackedService);

        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
        sf.setResourceClasses(restApi.getClass());
        sf.setResourceProvider(restApi.getClass(), new SingletonResourceProvider(restApi));
        sf.setAddress("/entity");
        sf.setProvider(new JacksonJsonProvider());
        server = sf.create();
    }

    return trackedService;
}
 
開發者ID:bpedman,項目名稱:osgi-sample,代碼行數:19,代碼來源:Activator.java

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: jaxRsServer

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Bean
  @DependsOn("cxf")
  public Server jaxRsServer() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
// sf.setResourceClasses( MyJaxrsResource.class );

List<Object> providers = new ArrayList<Object>();
// add custom providers if any
sf.setProviders(providers);

// factory.setServiceBean(new DenialCategoryRest());

// get all the class annotated with @JaxrsService
List<Object> beans = configUtil.findBeans(JaxrsService.class);
// List<Class> beansClasses = configUtil.findClasses( JaxrsService.class
// );

if (beans.size() > 0) {

	// add all the CXF service classes into the CXF stack
	//sf.setResourceClasses(UserRestImpl.class);
	sf.setServiceBeans(beans);
	sf.setAddress("http://localhost:8080/api");
	sf.setBus(springBus);
	sf.setStart(true);

	// set JSON as the response serializer
	JacksonJsonProvider provider = new JacksonJsonProvider();
	sf.setProvider(provider);

}

return sf.create();
  }
 
開發者ID:amoldavsky,項目名稱:restful-api-cxf-spring-java,代碼行數:35,代碼來源:CxfTestConfig.java

示例12: setup

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
@Before
public void setup() {
    catalog = new CamelCatalogRest();

    port = AvailablePortFinder.getNextAvailable(9000);

    // setup Apache CXF REST server
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(CamelCatalogRest.class);
    sf.setResourceProvider(CamelCatalogRest.class, new SingletonResourceProvider(catalog));

    Swagger2Feature swagger = new Swagger2Feature();
    swagger.setBasePath("/");
    swagger.setScanAllResources(false);
    swagger.setPrettyPrint(true);
    swagger.setSupportSwaggerUi(true);
    swagger.setTitle("Camel Catalog REST Api");
    swagger.setDescription("REST Api for the Camel Catalog");
    swagger.setVersion(catalog.getCatalogVersion());
    swagger.setContact("Apache Camel");
    sf.getFeatures().add(swagger);

    // to use jackson for json
    sf.setProvider(JacksonJsonProvider.class);
    sf.setAddress("http://localhost:" + port);

    // create and start the CXF server (non blocking)
    server = sf.create();
    server.start();
}
 
開發者ID:fabric8io,項目名稱:django,代碼行數:31,代碼來源:CamelCatalogSwaggerTest.java

示例13: main

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    // create dummy backend
    DummyOrderService dummy = new DummyOrderService();
    dummy.setupDummyOrders();

    // create a Camel route that routes the REST services
    OrderRoute route = new OrderRoute();
    route.setOrderService(dummy);

    // create CamelContext and add the route
    CamelContext camel = new DefaultCamelContext();
    camel.addRoutes(route);

    // create a ProducerTemplate that the CXF REST service will use to integrate with Camel
    ProducerTemplate producer = camel.createProducerTemplate();

    // create CXF REST service and inject the Camel ProducerTemplate
    // which we use to call the Camel route
    RestOrderService rest = new RestOrderService();
    rest.setProducerTemplate(producer);

    // setup Apache CXF REST server on port 9000
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(RestOrderService.class);
    sf.setResourceProvider(RestOrderService.class, new SingletonResourceProvider(rest));
    // to use jackson for json
    sf.setProvider(JacksonJsonProvider.class);
    sf.setAddress("http://localhost:9000/");

    // create the CXF server
    Server server = sf.create();

    // start Camel and CXF (non blocking)
    camel.start();
    server.start();

    // keep the JVM running
    Console console = System.console();
    System.out.println("Server started on http://localhost:9000/");
    System.out.println("");

    // If you run the main class from IDEA/Eclipse then you may not have a console, which is null)
    if (console != null) {
        System.out.println("  Press ENTER to stop server");
        console.readLine();
    } else {
        System.out.println("  Stopping after 5 minutes or press ctrl + C to stop");
        Thread.sleep(5 * 60 * 1000);
    }

    // stop Camel and CXF server
    camel.stop();
    server.stop();
    System.exit(0);
}
 
開發者ID:camelinaction,項目名稱:camelinaction2,代碼行數:56,代碼來源:RestOrderServer.java

示例14: main

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    // create dummy backend
    DummyOrderService dummy = new DummyOrderService();
    dummy.setupDummyOrders();

    // create CXF REST service and inject the dummy backend
    RestOrderService rest = new RestOrderService();
    rest.setOrderService(dummy);

    // setup Apache CXF REST server on port 9000
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(RestOrderService.class);
    sf.setResourceProvider(RestOrderService.class, new SingletonResourceProvider(rest));
    // to use jackson for json
    sf.setProvider(JacksonJsonProvider.class);
    sf.setAddress("http://localhost:9000/");

    // create and start the CXF server (non blocking)
    Server server = sf.create();
    server.start();

    // keep the JVM running
    Console console = System.console();
    System.out.println("Server started on http://localhost:9000/");
    System.out.println("");

    // If you run the main class from IDEA/Eclipse then you may not have a console, which is null)
    if (console != null) {
        System.out.println("  Press ENTER to stop server");
        console.readLine();
    } else {
        System.out.println("  Stopping after 5 minutes or press ctrl + C to stop");
        Thread.sleep(5 * 60 * 1000);
    }

    // stop CXF server
    server.stop();
    System.exit(0);
}
 
開發者ID:camelinaction,項目名稱:camelinaction2,代碼行數:40,代碼來源:RestOrderServer.java

示例15: createServerEndPoints

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; //導入方法依賴的package包/類
private void createServerEndPoints(
		final CreateEndpointRequest<?> request,
		final boolean stopAutomaticEndpointsfirst)
{
	if (stopAutomaticEndpointsfirst)
	{
		destroyServerEndPoints();
	}

	final JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();

	final JAXRSServerFactoryBean svrFactory = new JAXRSServerFactoryBean();
	// svrFactory.setBus(bus);

	final List<Class<?>> endpointClasses = ImmutableList.<Class<?>> copyOf(request.getEndpointClasses()).reverse();
	svrFactory.setResourceClasses(endpointClasses);
	// svrFactory.setBus(bus); see the commented out "spring" section below

	svrFactory.setProvider(jacksonJaxbJsonProvider);
	svrFactory.getFeatures().add(createJMSConfigFeature(
			request.getRequestQueue(),
			request.getResponseQueue()));

	if (loggingFeature != null)
	{
		svrFactory.getFeatures().add(loggingFeature);
	}
	else
	{
		logger.warn("Skip adding {} because is null", LoggingFeature.class);
	}

	svrFactory.setAddress("/");
	svrFactory.setTransportId("http://cxf.apache.org/transports/jms");

	automaticEndpointsServer = svrFactory.create();

	logger.info("Created server {} for {}", automaticEndpointsServer, request);
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:40,代碼來源:JaxRsBL.java


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