【问题标题】:Session time out on Liferay with multiple spring MVC portletLiferay 上的会话超时,带有多个 spring MVC portlet
【发布时间】:2013-12-13 13:55:09
【问题描述】:

我们的应用程序是在 Liferay 上开发的,页面上有多个 Spring MVC portlet。它是一个单页应用程序,并且导航只发生在 portlet 内部。现在有时当 Liferay 会话超时并且我向控件发送一个新视图的请求时,liferay 登录页面将显示在 portlet 中。但是预期的行为是如果 liferay 会话超时,那么整个页面应该已经重定向到登录页面。 我在 portal-ext.properties 中指定了以下属性

session.timeout.warning=1
session.timeout.auto.extend=false
session.timeout.redirect.on.expire=true
browser.cache.signed.in.disabled=true

有什么建议吗?

【问题讨论】:

  • 尝试在portal-ext.properties 中添加auth.login.url=/web/guest/home 中的登录portlet。

标签: session spring-mvc liferay spring-portlet-mvc


【解决方案1】:

如果您只是在 portlet 中进行 Ajax 导航,您可能希望使用 Liferay 的会话扩展方式(您必须查看它 - 有一个客户端计时器可以倒计时并显示“会话。 timeout.warning" - 我现在不能指点)

或者,如果只要浏览器窗口打开,会话扩展就可以接受,您可以使用相同的机制来显示替代行为:它可以扩展会话,而不是自愿超时。请参阅门户(-ext).properties:

#
# Set the auto-extend mode to true to avoid having to ask the user whether
# to extend the session or not. Instead it will be automatically extended.
# The purpose of this mode is to keep the session open as long as the user
# browser is open and with a portal page loaded. It is recommended to use
# this setting along with a smaller "session.timeout", such as 5 minutes for
# better performance.
#
session.timeout.auto.extend=true

【讨论】:

    【解决方案2】:

    这是在您的所有页面中发生还是仅在特定页面上发生。 ? 点击任何按钮都会发生这种情况吗?

    如果是这样,请在单击按钮时调用的方法中执行以下操作,

    function onClickFunction(){
     var liferaySession = Liferay.Session._currentTime;
     if(liferaySession == '0'){
       //reload page
      }
     else{
       //proceed
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-16
      • 2017-01-30
      • 1970-01-01
      相关资源
      最近更新 更多