org.apache.cxf.Bus.setProperty()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中org.apache.cxf.Bus.setProperty()方法的一些代码示例,展示了Bus.setProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bus.setProperty()方法的具体详情如下:
包路径:org.apache.cxf.Bus
类名称:Bus
方法名:setProperty

Bus.setProperty介绍

暂无

代码示例

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

@Override
public void initialize(Bus bus) {
  if (contraints == null) {
    return;
  }
  initializeProvider(bus, bus);
  CertConstraints c = CertConstraintsJaxBUtils.createCertConstraints(contraints);
  bus.setProperty(CertConstraints.class.getName(), c);
}

代码示例来源:origin: apache/cxf

public WadlGenerator(Bus bus) {
  this.bus = bus;
  this.bus.setProperty("wadl.service.description.available", "true");
}

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-service-description

public WadlGenerator(Bus bus) {
  this.bus = bus;
  this.bus.setProperty("wadl.service.description.available", "true");
}

代码示例来源:origin: stackoverflow.com

Bus bus = BusFactory.getDefaultBus();
bus.setProperty(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);

代码示例来源:origin: apache/cxf

@SuppressWarnings("unchecked")
private Map<Class<?>, Map<Class<?>, ThreadLocalProxy<?>>> getConstructorProxyMap(boolean create) {
  Object property = bus.getProperty(CONSTRUCTOR_PROXY_MAP);
  if (property == null) {
    Map<Class<?>, Map<Class<?>, ThreadLocalProxy<?>>> map
      = new ConcurrentHashMap<>(2);
    bus.setProperty(CONSTRUCTOR_PROXY_MAP, map);
    property = map;
  }
  return (Map<Class<?>, Map<Class<?>, ThreadLocalProxy<?>>>)property;
}

代码示例来源:origin: apache/cxf

@SuppressWarnings("unchecked")
private <T> Map<Class<?>, Map<T, ThreadLocalProxy<?>>> getProxyMap(String prop, boolean create) {
  Object property = null;
  synchronized (bus) {
    property = bus.getProperty(prop);
    if (property == null && create) {
      Map<Class<?>, Map<T, ThreadLocalProxy<?>>> map
        = new ConcurrentHashMap<>(2);
      bus.setProperty(prop, map);
      property = map;
    }
  }
  return (Map<Class<?>, Map<T, ThreadLocalProxy<?>>>)property;
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

@SuppressWarnings("unchecked")
private <T> Map<Class<?>, Map<T, ThreadLocalProxy<?>>> getProxyMap(Class<T> keyCls, String prop) {
  Object property = null;
  synchronized (bus) {
    property = bus.getProperty(prop);
    if (property == null) {
      Map<Class<?>, Map<T, ThreadLocalProxy<?>>> map
        = Collections.synchronizedMap(new WeakHashMap<Class<?>, Map<T, ThreadLocalProxy<?>>>(2));
      bus.setProperty(prop, map);
      property = map;
    }
  }
  return (Map<Class<?>, Map<T, ThreadLocalProxy<?>>>)property;
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

@Override
public void initialize(Bus bus) {
  if (contraints == null) {
    return;
  }
  initializeProvider(bus, bus);
  CertConstraints c = CertConstraintsJaxBUtils.createCertConstraints(contraints);
  bus.setProperty(CertConstraints.class.getName(), c);
}

代码示例来源:origin: apache/cxf

@Override
public void initialize(Bus bus) {
  if (contraints == null) {
    return;
  }
  initializeProvider(bus, bus);
  CertConstraints c = CertConstraintsJaxBUtils.createCertConstraints(contraints);
  bus.setProperty(CertConstraints.class.getName(), c);
}

代码示例来源:origin: apache/cxf

@Override
public void busCreated(Bus bus) {
  Object providers = bus.getProperty(BUS_PROVIDERS);
  
  final List<?> sseProviders = 
    Arrays.asList(
      new SseContextProvider(), 
      new SseEventSinkContextProvider()
    );
  
  if (providers instanceof List) {
    final List<?> existing = new ArrayList<>((List<?>)providers);
    existing.addAll(CastUtils.cast(sseProviders));
    bus.setProperty(BUS_PROVIDERS, existing);
  } else {
    bus.setProperty(BUS_PROVIDERS, sseProviders);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

private void setBusProviders() {
  List<Object> extensions = new LinkedList<Object>(); 
  final String alreadySetProp = "bus.providers.set" + this.hashCode();
  if (bus.getProperty(alreadySetProp) == null) {
    addBusExtension(extensions,
            MessageBodyReader.class,
            MessageBodyWriter.class,
            ExceptionMapper.class);
    if (!extensions.isEmpty()) {
      setProviders(extensions.toArray());
      bus.setProperty(alreadySetProp, "");
    }
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-sse

@Override
public void busCreated(Bus bus) {
  Object providers = bus.getProperty(BUS_PROVIDERS);
  
  final List<?> sseProviders = 
    Arrays.asList(
      new SseContextProvider(), 
      new SseEventSinkContextProvider()
    );
  
  if (providers instanceof List) {
    final List<?> existing = new ArrayList<>((List<?>)providers);
    existing.addAll(CastUtils.cast(sseProviders));
    bus.setProperty(BUS_PROVIDERS, existing);
  } else {
    bus.setProperty(BUS_PROVIDERS, sseProviders);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-management-web

@SuppressWarnings("unchecked")
protected void initBusProperty() {
  if (endpointAddresses != null && serverAddress != null && getBus() != null) {
    Bus bus = getBus();
    synchronized (bus) {
      Map<String, String> addresses = 
        (Map<String, String>)bus.getProperty("org.apache.cxf.extensions.logging.atom.pull");
      if (addresses == null) {
        addresses = new HashMap<String, String>();
      }
      for (String address : endpointAddresses) {
        addresses.put(address, serverAddress + "/logs");
      }
      bus.setProperty("org.apache.cxf.extensions.logging.atom.pull", addresses);
    }
  }
}

代码示例来源:origin: apache/cxf

/**
 * Checks if a given endpoint has been marked as private.
 * If yes then its address will be added to a bus list property
 * Note that client factories might also check the endpoint, ex,
 * if the endpoint if private then it is likely no service contract
 * will be available if requested from the remote address hence it has to
 * be availbale locally or generated from the local source
 * @param ep endpoint
 */
@SuppressWarnings("unchecked")
protected boolean checkPrivateEndpoint(Endpoint ep) {
  if (PropertyUtils.isTrue(ep.get(PRIVATE_ENDPOINT))) {
    List<String> addresses =
      (List<String>)getBus().getProperty(PRIVATE_ENDPOINTS);
    if (addresses == null) {
      addresses = new LinkedList<>();
    }
    addresses.add(getAddress());
    bus.setProperty(PRIVATE_ENDPOINTS, addresses);
    return true;
  }
  return false;
}
/**

代码示例来源:origin: apache/cxf

@Override
public void initialize(Server server, Bus bus) {
  if (!activateOnlyIfJaxrsSupported || SWAGGER_JAXRS_AVAILABLE) {
    calculateDefaultResourcePackage(server);
    calculateDefaultBasePath(server);
    addSwaggerResource(server, bus);
    initializeProvider(server.getEndpoint(), bus);
    bus.setProperty("swagger.service.description.available", "true");
  }
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

protected ProviderFactory setupFactory(Endpoint ep) { 
  ProviderFactory factory = ProviderFactory.createInstance(getBus()); 
  if (entityProviders != null) {
    factory.setUserProviders(entityProviders); 
  }
  setDataBindingProvider(factory, ep.getService());
  
  factory.setBus(getBus());
  factory.initProviders(serviceFactory.getRealClassResourceInfo());
  if (schemaLocations != null) {
    factory.setSchemaLocations(schemaLocations);
  }
  
  setBeanInfo(factory);
  
  ep.put(ProviderFactory.class.getName(), factory);
  getBus().setProperty(ProviderFactory.class.getName(), factory);
  return factory;
}

代码示例来源:origin: apache/cxf

protected void run() {
  Bus bus = BusFactory.getDefaultBus();
  // Make sure default JSONProvider is not loaded
  bus.setProperty("skip.default.json.provider.registration", true);
  server = createFactoryBean(bus, false, "/rx2").create();
  server = createFactoryBean(bus, true, "/rx22").create();
}

代码示例来源:origin: apache/cxf

@BeforeClass
public static void startServers() throws Exception {
  AbstractResourceInfo.clearAllMaps();
  assertTrue("server did not launch correctly",
        launchServer(BookServerResourceJacksonSpringProviders.class, true));
  createStaticBus();
  BusFactory.getDefaultBus().setProperty("skip.default.json.provider.registration", true);
}
@AfterClass

代码示例来源:origin: apache/cxf

protected void run() {
  Bus bus = BusFactory.getDefaultBus();
  // Make sure default JSONProvider is not loaded
  bus.setProperty("skip.default.json.provider.registration", true);
  JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
  sf.setInvoker(new ReactiveIOInvoker());
  sf.setProvider(new JacksonJsonProvider());
  sf.getOutInterceptors().add(new LoggingOutInterceptor());
  sf.setResourceClasses(RxJava2ObservableService.class);
  sf.setResourceProvider(RxJava2ObservableService.class,
              new SingletonResourceProvider(new RxJava2ObservableService(), true));
  sf.setAddress("http://localhost:" + PORT + "/");
  server = sf.create();
}

代码示例来源:origin: apache/cxf

protected void run() {
  Bus bus = BusFactory.getDefaultBus();
  // Make sure default JSONProvider is not loaded
  bus.setProperty("skip.default.json.provider.registration", true);
  JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
  sf.setProvider(new JacksonJsonProvider());
  new ObservableCustomizer().customize(sf);
  sf.getOutInterceptors().add(new LoggingOutInterceptor());
  sf.setResourceClasses(RxJavaObservableService.class);
  sf.setResourceProvider(RxJavaObservableService.class,
              new SingletonResourceProvider(new RxJavaObservableService(), true));
  sf.setAddress("http://localhost:" + PORT + "/");
  server = sf.create();
}

相关文章