@PostConstruct private void init() { final String paramName = (String) configuration.getProperty(SelectableEntityFilteringFeature.QUERY_PARAM_NAME); SELECTABLE_PARAM_NAME = paramName != null ? paramName : SELECTABLE_PARAM_NAME; }
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; }
@Override public Boolean get() { return PropertiesHelper.isProperty(config.getProperty(MessageProperties.JAXB_PROCESS_XML_ROOT_ELEMENT)); } });
@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); } } }
@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); } } }
/** * 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)); }
/** * 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)); } }
/** * 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)); }
@Override public Boolean get() { return PropertiesHelper.isProperty(config.getProperty(MessageProperties.XML_FORMAT_OUTPUT)); } });
private boolean isValidateOnExecutableOverrideCheckDisabled() { return PropertiesHelper.isProperty( jaxRsConfig.getProperty(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK)); } }
/** * 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))); }
/** * 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))); }
/** * 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))); }
/** * 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))); }
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); }
@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(); } }
@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(); } }
@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(); } } } }
@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(); }
@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(); }