JAX-WS:在代码中定义服务器端处理程序链,而不是在外部 xml 中
我想为我的 jax-ws web 服务启用 http 压缩。我发现我必须使用可以修改 http 标头的自定义处理程序链来完成此操作。
我发现的所有教程都引用了注释@HandlerChain,它指向处理程序链配置xml文件,但我的问题是我的web服务必须尽可能轻量级,因此我无法在外部xml文件中定义我的处理程序链。
我尝试了以下方法但没有成功:
final Endpoint ep = Endpoint.publish("http://localhost:8878/mywebservice",
new WebserviceImpl() );
final Binding binding = ep.getBinding();
final List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new MySuperbSOAPHandler());
binding.setHandlerChain(handlerChain);
有人知道该怎么做吗?有可能吗?
i want to enable http compression for my jax-ws webservice. i found out that i have to do it with a custom handlerchain that can modify the http-headers.
all tutorials i found refer to the annotation @HandlerChain that points to a handler chain configuration xml-file but my problem is that my webservice has to be as lightweight as possible therefore i cant define my handler chain in an external xml file.
i tried the following but did not succeed:
final Endpoint ep = Endpoint.publish("http://localhost:8878/mywebservice",
new WebserviceImpl() );
final Binding binding = ep.getBinding();
final List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new MySuperbSOAPHandler());
binding.setHandlerChain(handlerChain);
does anyone know how to do this? is it even possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当服务已经发布时,您似乎无法更改处理程序链。
如果您的实际用例如上所示,只需创建()然后发布()即可轻松修复。
It doesn't appear that you can change the handler chain when the service has already been published.
If your actual use case is as above, it's easy to fix by simply create()ing and then publish()ing.