当前位置: 首页>>代码示例>>Java>>正文


Java GZipEncoder类代码示例

本文整理汇总了Java中org.glassfish.jersey.message.GZipEncoder的典型用法代码示例。如果您正苦于以下问题:Java GZipEncoder类的具体用法?Java GZipEncoder怎么用?Java GZipEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GZipEncoder类属于org.glassfish.jersey.message包,在下文中一共展示了GZipEncoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createConfig

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
protected ClientConfig createConfig(Set<Feature> features) {
    ClientConfig config = new ClientConfig();
    config.property(ClientProperties.FOLLOW_REDIRECTS, followRedirects);
    config.property(ClientProperties.READ_TIMEOUT, readTimeoutMs);
    config.property(ClientProperties.CONNECT_TIMEOUT, connectTimeoutMs);
    config.property(ClientProperties.ASYNC_THREADPOOL_SIZE, asyncThreadPoolSize);

    features.forEach(f -> config.register(f));

    if (compression) {
        config.register(new EncodingFeature(GZipEncoder.class));
    }

    configRequestLogging(config);

    return config;
}
 
开发者ID:bootique,项目名称:bootique-jersey-client,代码行数:18,代码来源:HttpClientFactoryFactory.java

示例2: createJerseyTest

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
private JerseyTest createJerseyTest(Boolean binaryCompressionOnly) {
	return new JerseyTest() {
		@Override
		protected Application configure() {
			ResourceConfig config = new ResourceConfig();
			config.register(TestResource.class);
			config.register(EncodingFilter.class);
			config.register(GZipEncoder.class);
			config.register(GatewayBinaryResponseFilter.class);
			if (binaryCompressionOnly != null) {
				config.property(GatewayBinaryResponseFilter.BINARY_COMPRESSION_ONLY_PROPERTY,
						binaryCompressionOnly);
			}
			return config;
		}
	};
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:18,代码来源:GatewayBinaryResponseFilterIntTest.java

示例3: Main

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
private Main() {
    packages("us.askplatyp.kb.lucene.http");

    register(JacksonFeature.class);
    register(EntityFilteringFeature.class);
    register(new AbstractBinder() {
        @Override
        protected void configure() {
            bindFactory(WikidataLuceneIndexFactory.class).to(LuceneIndex.class);
        }
    });
    register(CORSFilter.class);
    register(ApiListingResource.class);
    register(SwaggerSerializers.class);
    EncodingFilter.enableFor(this, GZipEncoder.class);
    EncodingFilter.enableFor(this, DeflateEncoder.class);

    configureSwagger();
}
 
开发者ID:askplatypus,项目名称:platypus-kb-lucene,代码行数:20,代码来源:Main.java

示例4: configureCompression

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
private void configureCompression(ClientBuilder clientBuilder) {
  if (jerseyClientConfig.httpCompression != null) {
    switch (jerseyClientConfig.httpCompression) {
      case SNAPPY:
        clientBuilder.register(SnappyEncoder.class);
        break;
      case GZIP:
        clientBuilder.register(GZipEncoder.class);
        break;
      case NONE:
      default:
        break;
    }
    clientBuilder.register(EncodingFilter.class);
  }
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:17,代码来源:HttpClientCommon.java

示例5: RackApiApplicationConfig

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
/**
 * コンストラクタです。
 */
public RackApiApplicationConfig() {

    packages(RackApiScanPackage.class.getPackage().getName());
    packages(ConnectorScanPackage.class.getPackage().getName());
    packages(SpringLifecycleListener.class.getPackage().getName());
    property(ServerProperties.JSON_PROCESSING_FEATURE_DISABLE, true);
    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
    register(ValidationConfigurationContextResolver.class);
    register(JacksonFeature.class);
    register(LoggingFilter.class);
    register(LocaleContextFilter.class);
    register(EncodingFilter.class);
    register(GZipEncoder.class);
    registerClasses(JerseyConfigs.getExcpetionMappers());
}
 
开发者ID:ctc-g,项目名称:rack-java,代码行数:19,代码来源:RackApiApplicationConfig.java

示例6: create_gzip_compressed_request_and_response

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
@Test
public void create_gzip_compressed_request_and_response() throws Exception {
    final Response response = RestTest.target(getPort(), "whois/test/person?password=test")
            .property(ClientProperties.USE_ENCODING, "gzip")
            .register(EncodingFilter.class)
            .register(GZipEncoder.class)
            .request()
            .post(Entity.entity(map(PAULETH_PALTHEN), new Variant(MediaType.APPLICATION_XML_TYPE, (String) null, "gzip")), Response.class);

    assertThat(response.getHeaderString("Content-Type"), is(MediaType.APPLICATION_XML));
    assertThat(response.getHeaderString("Content-Encoding"), is("gzip"));

    final WhoisResources whoisResources = response.readEntity(WhoisResources.class);
    assertThat(whoisResources.getErrorMessages(), is(empty()));
    final WhoisObject object = whoisResources.getWhoisObjects().get(0);
    assertThat(object.getAttributes(), hasItem(new Attribute("person", "Pauleth Palthen")));
}
 
开发者ID:RIPE-NCC,项目名称:whois,代码行数:18,代码来源:WhoisRestServiceTestIntegration.java

示例7: RestResourceConfig

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
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);
}
 
开发者ID:handexing,项目名称:frameworkAggregate,代码行数:11,代码来源:RestResourceConfig.java

示例8: configureClient

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
@Override
protected void configureClient(ClientConfig config) {
  config.register(SampleObjectMapperProvider.class);
  config.register(JacksonFeature.class);
  config.register(GZipEncoder.class);
  config.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_CLIENT, "INFO");
  config.property(
      LoggingFeature.LOGGING_FEATURE_VERBOSITY_CLIENT,
      LoggingFeature.Verbosity.HEADERS_ONLY
  );
}
 
开发者ID:durimkryeziu,项目名称:jersey-2.x-webapp-for-servlet-container,代码行数:12,代码来源:BookResourceIntegrationTest.java

示例9: JerseyConfig

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
public JerseyConfig() {
      log.info("Registering classes");
      register(AppConfiguration.class);
      packages("com.pokebattler.fight.data");
      packages("com.pokebattler.fight.resources");
      register(ProtobufJsonProvider.class);
      register(ProtobufBinaryProvider.class);
      // need to be in order
      register(ETagResponseFilter.class);
      register(CORSResponseFilter.class);
      register(CacheControlResponseFilter.class);

      register(EntityFilteringFeature.class);
EncodingFilter.enableFor(this, GZipEncoder.class);
  }
 
开发者ID:celandro,项目名称:pokebattler-fight,代码行数:16,代码来源:JerseyConfig.java

示例10: JerseyClient

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
/**
 * Used for injecting a test client
 * in unit tests
 *
 * @param authenticationType The type of authentication to use in the request
 * @param client A specific client object to use for the request
 */
protected JerseyClient(final ClientFactory.AuthenticationType authenticationType, final Client client) {
    this.client = client
            .register(GZipEncoder.class)
            .register(EncodingFilter.class)
            .register(createMoxyJsonResolver());

    switch(authenticationType) {
        case PREEMPTIVE_BASIC:
            client.register(HttpAuthenticationFeature.basicBuilder().build());
            break;

        case NON_PREEMPTIVE_BASIC:
            client.register(HttpAuthenticationFeature.basicBuilder().nonPreemptive().build());
            break;

        case DIGEST:
            client.register(HttpAuthenticationFeature.digest());
            break;

        case NON_PREEMPTIVE_BASIC_DIGEST:
            client.register(HttpAuthenticationFeature.universalBuilder().build());

        case NONE:
        default:
    }
}
 
开发者ID:BCDH,项目名称:TEI-Completer,代码行数:34,代码来源:JerseyClient.java

示例11: configure

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
@Override
protected Application configure() {
    return new ResourceConfig(MockServer.class)
            .register(RolesAllowedDynamicFeature.class)
            .register(new MockSecurityFilter(), Priorities.AUTHENTICATION)
            .register(JerseyClient.createMoxyJsonResolver())
            .register(GZipEncoder.class)
            .register(EncodingFilter.class);
}
 
开发者ID:BCDH,项目名称:TEI-Authorizer,代码行数:10,代码来源:JerseyClientTest.java

示例12: createAndStartHandler

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
private GatewayRequestObjectHandlerImpl createAndStartHandler(ResourceConfig config, TestService testService) {
	config.register(GatewayFeature.class);
	Binder binder = new InstanceBinder.Builder().addInstance(testService, TestService.class).build();
	config.register(binder);
	config.register(TestResource.class);
	config.register(EncodingFilter.class);
	config.register(GZipEncoder.class);
	config.register(SomeCheckedAppExceptionMapper.class);
	config.register(SomeUncheckedAppExceptionMapper.class);
	config.register(GlobalExceptionMapper.class);
	GatewayRequestObjectHandlerImpl handler = new GatewayRequestObjectHandlerImpl();
	handler.init(config);
	handler.start();
	return handler;
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:16,代码来源:GatewayRequestObjectHandlerIntTest.java

示例13: JerseyGet

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
protected JerseyGet() {
    client = ClientBuilder.newClient()
    .register(EncodingFilter.class)
    .register(GZipEncoder.class)
    .property(ClientProperties.USE_ENCODING, ENCODING_TYPE);
    webTarget = client.target(SEARCH_URL);
}
 
开发者ID:vcu-swim-lab,项目名称:stack-intheflow,代码行数:8,代码来源:JerseyGet.java

示例14: createClient

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
private static Client createClient(String httpAuthenticationUser, String httpAuthenticationPassword) {
    ClientConfig cc = new ClientConfig().register(new JacksonFeature());
    Client client = ClientBuilder.newBuilder().withConfig(cc).build();
    client.register(GZipEncoder.class);
    client.register(EncodingFilter.class);
    client.register(DeflateEncoder.class);
    if (!Strings.isNullOrEmpty(httpAuthenticationUser) && !Strings.isNullOrEmpty(httpAuthenticationPassword) ){
        client.register(HttpAuthenticationFeature.basic(httpAuthenticationUser, httpAuthenticationPassword));
    }
    JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    provider.setMapper(ObjectMapperBuilder.buildNewObjectMapper());
    client.register(provider);
    return client;
}
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:15,代码来源:RestClient.java

示例15: RequestHandler

import org.glassfish.jersey.message.GZipEncoder; //导入依赖的package包/类
public RequestHandler() {
	// configure the application with the resource
	init(new ResourceConfig()
			.register(GatewayFeature.class)
			.register(MultiPartFeature.class)
			.register(EncodingFilter.class)
			.register(GZipEncoder.class)
			.packages("com.jrestless.aws.examples"));
	start();
}
 
开发者ID:bbilger,项目名称:jrestless-examples,代码行数:11,代码来源:RequestHandler.java


注:本文中的org.glassfish.jersey.message.GZipEncoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。