本文整理匯總了Java中javax.ws.rs.client.ClientResponseFilter類的典型用法代碼示例。如果您正苦於以下問題:Java ClientResponseFilter類的具體用法?Java ClientResponseFilter怎麽用?Java ClientResponseFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ClientResponseFilter類屬於javax.ws.rs.client包,在下文中一共展示了ClientResponseFilter類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldRegisterAMultiTypedProviderInstanceWithPriorities
import javax.ws.rs.client.ClientResponseFilter; //導入依賴的package包/類
@Test
public void shouldRegisterAMultiTypedProviderInstanceWithPriorities() {
MultiTypedProvider provider = new MultiTypedProvider();
Map<Class<?>, Integer> priorities = new HashMap<>();
priorities.put(ClientRequestFilter.class, 500);
priorities.put(ClientResponseFilter.class, 501);
priorities.put(MessageBodyReader.class, 502);
priorities.put(MessageBodyWriter.class, 503);
priorities.put(ReaderInterceptor.class, 504);
priorities.put(WriterInterceptor.class, 505);
priorities.put(ResponseExceptionMapper.class, 506);
priorities.put(ParamConverterProvider.class, 507);
RestClientBuilder builder = RestClientBuilder.newBuilder().register(provider, priorities);
Configuration configuration = builder.getConfiguration();
assertTrue(configuration.isRegistered(MultiTypedProvider.class), MultiTypedProvider.class + " should be registered");
assertTrue(configuration.isRegistered(provider), MultiTypedProvider.class + " should be registered");
Map<Class<?>, Integer> contracts = configuration.getContracts(MultiTypedProvider.class);
assertEquals(contracts.size(), priorities.size(),
"There should be "+priorities.size()+" provider types registered");
for(Map.Entry<Class<?>, Integer> priority : priorities.entrySet()) {
Integer contractPriority = contracts.get(priority.getKey());
assertEquals(contractPriority, priority.getValue(), "The priority for "+priority.getKey()+" should be "+priority.getValue());
}
}
示例2: shouldRegisterAMultiTypedProviderClassWithPriorities
import javax.ws.rs.client.ClientResponseFilter; //導入依賴的package包/類
@Test
public void shouldRegisterAMultiTypedProviderClassWithPriorities() {
Map<Class<?>, Integer> priorities = new HashMap<>();
priorities.put(ClientRequestFilter.class, 500);
priorities.put(ClientResponseFilter.class, 501);
priorities.put(MessageBodyReader.class, 502);
priorities.put(MessageBodyWriter.class, 503);
priorities.put(ReaderInterceptor.class, 504);
priorities.put(WriterInterceptor.class, 505);
priorities.put(ResponseExceptionMapper.class, 506);
priorities.put(ParamConverterProvider.class, 507);
RestClientBuilder builder = RestClientBuilder.newBuilder().register(MultiTypedProvider.class, priorities);
Configuration configuration = builder.getConfiguration();
assertTrue(configuration.isRegistered(MultiTypedProvider.class), MultiTypedProvider.class + " should be registered");
Map<Class<?>, Integer> contracts = configuration.getContracts(MultiTypedProvider.class);
assertEquals(contracts.size(), priorities.size(),
"There should be "+priorities.size()+" provider types registered");
for(Map.Entry<Class<?>, Integer> priority : priorities.entrySet()) {
Integer contractPriority = contracts.get(priority.getKey());
assertEquals(contractPriority, priority.getValue(), "The priority for "+priority.getKey()+" should be "+priority.getValue());
}
}
示例3: shouldRegisterAMultiTypedProviderInstance
import javax.ws.rs.client.ClientResponseFilter; //導入依賴的package包/類
@Test
public void shouldRegisterAMultiTypedProviderInstance() {
MultiTypedProvider provider = new MultiTypedProvider();
Class[] providerTypes = {ClientRequestFilter.class, ClientResponseFilter.class,
MessageBodyReader.class, MessageBodyWriter.class, ReaderInterceptor.class, WriterInterceptor.class,
ResponseExceptionMapper.class, ParamConverterProvider.class};
RestClientBuilder builder = RestClientBuilder.newBuilder().register(provider, providerTypes);
Configuration configuration = builder.getConfiguration();
assertTrue(configuration.isRegistered(MultiTypedProvider.class), MultiTypedProvider.class + " should be registered");
assertTrue(configuration.isRegistered(provider), MultiTypedProvider.class + " should be registered");
assertEquals(configuration.getContracts(MultiTypedProvider.class).size(), providerTypes.length,
"There should be "+providerTypes.length+" provider types registered");
}
示例4: shouldRegisterAMultiTypedProviderClass
import javax.ws.rs.client.ClientResponseFilter; //導入依賴的package包/類
@Test
public void shouldRegisterAMultiTypedProviderClass() {
Class[] providerTypes = {ClientRequestFilter.class, ClientResponseFilter.class,
MessageBodyReader.class, MessageBodyWriter.class, ReaderInterceptor.class, WriterInterceptor.class,
ResponseExceptionMapper.class, ParamConverterProvider.class};
RestClientBuilder builder = RestClientBuilder.newBuilder().register(MultiTypedProvider.class, providerTypes);
Configuration configuration = builder.getConfiguration();
assertTrue(configuration.isRegistered(MultiTypedProvider.class), MultiTypedProvider.class + " should be registered");
assertEquals(configuration.getContracts(MultiTypedProvider.class).size(), providerTypes.length,
"There should be "+providerTypes.length+" provider types registered");
}
示例5: getClientResponseFilters
import javax.ws.rs.client.ClientResponseFilter; //導入依賴的package包/類
public ClientResponseFilter[] getClientResponseFilters() {
return clientResponseFilters.toArray(new ClientResponseFilter[0]);
}
示例6: withClientResponseFilter
import javax.ws.rs.client.ClientResponseFilter; //導入依賴的package包/類
public Config withClientResponseFilter(ClientResponseFilter clientResponseFilter) {
this.clientResponseFilters.add(clientResponseFilter);
return this;
}
示例7: withClientResponseFilters
import javax.ws.rs.client.ClientResponseFilter; //導入依賴的package包/類
public JerseyDockerCmdExecFactory withClientResponseFilters(ClientResponseFilter... clientResponseFilter) {
this.clientResponseFilters = clientResponseFilter;
return this;
}