com.sun.jersey.api.client.Client.removeAllFilters()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中com.sun.jersey.api.client.Client.removeAllFilters()方法的一些代码示例,展示了Client.removeAllFilters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Client.removeAllFilters()方法的具体详情如下:
包路径:com.sun.jersey.api.client.Client
类名称:Client
方法名:removeAllFilters

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);
  }
}

相关文章