【问题标题】:Does SessionStatus object.setComplete() clears all the session attributes or just work for the controller in which it is used?SessionStatus object.setComplete() 是清除所有会话属性还是仅适用于使用它的控制器?
【发布时间】:2013-06-06 23:37:04
【问题描述】:

如果我在 Controller 中使用 SessionStatus object.setComplete(),我不清楚这一点,它是清除 Webapp 的所有会话数据还是仅清除由 使用@SessionAttributes 的特定控制器?

【问题讨论】:

  • 我会重新构建它,因为 SessionStatus 与 session.invalidate 相同?

标签: spring model-view-controller


【解决方案1】:

SessionStatus#setComplete()JavaDoc 非常清楚该方法的用途:

/**
 * Mark the current handler's session processing as complete, allowing for
 * cleanup of session attributes.
 */

这将清除通过@SessionAttribute 注册的当前处理程序的会话属性。这和servlet的HttpSession#invalidate()完全不同:

/**
 * Invalidates this session then unbinds any objects bound to it. 
 */

这实际上完全破坏了用户会话。

【讨论】:

  • 非常感谢您的回复。
猜你喜欢
  • 2016-01-25
  • 2010-10-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-19
  • 2010-10-29
相关资源
最近更新 更多