本文整理汇总了Java中org.glassfish.jersey.client.filter.EncodingFilter类的典型用法代码示例。如果您正苦于以下问题:Java EncodingFilter类的具体用法?Java EncodingFilter怎么用?Java EncodingFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EncodingFilter类属于org.glassfish.jersey.client.filter包,在下文中一共展示了EncodingFilter类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configureCompression
import org.glassfish.jersey.client.filter.EncodingFilter; //导入依赖的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
示例2: create_gzip_compressed_request_and_response
import org.glassfish.jersey.client.filter.EncodingFilter; //导入依赖的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
示例3: JerseyClient
import org.glassfish.jersey.client.filter.EncodingFilter; //导入依赖的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
示例4: JerseyGet
import org.glassfish.jersey.client.filter.EncodingFilter; //导入依赖的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
示例5: createClient
import org.glassfish.jersey.client.filter.EncodingFilter; //导入依赖的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
示例6: initializeHTTPClient
import org.glassfish.jersey.client.filter.EncodingFilter; //导入依赖的package包/类
private void initializeHTTPClient() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.register(JacksonFeature.class);
clientConfig.register(GZipEncoder.class);
clientConfig.register(EncodingFilter.class);
clientConfig.property(ClientProperties.READ_TIMEOUT, getConnectionTimeoutPreference());
Client client = ClientBuilder.newClient(clientConfig);
String serviceEndpoint = getConnection().getServerUrlRoot();
serviceEndpoint = serviceEndpoint + constructServiceEndpoint();
endpoint = client.target(serviceEndpoint);
}
开发者ID:forcedotcom,项目名称:idecore,代码行数:14,代码来源:HTTPConnection.java
示例7: search_gzip_compressed_response
import org.glassfish.jersey.client.filter.EncodingFilter; //导入依赖的package包/类
@Test
public void search_gzip_compressed_response() throws Exception {
final Response response = RestTest.target(getPort(), "whois/search?query-string=TP1-TEST&source=TEST")
.register(EncodingFilter.class)
.register(GZipEncoder.class)
.request(MediaType.APPLICATION_XML)
.get();
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.getWhoisObjects(), hasSize(1));
}
开发者ID:RIPE-NCC,项目名称:whois,代码行数:15,代码来源:WhoisSearchServiceTestIntegration.java
示例8: search_zlib_compressed_response
import org.glassfish.jersey.client.filter.EncodingFilter; //导入依赖的package包/类
@Test
public void search_zlib_compressed_response() throws Exception {
final Response response = RestTest.target(getPort(), "whois/search?query-string=TP1-TEST&source=TEST")
.register(EncodingFilter.class)
.register(DeflateEncoder.class)
.request(MediaType.APPLICATION_XML)
.get();
assertThat(response.getHeaderString("Content-Type"), is(MediaType.APPLICATION_XML));
assertThat(response.getHeaderString("Content-Encoding"), is("deflate"));
final WhoisResources whoisResources = response.readEntity(WhoisResources.class);
assertThat(whoisResources.getWhoisObjects(), hasSize(1));
}
开发者ID:RIPE-NCC,项目名称:whois,代码行数:15,代码来源:WhoisSearchServiceTestIntegration.java
注:本文中的org.glassfish.jersey.client.filter.EncodingFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论