Jsf 2 将对象保存在自定义spring安全筛选器内的会话中

Jsf 2 将对象保存在自定义spring安全筛选器内的会话中,jsf-2,spring-security,session-variables,Jsf 2,Spring Security,Session Variables,我使用的是Spring3.1.0.RC3和JSF2.0 我实现了一个定制的spring安全过滤器,我想在用户会话中存储一个对象,以便以后恢复它。我是这样做的 public class SpringCustomSecurityFilter extends AbstractAuthenticationProcessingFilter { public Authentication attemptAuthentication(HttpServletRequest request,

我使用的是Spring3.1.0.RC3和JSF2.0

我实现了一个定制的spring安全过滤器,我想在用户会话中存储一个对象,以便以后恢复它。我是这样做的

public class SpringCustomSecurityFilter extends AbstractAuthenticationProcessingFilter 
{
    public Authentication attemptAuthentication(HttpServletRequest request,
        HttpServletResponse response) throws AuthenticationException,
            IOException, ServletException 
    {
        // Putting the attribute
        request.getSession().setAttribute("OBJECT_STRING","hola");

        // Recovering the attribute
        String aux = request.getSession().getAttribute("OBJECT_STRING");
    }

}

问题是它实际上将对象置于会话中,但在我再次进入过滤器后,该属性在会话中不存在。那么,如何在JSF前端会话中存储属性呢?

应该可以,您是否检查了会话是否相同?你可以打电话

request.getSession().getId()

验证它。

您好,您是对的,它正在工作。问题是,在筛选器中,我调用其他站点在回调中返回一个值,因此我使用url localhost:8080执行回调,而回调使用url 127.0.0.1,因此会话ID不同。谢谢