HttpSession
是否可以在 a 的preProcess
方法中访问/创建PreProcessInterceptor
?
(RestEasy 2.3.4)
HttpSession
是否可以在 a 的preProcess
方法中访问/创建PreProcessInterceptor
?
(RestEasy 2.3.4)
您可以HttpSession
通过注入HttpServletRequest
using@Context
注释然后从请求中获取会话来访问,如下所示:
@Context
private HttpServletRequest servletRequest;
@Override
public ServerResponse preProcess(HttpRequest request, ResourceMethod method)
throws Failure, WebApplicationException
{
HttpSession session = servletRequest.getSession();
//Do something with the session here...
}