本文整理汇总了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;
}
示例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;
}
};
}
示例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();
}
示例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);
}
}
示例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());
}
示例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")));
}
示例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);
}
示例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);
}
示例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:
}
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}