java 什么是 JAX-WS 拦截器(也称为处理程序)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1398362/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are JAX-WS Interceptors (also known as handlers)?
提问by Ajay
What are JAX WS Interceptors? Where do I find info regarding the same!
什么是 JAX WS 拦截器?我在哪里可以找到有关相同的信息!
回答by skaffman
JAX-WS interceptors (also called handlers) are used to weave in aspects of the request in a transparent way. Example of this are logging or requests/responses, adding security headers to the message, encryption, compression, etc. A single interceptor can manipulate either the logical payload (content) of the message or the protocol of the message, but cannot do both.
JAX-WS 拦截器(也称为处理程序)用于以透明的方式编织请求的各个方面。这方面的示例是日志记录或请求/响应、向消息添加安全标头、加密、压缩等。单个拦截器可以操作消息的逻辑负载(内容)或消息的协议,但不能同时操作。
See herefor the introductory documentation on them.
有关它们的介绍性文档,请参见此处。
回答by Taylor Leese
回答by comeGetSome
in addition to a Handler in JAX-WS, the RI also provides the Tube concept. It is pretty close to the Filter concept in a Servlet API, as such you can access and manipulate entire in/out packet for a service and a client alike.
除了 JAX-WS 中的 Handler 之外,RI 还提供了 Tube 概念。它非常接近 Servlet API 中的过滤器概念,因此您可以访问和操作服务和客户端的整个输入/输出数据包。
I find it more handy for general purposes, like logging of messages and prevalidation of soap headers, etc just because I dont have to attach a @HandlerChain on every web-service. See link.
我发现它对于一般用途更方便,例如记录消息和预验证soap标头等,因为我不必在每个网络服务上附加@HandlerChain。见链接。

