本文整理了Java中javax.ws.rs.core.Configuration.getProperty()
方法的一些代码示例,展示了Configuration.getProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getProperty()
方法的具体详情如下:
包路径:javax.ws.rs.core.Configuration
类名称:Configuration
方法名:getProperty
[英]Get the value for the property with a given name.
[中]获取具有给定名称的属性的值。
代码示例来源:origin: jersey/jersey
@PostConstruct
private void init() {
final String paramName = (String) configuration.getProperty(SelectableEntityFilteringFeature.QUERY_PARAM_NAME);
SELECTABLE_PARAM_NAME = paramName != null ? paramName : SELECTABLE_PARAM_NAME;
}
代码示例来源:origin: jersey/jersey
private Map<String, Object> getConfigProperties(final Configuration config, final Set<String> propertyNames) {
final Map<String, Object> properties = new HashMap<>();
for (final String propertyName : propertyNames) {
final Object property = config.getProperty(propertyName);
if (property != null) {
properties.put(propertyName, property);
}
}
return properties;
}
代码示例来源:origin: jersey/jersey
@Override
public Boolean get() {
return PropertiesHelper.isProperty(config.getProperty(MessageProperties.JAXB_PROCESS_XML_ROOT_ELEMENT));
}
});
代码示例来源:origin: jersey/jersey
@Override
public void configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
// UriConnegFilter.
final Object languageMappings = config.getProperty(ServerProperties.LANGUAGE_MAPPINGS);
final Object mediaTypesMappings = config.getProperty(ServerProperties.MEDIA_TYPE_MAPPINGS);
if (!config.isRegistered(UriConnegFilter.class)
&& (languageMappings != null || mediaTypesMappings != null)) {
context.register(UriConnegFilter.class);
}
}
}
代码示例来源:origin: jersey/jersey
@Override
public void configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
// UriConnegFilter.
final Object languageMappings = config.getProperty(ServerProperties.LANGUAGE_MAPPINGS);
final Object mediaTypesMappings = config.getProperty(ServerProperties.MEDIA_TYPE_MAPPINGS);
if (!config.isRegistered(UriConnegFilter.class)
&& (languageMappings != null || mediaTypesMappings != null)) {
context.register(UriConnegFilter.class);
}
}
}
代码示例来源:origin: jersey/jersey
/**
* Create a new message body factory.
*
* @param configuration configuration. Optional - can be null.
*/
public MessageBodyFactory(Configuration configuration) {
this.legacyProviderOrdering = configuration != null
&& PropertiesHelper.isProperty(configuration.getProperty(MessageProperties.LEGACY_WORKERS_ORDERING));
}
代码示例来源:origin: jersey/jersey
/**
* Determines whether the {@value MessageProperties#XML_SECURITY_DISABLE} property is disabled for this factory.
*
* @return {@code true} if the xml security is disabled for this factory, {@code false} otherwise.
*/
boolean isXmlSecurityDisabled() {
return PropertiesHelper.isProperty(config.getProperty(MessageProperties.XML_SECURITY_DISABLE));
}
}
代码示例来源:origin: jersey/jersey
/**
* Create a new message body factory.
*
* @param configuration configuration. Optional - can be null.
*/
public MessageBodyFactory(Configuration configuration) {
this.legacyProviderOrdering = configuration != null
&& PropertiesHelper.isProperty(configuration.getProperty(MessageProperties.LEGACY_WORKERS_ORDERING));
}
代码示例来源:origin: jersey/jersey
@Override
public Boolean get() {
return PropertiesHelper.isProperty(config.getProperty(MessageProperties.XML_FORMAT_OUTPUT));
}
});
代码示例来源:origin: jersey/jersey
private boolean isValidateOnExecutableOverrideCheckDisabled() {
return PropertiesHelper.isProperty(
jaxRsConfig.getProperty(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK));
}
}
代码示例来源:origin: jersey/jersey
/**
* Create a filter that reads the configuration ({@link ServerProperties#HTTP_METHOD_OVERRIDE})
* from the provided {@link org.glassfish.jersey.server.ResourceConfig} instance.
* <p/>
* This constructor will be called by the Jersey runtime when the filter class is returned from
* {@link javax.ws.rs.core.Application#getClasses()}. The {@link org.glassfish.jersey.server.ResourceConfig}
* instance will get auto-injected.
*
* @param rc ResourceConfig instance that holds the configuration for the filter.
*/
public HttpMethodOverrideFilter(@Context final Configuration rc) {
this(parseConfig(rc.getProperty(ServerProperties.HTTP_METHOD_OVERRIDE)));
}
代码示例来源:origin: jersey/jersey
/**
* Create a filter that reads the configuration (media type and language mappings)
* from the provided {@link ResourceConfig} instance.
* This constructor will be called by the Jersey runtime when the filter
* class is returned from {@link javax.ws.rs.core.Application#getClasses()}.
* The {@link ResourceConfig} instance will get auto-injected.
*
* @param rc ResourceConfig instance that holds the configuration for the filter.
*/
public UriConnegFilter(@Context final Configuration rc) {
this(extractMediaTypeMappings(rc.getProperty(ServerProperties.MEDIA_TYPE_MAPPINGS)),
extractLanguageMappings(rc.getProperty(ServerProperties.LANGUAGE_MAPPINGS)));
}
代码示例来源:origin: jersey/jersey
/**
* Create a filter that reads the configuration ({@link ServerProperties#HTTP_METHOD_OVERRIDE})
* from the provided {@link org.glassfish.jersey.server.ResourceConfig} instance.
* <p/>
* This constructor will be called by the Jersey runtime when the filter class is returned from
* {@link javax.ws.rs.core.Application#getClasses()}. The {@link org.glassfish.jersey.server.ResourceConfig}
* instance will get auto-injected.
*
* @param rc ResourceConfig instance that holds the configuration for the filter.
*/
public HttpMethodOverrideFilter(@Context final Configuration rc) {
this(parseConfig(rc.getProperty(ServerProperties.HTTP_METHOD_OVERRIDE)));
}
代码示例来源:origin: jersey/jersey
/**
* Create a filter that reads the configuration (media type and language mappings)
* from the provided {@link ResourceConfig} instance.
* This constructor will be called by the Jersey runtime when the filter
* class is returned from {@link javax.ws.rs.core.Application#getClasses()}.
* The {@link ResourceConfig} instance will get auto-injected.
*
* @param rc ResourceConfig instance that holds the configuration for the filter.
*/
public UriConnegFilter(@Context final Configuration rc) {
this(extractMediaTypeMappings(rc.getProperty(ServerProperties.MEDIA_TYPE_MAPPINGS)),
extractLanguageMappings(rc.getProperty(ServerProperties.LANGUAGE_MAPPINGS)));
}
代码示例来源:origin: oracle/helidon
private static <T> Optional<T> property(ClientRequestContext requestContext, Class<T> clazz, String propertyName) {
return OptionalHelper.from(Optional.empty())
.or(() -> Optional.ofNullable(requestContext.getProperty(propertyName))
.filter(clazz::isInstance))
.or(() -> Optional.ofNullable(requestContext.getConfiguration().getProperty(propertyName))
.filter(clazz::isInstance))
.asOptional()
.map(clazz::cast);
}
代码示例来源:origin: jersey/jersey
@Override
public ResourceModel processSubResource(ResourceModel resourceModel, Configuration configuration) {
final boolean disabled = PropertiesHelper.isProperty(configuration.getProperty(ServerProperties.WADL_FEATURE_DISABLE));
if (disabled) {
return resourceModel;
}
return ModelProcessorUtil.enhanceResourceModel(resourceModel, true, methodList, true).build();
}
}
代码示例来源:origin: jersey/jersey
@Override
public ResourceModel processSubResource(ResourceModel resourceModel, Configuration configuration) {
final boolean disabled = PropertiesHelper.isProperty(configuration.getProperty(ServerProperties.WADL_FEATURE_DISABLE));
if (disabled) {
return resourceModel;
}
return ModelProcessorUtil.enhanceResourceModel(resourceModel, true, methodList, true).build();
}
}
代码示例来源:origin: Netflix/eureka
@Override
public void run() {
Stopwatch start = executionTimeStats.start();
try {
HttpClientConnectionManager cm = (HttpClientConnectionManager) apacheHttpClient
.getConfiguration()
.getProperty(ApacheClientProperties.CONNECTION_MANAGER);
cm.closeIdleConnections(connectionIdleTimeout, TimeUnit.SECONDS);
} catch (Throwable e) {
s_logger.error("Cannot clean connections", e);
cleanupFailed.increment();
} finally {
if (null != start) {
start.stop();
}
}
}
}
代码示例来源: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();
}
内容来源于网络,如有侵权,请联系作者删除!