【问题标题】:Liferay get browser URLLiferay 获取浏览器 URL
【发布时间】:2017-05-10 19:11:57
【问题描述】:

我在登录后挂钩中有一个 HttpServletRequest 对象。如何获取浏览器的 URL。

当我使用 PortalUtil.getCurrentCompleteURL(HttpServletRequest) 时,我总是得到http://localhost:8080/c。我需要http://localhost:8080/web/abc之类的东西。

我没有 ThemeDisplay 对象。

【问题讨论】:

  • 你试过 PortalUtil.getCurrentURL(myRequest);
  • @Issamovitch 给了我 /c
  • 我认为您的示例应该可以工作: HttpServletRequest servletRequest = PortalUtil.getHttpServletRequest(request); String currentCompleteUrl = PortalUtil.getCurrentCompleteURL(servletRequest);
  • @Issamovitch 我已经有了 HttpServletRequest。所以我不需要 PortalUtil 的那个。 PortalUtil.getCurrentCompleteURL(servletRequest);给我localhost:8080/c

标签: liferay-6.2


【解决方案1】:

我猜您要查找的 URL 是登录前的 URL。门户网站在重定向到登录页面时将其保存在会话中。你可以这样访问它:

String lastPath = session.getAttribute(WebKeys.LAST_PATH);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-18
    • 2013-08-23
    • 2014-03-24
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 2010-11-18
    相关资源
    最近更新 更多