private int getMaximumCacheLimit(Configuration configuration) { int limit = ClientProperties.getValue(configuration.getProperties(), ClientProperties.DIGESTAUTH_URI_CACHE_SIZELIMIT, MAXIMUM_DIGEST_CACHE_SIZE); if (limit < 1) { limit = MAXIMUM_DIGEST_CACHE_SIZE; } return limit; }
private int getMaximumCacheLimit(Configuration configuration) { int limit = ClientProperties.getValue(configuration.getProperties(), ClientProperties.DIGESTAUTH_URI_CACHE_SIZELIMIT, MAXIMUM_DIGEST_CACHE_SIZE); if (limit < 1) { limit = MAXIMUM_DIGEST_CACHE_SIZE; } return limit; }
NettyConnector(Client client) { final Object threadPoolSize = client.getConfiguration().getProperties().get(ClientProperties.ASYNC_THREADPOOL_SIZE); if (threadPoolSize != null && threadPoolSize instanceof Integer && (Integer) threadPoolSize > 0) { executorService = Executors.newFixedThreadPool((Integer) threadPoolSize); } else { executorService = Executors.newCachedThreadPool(); } this.group = new NioEventLoopGroup(); this.client = client; }
private int getMaximumCacheLimit(Configuration configuration) { int limit = ClientProperties.getValue(configuration.getProperties(), ClientProperties.DIGESTAUTH_URI_CACHE_SIZELIMIT, MAXIMUM_DIGEST_CACHE_SIZE); if (limit < 1) { limit = MAXIMUM_DIGEST_CACHE_SIZE; } return limit; }
/** * Get application-wide tracing level threshold. * * @param configuration application configuration. * @return tracing level threshold. */ /*package*/ static TracingLogger.Level getTracingThreshold(Configuration configuration) { final String thresholdText = ServerProperties.getValue( configuration.getProperties(), ServerProperties.TRACING_THRESHOLD, String.class); return (thresholdText == null) ? TracingLogger.DEFAULT_LEVEL : TracingLogger.Level.valueOf(thresholdText); }
/** * Get application-wide tracing level threshold. * * @param configuration application configuration. * @return tracing level threshold. */ /*package*/ static TracingLogger.Level getTracingThreshold(Configuration configuration) { final String thresholdText = ServerProperties.getValue( configuration.getProperties(), ServerProperties.TRACING_THRESHOLD, String.class); return (thresholdText == null) ? TracingLogger.DEFAULT_LEVEL : TracingLogger.Level.valueOf(thresholdText); }
@Override public void init(InjectionManager injectionManager, BootstrapBag bootstrapBag) { Configuration configuration = bootstrapBag.getConfiguration(); List<AutoDiscoverable> autoDiscoverables = loadImplementations(configuration.getProperties()).stream() .peek(implClass -> injectionManager.register(Bindings.service(implClass).to(AutoDiscoverable.class))) .map(injectionManager::createAndInitialize) .collect(Collectors.toList()); bootstrapBag.setAutoDiscoverables(autoDiscoverables); } }
@Override public void init(InjectionManager injectionManager, BootstrapBag bootstrapBag) { Configuration configuration = bootstrapBag.getConfiguration(); List<AutoDiscoverable> autoDiscoverables = loadImplementations(configuration.getProperties()).stream() .peek(implClass -> injectionManager.register(Bindings.service(implClass).to(AutoDiscoverable.class))) .map(injectionManager::createAndInitialize) .collect(Collectors.toList()); bootstrapBag.setAutoDiscoverables(autoDiscoverables); } }
@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 void configure(final FeatureContext context) { if (!context.getConfiguration().isRegistered(MonitoringFeature.class)) { final Boolean monitoringEnabled = ServerProperties.getValue(context.getConfiguration().getProperties(), ServerProperties.MONITORING_ENABLED, Boolean.FALSE); final Boolean statisticsEnabled = ServerProperties.getValue(context.getConfiguration().getProperties(), ServerProperties.MONITORING_STATISTICS_ENABLED, Boolean.FALSE); final Boolean mbeansEnabled = ServerProperties.getValue(context.getConfiguration().getProperties(), ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, Boolean.FALSE); if (monitoringEnabled || statisticsEnabled || mbeansEnabled) { context.register(MonitoringFeature.class); } } } }
@Override public void configure(final FeatureContext context) { if (!context.getConfiguration().isRegistered(MonitoringFeature.class)) { final Boolean monitoringEnabled = ServerProperties.getValue(context.getConfiguration().getProperties(), ServerProperties.MONITORING_ENABLED, Boolean.FALSE); final Boolean statisticsEnabled = ServerProperties.getValue(context.getConfiguration().getProperties(), ServerProperties.MONITORING_STATISTICS_ENABLED, Boolean.FALSE); final Boolean mbeansEnabled = ServerProperties.getValue(context.getConfiguration().getProperties(), ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, Boolean.FALSE); if (monitoringEnabled || statisticsEnabled || mbeansEnabled) { context.register(MonitoringFeature.class); } } } }
@Override public void init(InjectionManager injectionManager, BootstrapBag bootstrapBag) { Configuration configuration = bootstrapBag.getConfiguration(); loadImplementations(configuration.getProperties()) .forEach(implClass -> injectionManager.register(Bindings.service(implClass).to(AutoDiscoverable.class))); } }
@Override public void init(InjectionManager injectionManager, BootstrapBag bootstrapBag) { Configuration configuration = bootstrapBag.getConfiguration(); loadImplementations(configuration.getProperties()) .forEach(implClass -> injectionManager.register(Bindings.service(implClass).to(AutoDiscoverable.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); } } }
config.getProperties() , config.getRuntimeType() , InternalProperties.JSON_FEATURE, JSON_FEATURE,
@Override public Connector getConnector(final Client client, final Configuration config) { final Map<String, Object> properties = config.getProperties(); int computedChunkSize = ClientProperties.getValue(properties, ClientProperties.CHUNKED_ENCODING_SIZE, chunkSize, Integer.class); if (computedChunkSize < 0) { LOGGER.warning(LocalizationMessages.NEGATIVE_CHUNK_SIZE(computedChunkSize, chunkSize)); computedChunkSize = chunkSize; } final boolean computedUseFixedLengthStreaming = ClientProperties.getValue(properties, USE_FIXED_LENGTH_STREAMING, useFixedLengthStreaming, Boolean.class); final boolean computedUseSetMethodWorkaround = ClientProperties.getValue(properties, SET_METHOD_WORKAROUND, useSetMethodWorkaround, Boolean.class); return createHttpUrlConnector(client, connectionFactory, computedChunkSize, computedUseFixedLengthStreaming, computedUseSetMethodWorkaround); }
@Override public Connector getConnector(final Client client, final Configuration config) { final Map<String, Object> properties = config.getProperties(); int computedChunkSize = ClientProperties.getValue(properties, ClientProperties.CHUNKED_ENCODING_SIZE, chunkSize, Integer.class); if (computedChunkSize < 0) { LOGGER.warning(LocalizationMessages.NEGATIVE_CHUNK_SIZE(computedChunkSize, chunkSize)); computedChunkSize = chunkSize; } final boolean computedUseFixedLengthStreaming = ClientProperties.getValue(properties, USE_FIXED_LENGTH_STREAMING, useFixedLengthStreaming, Boolean.class); final boolean computedUseSetMethodWorkaround = ClientProperties.getValue(properties, SET_METHOD_WORKAROUND, useSetMethodWorkaround, Boolean.class); return createHttpUrlConnector(client, connectionFactory, computedChunkSize, computedUseFixedLengthStreaming, computedUseSetMethodWorkaround); }
private Request translateRequest(final ClientRequest clientRequest) { final URI uri = clientRequest.getUri(); final Request request = client.newRequest(uri); request.method(clientRequest.getMethod()); request.followRedirects(clientRequest.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, true)); final Object readTimeout = clientRequest.getConfiguration().getProperties().get(ClientProperties.READ_TIMEOUT); if (readTimeout != null && readTimeout instanceof Integer && (Integer) readTimeout > 0) { request.timeout((Integer) readTimeout, TimeUnit.MILLISECONDS); } return request; }
@Override public void configure(FeatureContext context) { if (!context.getConfiguration().isRegistered(LoggingFeature.class)) { Map properties = context.getConfiguration().getProperties(); if (commonPropertyConfigured(properties) || (context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT && clientConfigured(properties)) || (context.getConfiguration().getRuntimeType() == RuntimeType.SERVER && serverConfigured(properties))) { context.register(LoggingFeature.class); } } }
@Override public void configure(FeatureContext context) { if (!context.getConfiguration().isRegistered(LoggingFeature.class)) { Map properties = context.getConfiguration().getProperties(); if (commonPropertyConfigured(properties) || (context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT && clientConfigured(properties)) || (context.getConfiguration().getRuntimeType() == RuntimeType.SERVER && serverConfigured(properties))) { context.register(LoggingFeature.class); } } }