/** * Load all particular implementations of the type {@code T} using {@link ServiceFinder}. * * @param applicationProperties map containing application properties. May be {@code null} * @return all registered classes of the type {@code T}. */ protected List<Class<T>> loadImplementations(Map<String, Object> applicationProperties) { boolean METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT = false; boolean disableMetaInfServicesLookup = METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT; if (applicationProperties != null) { disableMetaInfServicesLookup = CommonProperties.getValue(applicationProperties, runtimeType, CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT, Boolean.class); } if (!disableMetaInfServicesLookup) { return Stream.of(ServiceFinder.find(contract, true).toClassArray()) .collect(Collectors.toList()); } return Collections.emptyList(); } }
/** * Load all particular implementations of the type {@code T} using {@link ServiceFinder}. * * @param applicationProperties map containing application properties. May be {@code null} * @return all registered classes of the type {@code T}. */ protected List<Class<T>> loadImplementations(Map<String, Object> applicationProperties) { boolean METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT = false; boolean disableMetaInfServicesLookup = METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT; if (applicationProperties != null) { disableMetaInfServicesLookup = CommonProperties.getValue(applicationProperties, runtimeType, CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT, Boolean.class); } if (!disableMetaInfServicesLookup) { return Stream.of(ServiceFinder.find(contract, true).toClassArray()) .collect(Collectors.toList()); } return Collections.emptyList(); } }
private LoggingInterceptor createLoggingFilter(FeatureContext context, RuntimeType runtimeType) { Map properties = context.getConfiguration().getProperties(); String filterLoggerName = CommonProperties.getValue( properties, runtimeType == RuntimeType.SERVER ? LOGGING_FEATURE_LOGGER_NAME_SERVER : LOGGING_FEATURE_LOGGER_NAME_CLIENT, CommonProperties.getValue( properties, LOGGING_FEATURE_LOGGER_NAME, DEFAULT_LOGGER_NAME )); String filterLevel = CommonProperties.getValue( properties, runtimeType == RuntimeType.SERVER ? LOGGING_FEATURE_LOGGER_LEVEL_SERVER : LOGGING_FEATURE_LOGGER_LEVEL_CLIENT, CommonProperties.getValue( context.getConfiguration().getProperties(), LOGGING_FEATURE_LOGGER_LEVEL, DEFAULT_LOGGER_LEVEL)); Verbosity filterVerbosity = CommonProperties.getValue( properties, runtimeType == RuntimeType.SERVER ? LOGGING_FEATURE_VERBOSITY_SERVER : LOGGING_FEATURE_VERBOSITY_CLIENT, CommonProperties.getValue( properties, LOGGING_FEATURE_VERBOSITY, DEFAULT_VERBOSITY )); int filterMaxEntitySize = CommonProperties.getValue( properties, runtimeType == RuntimeType.SERVER ? LOGGING_FEATURE_MAX_ENTITY_SIZE_SERVER : LOGGING_FEATURE_MAX_ENTITY_SIZE_CLIENT, CommonProperties.getValue(
private LoggingInterceptor createLoggingFilter(FeatureContext context, RuntimeType runtimeType) { Map properties = context.getConfiguration().getProperties(); String filterLoggerName = CommonProperties.getValue( properties, runtimeType == RuntimeType.SERVER ? LOGGING_FEATURE_LOGGER_NAME_SERVER : LOGGING_FEATURE_LOGGER_NAME_CLIENT, CommonProperties.getValue( properties, LOGGING_FEATURE_LOGGER_NAME, DEFAULT_LOGGER_NAME )); String filterLevel = CommonProperties.getValue( properties, runtimeType == RuntimeType.SERVER ? LOGGING_FEATURE_LOGGER_LEVEL_SERVER : LOGGING_FEATURE_LOGGER_LEVEL_CLIENT, CommonProperties.getValue( context.getConfiguration().getProperties(), LOGGING_FEATURE_LOGGER_LEVEL, DEFAULT_LOGGER_LEVEL)); Verbosity filterVerbosity = CommonProperties.getValue( properties, runtimeType == RuntimeType.SERVER ? LOGGING_FEATURE_VERBOSITY_SERVER : LOGGING_FEATURE_VERBOSITY_CLIENT, CommonProperties.getValue( properties, LOGGING_FEATURE_VERBOSITY, DEFAULT_VERBOSITY )); int filterMaxEntitySize = CommonProperties.getValue( properties, runtimeType == RuntimeType.SERVER ? LOGGING_FEATURE_MAX_ENTITY_SIZE_SERVER : LOGGING_FEATURE_MAX_ENTITY_SIZE_CLIENT, CommonProperties.getValue(
@Override public boolean configure(final FeatureContext context) { if (CommonProperties.getValue(context.getConfiguration().getProperties(), context.getConfiguration().getRuntimeType(), CommonProperties.JSON_PROCESSING_FEATURE_DISABLE, Boolean.FALSE, Boolean.class)) { return false; } // Make sure JSON-P workers have higher priority than other Json providers (in case there is a need to use JSON-P and some // other provider in an application). context.register(JsonValueBodyReader.class, Priorities.USER + 1000); context.register(JsonValueBodyWriter.class, Priorities.USER + 1000); return true; } }
@Override public boolean configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class); // Other JSON providers registered. if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) { return false; } // Disable other JSON providers. context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE); // add the default Jackson exception mappers context.register(JsonParseExceptionMapper.class); context.register(JsonMappingExceptionMapper.class); context.register(JacksonJaxbJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class); return true; } }
final Configuration config = context.getConfiguration(); final String jsonFeature = CommonProperties.getValue( config.getProperties() , config.getRuntimeType()
final Configuration config = context.getConfiguration(); final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class);
@Override public boolean configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class); // Other JSON providers registered. if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) { return false; } // Disable other JSON providers. context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE); for (final Class<?> provider : PROVIDERS) { context.register(provider, MessageBodyReader.class, MessageBodyWriter.class); } return true; } }
@Override public boolean configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); final String jsonFeature = CommonProperties.getValue( config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class); // Other JSON providers registered. if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) { return false; } // Disable other JSON providers. context.property(PropertiesHelper.getPropertyNameForRuntime( InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE); context.register(JsonBindingProvider.class); return true; } }
final Configuration config = context.getConfiguration(); if (CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), CommonProperties.MOXY_JSON_FEATURE_DISABLE, Boolean.FALSE, Boolean.class)) { return false; final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class);
@Override protected void configure() { final boolean METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT = false; boolean disableMetainfServicesLookup = METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT; if (applicationProperties != null) { disableMetainfServicesLookup = CommonProperties.getValue(applicationProperties, runtimeType, CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT, Boolean.class); } if (!disableMetainfServicesLookup) { for (Class<T> t : ServiceFinder.find(contract, true).toClassArray()) { bind(t).to(contract); } } } }
@Override protected void configure() { final boolean METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT = false; boolean disableMetainfServicesLookup = METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT; if (applicationProperties != null) { disableMetainfServicesLookup = CommonProperties.getValue(applicationProperties, runtimeType, CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, METAINF_SERVICES_LOOKUP_DISABLE_DEFAULT, Boolean.class); } if (!disableMetainfServicesLookup) { for (Class<T> t : ServiceFinder.find(contract, true).toClassArray()) { bind(t).to(contract); } } } }
/** * Enable a buffering of serialized entity. The buffering will be configured from configuration. The property * determining the size of the buffer is {@link CommonProperties#OUTBOUND_CONTENT_LENGTH_BUFFER}. * </p> * The buffering functionality is by default disabled and could be enabled by calling this method. In this case * this method must be called before first bytes are written to the {@link #getEntityStream() entity stream}. * * @param configuration runtime configuration. */ public void enableBuffering(Configuration configuration) { final Integer bufferSize = CommonProperties.getValue(configuration.getProperties(), configuration.getRuntimeType(), CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, Integer.class); if (bufferSize != null) { committingOutputStream.enableBuffering(bufferSize); } else { committingOutputStream.enableBuffering(); } }
/** * Enable a buffering of serialized entity. The buffering will be configured from configuration. The property * determining the size of the buffer is {@link CommonProperties#OUTBOUND_CONTENT_LENGTH_BUFFER}. * </p> * The buffering functionality is by default disabled and could be enabled by calling this method. In this case * this method must be called before first bytes are written to the {@link #getEntityStream() entity stream}. * * @param configuration runtime configuration. */ public void enableBuffering(Configuration configuration) { final Integer bufferSize = CommonProperties.getValue(configuration.getProperties(), configuration.getRuntimeType(), CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, Integer.class); if (bufferSize != null) { committingOutputStream.enableBuffering(bufferSize); } else { committingOutputStream.enableBuffering(); } }
final Configuration config = context.getConfiguration(); final String jsonFeature = CommonProperties.getValue( config.getProperties() , config.getRuntimeType()
if (!CommonProperties.getValue(runtimeCfgState.getProperties(), RuntimeType.CLIENT, CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, Boolean.FALSE, Boolean.class)) { runtimeCfgState.configureAutoDiscoverableProviders(injectionManager, bootstrapBag.getAutoDiscoverables());
if (!CommonProperties.getValue(runtimeCfgState.getProperties(), RuntimeType.CLIENT, CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, Boolean.FALSE, Boolean.class)) { runtimeCfgState.configureAutoDiscoverableProviders(injectionManager, bootstrapBag.getAutoDiscoverables());
if (!CommonProperties.getValue(runtimeCfgState.getProperties(), RuntimeType.CLIENT, CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, Boolean.FALSE, Boolean.class)) { runtimeCfgState.configureAutoDiscoverableProviders(injectionManager, bootstrapBag.getAutoDiscoverables());
if (!CommonProperties.getValue(runtimeConfig.getProperties(), RuntimeType.SERVER, CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, Boolean.FALSE, Boolean.class)) { runtimeConfig.configureAutoDiscoverableProviders(injectionManager, bootstrapBag.getAutoDiscoverables());