org.glassfish.jersey.message.DeflateEncoder Java Examples
The following examples show how to use
org.glassfish.jersey.message.DeflateEncoder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestResourceConfig.java From frameworkAggregate with Apache License 2.0 | 5 votes |
public RestResourceConfig() { log.info("-----------------------------loading JERSEY2 restful---------------------------"); packages("com.framework.rest.service"); register(RestAuthRequestFilter.class); register(RestResponseFilter.class); register(LoggingFilter.class); register(JacksonFeature.class); register(DeflateEncoder.class); EncodingFilter.enableFor(this, GZipEncoder.class); }
Example #2
Source File: ElasticConnectionPool.java From dremio-oss with Apache License 2.0 | 4 votes |
public void connect() throws IOException { final ClientConfig configuration = new ClientConfig(); configuration.property(ClientProperties.READ_TIMEOUT, readTimeoutMillis); final AWSCredentialsProvider awsCredentialsProvider = elasticsearchAuthentication.getAwsCredentialsProvider(); if (awsCredentialsProvider != null) { configuration.property(REGION_NAME, elasticsearchAuthentication.getRegionName()); configuration.register(ElasticsearchRequestClientFilter.class); configuration.register(new InjectableAWSCredentialsProvider(awsCredentialsProvider), InjectableAWSCredentialsProvider.class); } final ClientBuilder builder = ClientBuilder.newBuilder() .withConfig(configuration); switch(sslMode) { case UNSECURE: builder.sslContext(SSLHelper.newAllTrustingSSLContext("SSL")); // fall-through case VERIFY_CA: builder.hostnameVerifier(SSLHelper.newAllValidHostnameVerifier()); // fall-through case STRICT: break; case OFF: // no TLS/SSL configuration } client = builder.build(); client.register(GZipEncoder.class); client.register(DeflateEncoder.class); client.register(EncodingFilter.class); if (REQUEST_LOGGER.isDebugEnabled()) { java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(REQUEST_LOGGER_NAME); client.register(new LoggingFeature( julLogger, Level.FINE, REQUEST_LOGGER.isTraceEnabled() ? LoggingFeature.Verbosity.PAYLOAD_TEXT : LoggingFeature.Verbosity.HEADERS_ONLY, 65536)); } final JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); provider.setMapper(ElasticMappingSet.MAPPER); // Disable other JSON providers. client.property( PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, client.getConfiguration().getRuntimeType()), JacksonJaxbJsonProvider.class.getSimpleName()); client.register(provider); HttpAuthenticationFeature httpAuthenticationFeature = elasticsearchAuthentication.getHttpAuthenticationFeature(); if (httpAuthenticationFeature != null) { client.register(httpAuthenticationFeature); } updateClients(); }
Example #3
Source File: Openscoring.java From openscoring with GNU Affero General Public License v3.0 | 4 votes |
public Openscoring(){ Config config = ConfigFactory.load(); setConfig(config); Binder configBinder = new AbstractBinder(){ @Override public void configure(){ bind(config).to(Config.class).named("openscoring"); } }; register(configBinder); ModelRegistry modelRegistry = createModelRegistry(config); setModelRegistry(modelRegistry); Binder modelRegistryBinder = new AbstractBinder(){ @Override public void configure(){ bind(modelRegistry).to(ModelRegistry.class).named("openscoring"); } }; register(modelRegistryBinder); LoadingModelEvaluatorBuilder loadingModelEvaluatorBuilder = createLoadingModelEvaluatorBuilder(config); setLoadingModelEvaluatorBuilder(loadingModelEvaluatorBuilder); Binder loadingModelEvaluatorBuilderBinder = new AbstractBinder(){ @Override public void configure(){ bind(loadingModelEvaluatorBuilder).to(LoadingModelEvaluatorBuilder.class); } }; register(loadingModelEvaluatorBuilderBinder); Config applicationConfig = config.getConfig("application"); register(ModelResource.class); // Convert path variables to ModelRef objects register(loadClass(ModelRefConverterProvider.class, applicationConfig)); // PMML support register(loadClass(ModelProvider.class, applicationConfig)); // JSON support register(JacksonJsonProvider.class); register(ObjectMapperProvider.class); // CSV support register(loadClass(TableProvider.class, applicationConfig)); // Convert exceptions to JSON objects register(WebApplicationExceptionMapper.class); // Permit the HTTP POST method to be changed to HTTP PUT or DELETE methods register(HttpMethodOverrideFilter.class); // File upload support register(MultiPartFeature.class); // Security support register(RolesAllowedDynamicFeature.class); // GZip and Deflate encoding support register(EncodingFilter.class); register(GZipEncoder.class); register(DeflateEncoder.class); // Application identification register(ApplicationHeaderFilter.class); List<String> componentClassNames = applicationConfig.getStringList("componentClasses"); for(String componentClassName : componentClassNames){ Class<?> clazz = loadClass(Object.class, componentClassName); register(clazz); } }