Refine search
@Override public boolean configure(final FeatureContext context) { try { final Configuration config = context.getConfiguration(); config.getProperties() , config.getRuntimeType() , InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class context.property( PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()) , JSON_FEATURE); if (!config.isRegistered(FastJsonProvider.class)) { context.register(FastJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
@Override public void configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); if (context.getConfiguration().isRegistered(SseFeature.class)) { return; } if (!PropertiesHelper.getValue( config.getProperties(), config.getRuntimeType(), SseFeature.DISABLE_SSE, Boolean.FALSE, Boolean.class, null)) { context.register(SseFeature.class); } } }
@Override public boolean configure(FeatureContext context) { final boolean disabled = PropertiesHelper.isProperty(context.getConfiguration().getProperty(ServerProperties .WADL_FEATURE_DISABLE)); if (disabled) { return false; } context.register(WadlModelProcessor.class); context.register(new AbstractBinder() { @Override protected void configure() { bind(WadlApplicationContextImpl.class).to(WadlApplicationContext.class).in(Singleton.class); } }); return true; } }
Object value = null; if (runtimeType != null) { String runtimeAwareKey = getPropertyNameForRuntime(key, runtimeType); if (key.equals(runtimeAwareKey)) { value = getLegacyFallbackValue(properties, legacyMap, key); return convertValue(value, type);
@Override public String getName() { return "HttpUrlConnection " + AccessController.doPrivileged(PropertiesHelper.getSystemProperty("java.version")); } }
private static String getSystemProperty(final String propertyName) { final Properties systemProperties = AccessController.doPrivileged(PropertiesHelper.getSystemProperties()); return systemProperties.getProperty(propertyName); }
/** * {@inheritDoc} */ @Override public boolean configure(FeatureContext context) { Configuration config = context.getConfiguration(); boolean disabled = PropertiesHelper.isProperty(config.getProperties(), PROPERTY_DISABLE); if (disabled) { return false; } if (!config.isRegistered(ObjectMapperConfigurator.class)) { context.register(new Binder()); context.register(ObjectMapperProvider.class); } return true; }
@Override public Boolean get() { return PropertiesHelper.isProperty(config.getProperty(MessageProperties.XML_FORMAT_OUTPUT)); } });
@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(); }
/** * Get output encoding from configuration. * @param configuration Configuration. * @param suffix Template processor suffix of the * to configuration property {@link org.glassfish.jersey.server.mvc.MvcFeature#ENCODING}. * * @return Encoding read from configuration properties or a default encoding if no encoding is configured. */ public static Charset getTemplateOutputEncoding(Configuration configuration, String suffix) { final String enc = PropertiesHelper.getValue(configuration.getProperties(), MvcFeature.ENCODING + suffix, String.class, null); if (enc == null) { return DEFAULT_ENCODING; } else { return Charset.forName(enc); } }
public static <T> T getValue(final Map<String, ?> properties, final String key, T defaultValue, final Class<T> type) { return PropertiesHelper.getValue(properties, key, defaultValue, type, null); }
/** * Get the value of the property with a given name converted to {@code boolean}. Returns {@code false} if the value is * not convertible. * * @param properties key-value map of properties. * @param name property name. * @return {@code boolean} property value or {@code false} if the property is not convertible. */ public static boolean isProperty(final Map<String, Object> properties, final String name) { return properties.containsKey(name) && isProperty(properties.get(name)); }
@Inject public JerseyApplication(ServiceLocator serviceLocator) { GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator); GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class); guiceBridge.bridgeGuiceInjector(AppLoader.injector); String disableMoxy = PropertiesHelper.getPropertyNameForRuntime( CommonProperties.MOXY_JSON_FEATURE_DISABLE, getConfiguration().getRuntimeType()); property(disableMoxy, true); property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); // add the default Jackson exception mappers register(JsonParseExceptionMapper.class); register(JsonMappingExceptionMapper.class); register(JacksonJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class); packages(JerseyApplication.class.getPackage().getName()); for (JerseyConfigurator configurator: AppLoader.getExtensions(JerseyConfigurator.class)) { configurator.configure(this); } }
private <T> T resolveProperty(final String name, Object defaultValue, final Class<T> type) { // Check runtime configuration first Object result = clientConfig.getProperty(name); if (result != null) { defaultValue = result; } // Check request properties next result = propertiesDelegate.getProperty(name); if (result == null) { result = defaultValue; } return (result == null) ? null : PropertiesHelper.convertValue(result, type); }
@Override public String getName() { return "HttpUrlConnection " + AccessController.doPrivileged(PropertiesHelper.getSystemProperty("java.version")); } }
private String getProperty(final String propertyName) { if (forcedPropertyMap.containsKey(propertyName)) { return forcedPropertyMap.get(propertyName); } final Properties systemProperties = AccessController.doPrivileged(PropertiesHelper.getSystemProperties()); if (systemProperties.containsKey(propertyName)) { return systemProperties.getProperty(propertyName); } if (propertyMap.containsKey(propertyName)) { return propertyMap.get(propertyName); } return null; }
private boolean isValidateOnExecutableOverrideCheckDisabled() { return PropertiesHelper.isProperty( jaxRsConfig.getProperty(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK)); } }
@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(); }
/** * Creates a new instance of processor. * @param injectionManager injection manager. * @param monitoringEventListener Monitoring event listener. */ MonitoringStatisticsProcessor( final InjectionManager injectionManager, final MonitoringEventListener monitoringEventListener) { this.monitoringEventListener = monitoringEventListener; final ResourceModel resourceModel = injectionManager.getInstance(ExtendedResourceContext.class).getResourceModel(); this.statisticsBuilder = new MonitoringStatisticsImpl.Builder(resourceModel); this.statisticsCallbackList = injectionManager.getAllInstances(MonitoringStatisticsListener.class); this.scheduler = injectionManager.getInstance(ScheduledExecutorService.class, BackgroundSchedulerLiteral.INSTANCE); this.interval = PropertiesHelper.getValue(injectionManager.getInstance(Configuration.class).getProperties(), ServerProperties.MONITORING_STATISTICS_REFRESH_INTERVAL, DEFAULT_INTERVAL, Collections.<String, String>emptyMap()); }
Object value = null; if (runtimeType != null) { String runtimeAwareKey = getPropertyNameForRuntime(key, runtimeType); if (key.equals(runtimeAwareKey)) { value = getLegacyFallbackValue(properties, legacyMap, key); return convertValue(value, type);