简体   繁体   English

如何在CXF拦截器中访问Servlet会话?

[英]How to access Servlet Session in CXF Interceptor?

I have an "in" CXF Interceptor, I want to access the the Servlet Session in its handleMessage() method. 我有一个“in”CXF Interceptor,我想在其handleMessage()方法中访问Servlet Session。 My Interceptor extends AbstractPhaseInterceptor . 我的拦截器扩展了AbstractPhaseInterceptor

I want to access the session to store some info about the user as my web service client maintains sessions. 我想访问会话以存储有关用户的一些信息,因为我的Web服务客户端维护会话。

I can already access the session in my web services. 我已经可以在我的Web服务中访问该会话。

You should be able to do 你应该能做到的

HttpServletRequest req = (HttpServletRequest)message.get("HTTP.REQUEST");

to get the HttpServletReqest where you can then grab the session from it. 获取HttpServletReqest,然后从中获取会话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM