本文整理了Java中com.sun.jersey.api.client.Client.removeAllFilters()
方法的一些代码示例,展示了Client.removeAllFilters()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Client.removeAllFilters()
方法的具体详情如下:
包路径:com.sun.jersey.api.client.Client
类名称:Client
方法名:removeAllFilters
暂无
代码示例来源:origin: org.apache.apex/apex-engine
public void clearFilters()
{
client.removeAllFilters();
clientFilters.clear();
}
代码示例来源:origin: com.emc.ecs/object-client
public S3EncryptionClient(S3Config s3Config, ClientHandler clientHandler, EncryptionConfig encryptionConfig) {
super(s3Config, clientHandler);
this.encryptionConfig = encryptionConfig;
// create an encode chain based on parameters
CodecChain encodeChain = encryptionConfig.isCompressionEnabled()
? new CodecChain(encryptionConfig.getCompressionSpec(), encryptionConfig.getEncryptionSpec())
: new CodecChain(encryptionConfig.getEncryptionSpec());
encodeChain.setProperties(encryptionConfig.getCodecProperties());
// insert codec filter into chain before the authorization filter
// as usual, Jersey makes this quite hard
// first, make a list of the filters
List<ClientFilter> filters = new ArrayList<ClientFilter>();
ClientHandler handler = client.getHeadHandler();
while (handler instanceof ClientFilter) {
ClientFilter filter = (ClientFilter) handler;
if (filter instanceof AuthorizationFilter) {
// insert codec filter before checksum filter
filters.add(new CodecFilter(encodeChain).withCodecProperties(encryptionConfig.getCodecProperties()));
}
filters.add(filter);
handler = filter.getNext();
}
// then re-create the filter list (must reverse the list because filters are inserted back to front)
Collections.reverse(filters);
client.removeAllFilters();
for (ClientFilter filter : filters) {
client.addFilter(filter);
}
}
内容来源于网络,如有侵权,请联系作者删除!