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

x33g5p2x  于2022-01-15 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(185)

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

Application.getProperties介绍

[英]Get a map of custom application-wide properties.

The returned properties are reflected in the application Configurationpassed to the server-side features or injected into server-side JAX-RS components.

The set of returned properties may be further extended or customized at deployment time using container-specific features and deployment descriptors. For example, in a Servlet-based deployment scenario, web application's and Servlet values may be used to extend or override values of the properties programmatically returned by this method.

The default implementation returns an empty set.
[中]获取自定义应用程序范围属性的映射。
返回的属性反映在传递给服务器端特性或注入服务器端JAX-RS组件的应用程序配置中。
在部署时,可以使用特定于容器的特性和部署描述符进一步扩展或自定义返回的属性集。例如,在基于Servlet的部署场景中,web应用程序和Servlet值可用于扩展或覆盖此方法以编程方式返回的属性值。
默认实现返回一个空集。

代码示例

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

private RuntimeConfig(final Application application) {
  super();
  this.application = application;
  if (application != null) {
    registerComponentsOf(application);
    // Copy all available properties.
    addProperties(application.getProperties());
  }
  originalRegistrations = super.getRegisteredClasses();
}

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

private RuntimeConfig(final Application application) {
  super();
  this.application = application;
  if (application != null) {
    registerComponentsOf(application);
    // Copy all available properties.
    addProperties(application.getProperties());
  }
  originalRegistrations = super.getRegisteredClasses();
}

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

/**
 * Merges fields (e.g. custom binders, properties) of the given application with this application.
 * <p>
 * The merging should be done because of the possibility of reloading this {@code ResourceConfig} in a container
 * so this resource config should know about custom binders and properties of the underlying application to ensure
 * the reload process will complete successfully.
 * </p>
 *
 * @param application the application which fields should be merged with this application.
 * @see org.glassfish.jersey.server.spi.Container#reload()
 * @see org.glassfish.jersey.server.spi.Container#reload(ResourceConfig)
 */
private void mergeApplications(final Application application) {
  if (application instanceof ResourceConfig) {
    // Merge custom binders.
    final ResourceConfig rc = (ResourceConfig) application;
    // Merge resources
    super.registerResources(rc.getResources());
    // properties set on the wrapping resource config take precedence
    // (as those are retrieved from the web.xml, for example)
    rc.invalidateCache();
    rc.addProperties(super.getProperties());
    super.addProperties(rc.getProperties());
    super.setApplicationName(rc.getApplicationName());
    super.setClassLoader(rc.getClassLoader());
    rc.lock();
  } else if (application != null) {
    super.addProperties(application.getProperties());
  }
}

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

/**
 * Merges fields (e.g. custom binders, properties) of the given application with this application.
 * <p>
 * The merging should be done because of the possibility of reloading this {@code ResourceConfig} in a container
 * so this resource config should know about custom binders and properties of the underlying application to ensure
 * the reload process will complete successfully.
 * </p>
 *
 * @param application the application which fields should be merged with this application.
 * @see org.glassfish.jersey.server.spi.Container#reload()
 * @see org.glassfish.jersey.server.spi.Container#reload(ResourceConfig)
 */
private void mergeApplications(final Application application) {
  if (application instanceof ResourceConfig) {
    // Merge custom binders.
    final ResourceConfig rc = (ResourceConfig) application;
    // Merge resources
    super.registerResources(rc.getResources());
    // properties set on the wrapping resource config take precedence
    // (as those are retrieved from the web.xml, for example)
    rc.invalidateCache();
    rc.addProperties(super.getProperties());
    super.addProperties(rc.getProperties());
    super.setApplicationName(rc.getApplicationName());
    super.setClassLoader(rc.getClassLoader());
    rc.lock();
  } else if (application != null) {
    super.addProperties(application.getProperties());
  }
}

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

private RuntimeConfig(final Application application) {
  super();
  this.application = application;
  if (application != null) {
    registerComponentsOf(application);
    // Copy all available properties.
    addProperties(application.getProperties());
  }
  originalRegistrations = super.getRegisteredClasses();
}

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

final Map<String, Object> properties = config.getProperties();
if (properties != null && !properties.isEmpty())

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

injectionManager.register(new MessagingBinders.MessageBodyProviders(application.getProperties(), RuntimeType.SERVER));

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

injectionManager.register(new MessagingBinders.MessageBodyProviders(application.getProperties(), RuntimeType.SERVER));

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

@Path("/")
public class TestResource
{
  @Context
  Application application;

  @GET
  public String get() {
    String value = (String)application.getProperties().get("MyProp");
  }
}

代码示例来源:origin: org.tiogasolutions.jobs/tioga-jobs-agent

@SuppressWarnings("unchecked")
 public static <T> T get(Application app, Class<T> type) {
  return (T)app.getProperties().get(type.getName());
 }
}

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

protected boolean isAppResourceLifecycleASingleton(Application app, ServletConfig servletConfig) {
  String scope = servletConfig.getInitParameter(SERVICE_SCOPE_PARAM);
  if (scope == null) {
    scope = (String)app.getProperties().get(SERVICE_SCOPE_PARAM);
  }
  return SERVICE_SCOPE_SINGLETON.equals(scope);
}

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

public Map<String, Object> getProperties() {
  Map<String, Object> appProps = super.getProvider().getProperties();
  if (overridingProps.isEmpty()) {
    return appProps;
  }
  Map<String, Object> props = new HashMap<>(appProps);
  props.putAll(overridingProps);
  return props;
}
public void setOverridingProps(Map<String, Object> overridingProps) {

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

/**
 * Merges fields (e.g. custom binders, properties) of the given application with this application.
 * <p>
 * The merging should be done because of the possibility of reloading this {@code ResourceConfig} in a container
 * so this resource config should know about custom binders and properties of the underlying application to ensure
 * the reload process will complete successfully.
 * </p>
 *
 * @param application the application which fields should be merged with this application.
 * @see org.glassfish.jersey.server.spi.Container#reload()
 * @see org.glassfish.jersey.server.spi.Container#reload(ResourceConfig)
 */
private void mergeApplications(final Application application) {
  if (application instanceof ResourceConfig) {
    // Merge custom binders.
    final ResourceConfig rc = (ResourceConfig) application;
    // Merge resources
    super.registerResources(rc.getResources());
    // properties set on the wrapping resource config take precedence
    // (as those are retrieved from the web.xml, for example)
    rc.invalidateCache();
    rc.addProperties(super.getProperties());
    super.addProperties(rc.getProperties());
    super.setApplicationName(rc.getApplicationName());
    super.setClassLoader(rc.getClassLoader());
    rc.lock();
  } else if (application != null) {
    super.addProperties(application.getProperties());
  }
}

代码示例来源:origin: org.tiogasolutions.jobs/tioga-jobs-agent

@DELETE
 public void deleteAll(@Context Application app) {
  JobExecutionRequestStore store = (JobExecutionRequestStore)app.getProperties().get(JobExecutionRequestStore.class.getName());
  for (JobExecutionRequestEntity request : store.getAll()) {
   store.delete(request);
  }
 }
}

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

@GET
 public Response getHelixRestNamespaces() {
  @SuppressWarnings("unchecked")
  List<HelixRestNamespace> allNamespaces =
    (List<HelixRestNamespace>) _application.getProperties()
      .get(ContextPropertyKeys.ALL_NAMESPACES.name());
  List<Map<String, String>> ret = new ArrayList<>();
  for (HelixRestNamespace namespace : allNamespaces) {
   ret.add(namespace.getRestInfo());
  }
  return JSONRepresentation(ret);
 }
}

代码示例来源:origin: org.tiogasolutions.jobs/tioga-jobs-agent

@Path("/domains/{domainName}/request")
 public RequestResourceV1 getRequestResource(@Context Application app,
                       @PathParam("domainName") String domainName) {

  DomainProfileStore store = (DomainProfileStore) app.getProperties().get(DomainProfileStore.class.getName());
  DomainProfileEntity domainProfile = store.getByDomainName(domainName);

  JobsApplication.get(app, ExecutionContextManager.class).create(domainProfile);
  return new RequestResourceV1(domainProfile);
 }
}

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

private RuntimeConfig(final Application application) {
  super();
  this.application = application;
  if (application != null) {
    registerComponentsOf(application);
    // Copy all available properties.
    addProperties(application.getProperties());
  }
  originalRegistrations = super.getRegisteredClasses();
}

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

private RuntimeConfig(final Application application) {
  super();
  this.application = application;
  if (application != null) {
    registerComponentsOf(application);
    // Copy all available properties.
    addProperties(application.getProperties());
  }
  originalRegistrations = super.getRegisteredClasses();
}

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

private RuntimeConfig(final Application application) {
  super();
  this.application = application;
  if (application != null) {
    registerComponentsOf(application);
    // Copy all available properties.
    addProperties(application.getProperties());
  }
  originalRegistrations = super.getRegisteredClasses();
}

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

injectionManager.register(new MessagingBinders.MessageBodyProviders(application.getProperties(), RuntimeType.SERVER));

相关文章

微信公众号

最新文章

更多