org.glassfish.jersey.server.monitoring.ApplicationEvent.getResourceModel()方法的使用及代码示例

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

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

ApplicationEvent.getResourceModel介绍

[英]Get the resource model of the application. The method returns null for Type#INITIALIZATION_START event type as the resource model is not initialized yet. The returned resource model is the final deployed model including resources enhanced by org.glassfish.jersey.server.model.ModelProcessor.
[中]获取应用程序的资源模型。由于资源模型尚未初始化,该方法为类型#INITIALIZATION_START event Type返回null。返回的资源模型是最终部署的模型,包括组织增强的资源。玻璃鱼。运动衫服务器模型模型处理器。

代码示例

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

@Override
public void onEvent(ApplicationEvent event) {
  if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
    resources = event.getResourceModel().getResources();
    providers = event.getProviders();
    final String resourceClasses = resources.stream()
        .map(x -> x.getClass().getCanonicalName())
        .collect(Collectors.joining(", "));
    final String providerClasses = providers.stream()
        .map(Class::getCanonicalName)
        .collect(Collectors.joining(", "));
    LOGGER.debug("resources = {}", resourceClasses);
    LOGGER.debug("providers = {}", providerClasses);
    LOGGER.info(getEndpointsInfo());
  }
}

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

private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) {
  return new ApplicationEventImpl(type,
      initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(),
      initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(),
      initFinishedEvent.getResourceModel());
}

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

private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) {
  return new ApplicationEventImpl(type,
      initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(),
      initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(),
      initFinishedEvent.getResourceModel());
}

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

private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) {
  return new ApplicationEventImpl(type,
      initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(),
      initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(),
      initFinishedEvent.getResourceModel());
}

代码示例来源:origin: icode/ameba

/**
 * <p>getResourceModel.</p>
 *
 * @return a {@link org.glassfish.jersey.server.model.ResourceModel} object.
 */
public ResourceModel getResourceModel() {
  return event.getResourceModel();
}

代码示例来源:origin: io.dropwizard.metrics/metrics-jersey2

@Override
public void onEvent(ApplicationEvent event) {
  if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
    registerMetricsForModel(event.getResourceModel());
  }
}

代码示例来源:origin: mtakaki/dropwizard-circuitbreaker

@Override
public void onEvent(final ApplicationEvent event) {
  if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
    event.getResourceModel().getResources().parallelStream()
        .filter(Objects::nonNull)
        .forEach(resource -> {
          this.registerCircuitBreakerAnnotations(resource.getAllMethods());
          resource.getChildResources().parallelStream()
              .filter(Objects::nonNull)
              .forEach(childResource -> {
                this.registerCircuitBreakerAnnotations(
                    childResource.getAllMethods());
              });
        });
  }
}

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

@Provider
public class ProviderLoggingListener implements ApplicationEventListener {

  @Override
  public void onEvent(ApplicationEvent event) {
    switch (event.getType()) {
      case INITIALIZATION_FINISHED: {
        Set<Class<?>> providers = event.getProviders();
        ResourceConfig immutableConfig = event.getResourceConfig();
        ResourceModel resourcesModel = event.getResourceModel();
        break;
      }
    }
  }

  @Override
  public RequestEventListener onRequest(RequestEvent requestEvent) {
    return null;
  }
}

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

private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) {
  return new ApplicationEventImpl(type,
      initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(),
      initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(),
      initFinishedEvent.getResourceModel());
}

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

private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) {
  return new ApplicationEventImpl(type,
      initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(),
      initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(),
      initFinishedEvent.getResourceModel());
}

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

private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) {
  return new ApplicationEventImpl(type,
      initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(),
      initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(),
      initFinishedEvent.getResourceModel());
}

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

private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) {
  return new ApplicationEventImpl(type,
      initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(),
      initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(),
      initFinishedEvent.getResourceModel());
}

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

public void onEvent(ApplicationEvent event) {
  if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
    final ResourceModel resourceModel = event.getResourceModel();
    final ResourceLogDetails logDetails = new ResourceLogDetails();
    resourceModel.getResources().stream().forEach((resource) -> {

代码示例来源:origin: com.thesett.jenerator.utils/jenerator_util_dropwizard_0.9

public void onEvent(ApplicationEvent event) {
  if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
    for (Resource resource : event.getResourceModel().getResources()) {
      for (ResourceMethod method : resource.getAllMethods()) {
        registerAuditedMethodAnnotations(method);
      }
      for (Resource childResource : resource.getChildResources()) {
        for (ResourceMethod method : childResource.getAllMethods()) {
          registerAuditedMethodAnnotations(method);
        }
      }
    }
  }
}

代码示例来源:origin: com.thesett.jenerator.utils/jenerator_util_dropwizard_0.9

public void onEvent(ApplicationEvent event) {
  if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
    for (Resource resource : event.getResourceModel().getResources()) {
      for (ResourceMethod method : resource.getAllMethods()) {
        registerUnitOfWorkWithDetachAnnotations(method);
      }
      for (Resource childResource : resource.getChildResources()) {
        for (ResourceMethod method : childResource.getAllMethods()) {
          registerUnitOfWorkWithDetachAnnotations(method);
        }
      }
    }
  }
}

相关文章