如何将用户重定向到网站特定着陆页

问题描述:

我想根据用户在liferay中的网站访问权将用户重定向到默认着陆页。我正在使用liferay DXP。我知道如何在liferay 6.2中完成,但我不知道如何在liferay 7中覆盖/扩展DefaultLandingPageAction类。如何将用户重定向到网站特定着陆页

让我知道是否有人以前做过这个。

谢谢!

我假定你正在尝试登录后重定向用户。

看看这个。应该做的伎俩。 将该类放入一个包中并调整逻辑。

@Component(
     immediate = true, 
     property = { 
       "key=login.events.post" 
     }, 
     service = LifecycleAction.class 
) 
public class LandingPageRouter implements LifecycleAction { 
    private static Log LOG = LogFactoryUtil.getLog(LandingPageRouter.class); 

    @Reference 
    private UserLocalService userLocalService; 

    @Override 
    public void processLifecycleEvent(LifecycleEvent lifecycleEvent) throws ActionException { 
     //Do some magic 

     //build the path. 
     LastPath lastPath = new LastPath(StringPool.BLANK, path); 
     lifecycleEvent.getRequest().getSession().setAttribute(WebKeys.LAST_PATH, lastPath); 
    } 
} 

LastPath的工作方式与DefaultLandingPageAction相同。

+0

嗨米罗斯拉夫,感谢您的帮助。是的,我试图将用户重定向到登录后的特定页面。我试图扩展Action事件而不是实现LifecycleAction。这对我有效。谢谢 – Dipti