javax.ws.rs.core.Configuration.getClasses()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(129)

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

Configuration.getClasses介绍

[英]Get the immutable set of registered JAX-RS component (such as provider or Feature) classes to be instantiated, injected and utilized in the scope of the configurable instance.

For each component type, there can be only a single class-based or instance-based registration present in the configuration context at any given time.
[中]获取注册的JAX-RS组件(例如提供者或功能)类的不可变集合,这些类将在可配置实例的范围内实例化、注入和使用。
对于每种组件类型,在任何给定时间,配置上下文中只能存在一个基于类或基于实例的注册。

代码示例

代码示例来源:origin: jersey/jersey

@Override
public ResourceModel processResourceModel(final ResourceModel resourceModel, final Configuration configuration) {
  final boolean disabled = PropertiesHelper.isProperty(configuration.getProperty(ServerProperties.WADL_FEATURE_DISABLE));
  if (disabled) {
    return resourceModel;
  }
  final ResourceModel.Builder builder = ModelProcessorUtil.enhanceResourceModel(resourceModel, false, methodList, true);
  // Do not add WadlResource if already present in the classes (i.e. added during scanning).
  if (!configuration.getClasses().contains(WadlResource.class)) {
    final Resource wadlResource = Resource.builder(WadlResource.class).build();
    builder.addResource(wadlResource);
  }
  return builder.build();
}

代码示例来源:origin: jersey/jersey

@Override
public ResourceModel processResourceModel(final ResourceModel resourceModel, final Configuration configuration) {
  final boolean disabled = PropertiesHelper.isProperty(configuration.getProperty(ServerProperties.WADL_FEATURE_DISABLE));
  if (disabled) {
    return resourceModel;
  }
  final ResourceModel.Builder builder = ModelProcessorUtil.enhanceResourceModel(resourceModel, false, methodList, true);
  // Do not add WadlResource if already present in the classes (i.e. added during scanning).
  if (!configuration.getClasses().contains(WadlResource.class)) {
    final Resource wadlResource = Resource.builder(WadlResource.class).build();
    builder.addResource(wadlResource);
  }
  return builder.build();
}

代码示例来源:origin: jersey/jersey

private void copyProviders(Configuration source, Configurable<?> target) {
  final Configuration targetConfig = target.getConfiguration();
  for (Class<?> c : source.getClasses()) {
    if (!targetConfig.isRegistered(c)) {
      target.register(c, source.getContracts(c));
    }
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    if (!targetConfig.isRegistered(o)) {
      target.register(c, source.getContracts(c));
    }
  }
}

代码示例来源:origin: jersey/jersey

private void copyProviders(Configuration source, Configurable<?> target) {
  final Configuration targetConfig = target.getConfiguration();
  for (Class<?> c : source.getClasses()) {
    if (!targetConfig.isRegistered(c)) {
      target.register(c, source.getContracts(c));
    }
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    if (!targetConfig.isRegistered(o)) {
      target.register(c, source.getContracts(c));
    }
  }
}

代码示例来源:origin: jersey/jersey

resetRegistrations();
for (final Class<?> clazz : config.getClasses()) {
  if (Feature.class.isAssignableFrom(clazz) && config.isEnabled((Class<? extends Feature>) clazz)) {
    this.disableMetaProviderConfiguration = true;

代码示例来源:origin: jersey/jersey

resetRegistrations();
for (final Class<?> clazz : config.getClasses()) {
  if (Feature.class.isAssignableFrom(clazz) && config.isEnabled((Class<? extends Feature>) clazz)) {
    this.disableMetaProviderConfiguration = true;

代码示例来源:origin: resteasy/Resteasy

@Override
public Set<Class<?>> getClasses()
{
 return delegate.getClasses();
}

代码示例来源:origin: org.glassfish.jersey.core/jersey-server

@Override
public ResourceModel processResourceModel(final ResourceModel resourceModel, final Configuration configuration) {
  final boolean disabled = PropertiesHelper.isProperty(configuration.getProperty(ServerProperties.WADL_FEATURE_DISABLE));
  if (disabled) {
    return resourceModel;
  }
  final ResourceModel.Builder builder = ModelProcessorUtil.enhanceResourceModel(resourceModel, false, methodList, true);
  // Do not add WadlResource if already present in the classes (i.e. added during scanning).
  if (!configuration.getClasses().contains(WadlResource.class)) {
    final Resource wadlResource = Resource.builder(WadlResource.class).build();
    builder.addResource(wadlResource);
  }
  return builder.build();
}

代码示例来源:origin: org.glassfish.jersey.core/jersey-server

private void copyProviders(Configuration source, Configurable<?> target) {
  final Configuration targetConfig = target.getConfiguration();
  for (Class<?> c : source.getClasses()) {
    if (!targetConfig.isRegistered(c)) {
      target.register(c, source.getContracts(c));
    }
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    if (!targetConfig.isRegistered(o)) {
      target.register(c, source.getContracts(c));
    }
  }
}

代码示例来源:origin: resteasy/Resteasy

@Override
public ResteasyClientBuilderImpl withConfig(Configuration config)
{
 providerFactory = new LocalResteasyProviderFactory(new ResteasyProviderFactoryImpl());
 providerFactory.setProperties(config.getProperties());
 for (Class clazz : config.getClasses())
 {
   Map<Class<?>, Integer> contracts = config.getContracts(clazz);
   try {
    register(clazz, contracts);
   }
   catch (RuntimeException e) {
    throw new RuntimeException(Messages.MESSAGES.failedOnRegisteringClass(clazz.getName()), e);
   }
 }
 for (Object obj : config.getInstances())
 {
   Map<Class<?>, Integer> contracts = config.getContracts(obj.getClass());
   register(obj, contracts);
 }
 return this;
}

代码示例来源:origin: org.jboss.resteasy/resteasy-client-microprofile

@Override
public Set<Class<?>> getClasses()
{
 return delegate.getClasses();
}

代码示例来源:origin: io.smallrye/smallrye-rest-client

@Override
public Set<Class<?>> getClasses() {
  return delegate.getClasses();
}

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

protected boolean isGZipRegistered(Configuration configuration)
{
 //TODO replace with the line below when dropping resteasy-legacy
 //return configuration.isRegistered(GZIPEncodingInterceptor.class);
 for (Class<?> c : configuration.getClasses()) {
   if (GZIPEncodingInterceptor.class.isAssignableFrom(c)) {
    return true;
   }
 }
 return false;
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public Set<Class<?>> getClasses() {
  return get().getClasses();
}

代码示例来源:origin: com.oracle.ozark/ozark

@Override
public void configure(FeatureContext context) {
  final Configuration config = context.getConfiguration();
  if (config.isRegistered(ViewResponseFilter.class)) {
    return;     // already registered!
  }
  final boolean enableOzark = config.getClasses().stream().anyMatch(this::isController)
      || config.getInstances().stream().map(o -> o.getClass()).anyMatch(this::isController);
  if (enableOzark) {
    context.register(ViewResponseFilter.class);
    context.register(ViewableWriter.class);
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private void copyProviders(Configuration source, Configurable<?> target) {
  for (Class<?> c : source.getClasses()) {
    target.register(c, source.getContracts(c));
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    target.register(c, source.getContracts(c));
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private void copyProviders(Configuration source, Configurable<?> target) {
  for (Class<?> c : source.getClasses()) {
    target.register(c, source.getContracts(c));
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    target.register(c, source.getContracts(c));
  }
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

private void copyProviders(Configuration source, Configurable<?> target) {
  for (Class<?> c : source.getClasses()) {
    target.register(c, source.getContracts(c));
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    target.register(c, source.getContracts(c));
  }
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

@Override
public ResourceModel processResourceModel(final ResourceModel resourceModel, final Configuration configuration) {
  final boolean disabled = PropertiesHelper.isProperty(configuration.getProperty(ServerProperties.WADL_FEATURE_DISABLE));
  if (disabled) {
    return resourceModel;
  }
  final ResourceModel.Builder builder = ModelProcessorUtil.enhanceResourceModel(resourceModel, false, methodList, true);
  // Do not add WadlResource if already present in the classes (i.e. added during scanning).
  if (!configuration.getClasses().contains(WadlResource.class)) {
    final Resource wadlResource = Resource.builder(WadlResource.class).build();
    builder.addResource(wadlResource);
  }
  return builder.build();
}

代码示例来源:origin: org.glassfish.jersey.bundles/jaxrs-ri

private void copyProviders(Configuration source, Configurable<?> target) {
  final Configuration targetConfig = target.getConfiguration();
  for (Class<?> c : source.getClasses()) {
    if (!targetConfig.isRegistered(c)) {
      target.register(c, source.getContracts(c));
    }
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    if (!targetConfig.isRegistered(o)) {
      target.register(c, source.getContracts(c));
    }
  }
}

相关文章