apacheds添加拦截器

我想在apacheds下加入一个自己定义的拦截器,请问大家有招吗?
这是在github上的一个范例代码:https://github.com/kwart/ldap...

//add interceptor
List<Interceptor> interceptors = directoryService.getInterceptors();
// Find Normalization interceptor in chain
int insertionPosition = -1;
for (int pos = 0; pos < interceptors.size(); ++pos) {
    Interceptor interceptor = interceptors.get(pos);
    if (interceptor instanceof NormalizationInterceptor) {
        insertionPosition = pos;
    }
}
// insert our new interceptor just behind
System.out.println(interceptors.size()+"==============="+insertionPosition);
interceptors.add(insertionPosition+1, new SearchIntercepter());
directoryService.setInterceptors(interceptors);

上面是添加自定义拦截器部分代码,new SearchIntercepter()是自己定义的。如何实现一个基本的额拦截器了?就卡在这了。

阅读 2.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进