ログイン後にユーザーをリダイレクトしようとしているとします。
これをご覧ください。トリックをする必要があります。 クラスをバンドルに配置し、ロジックを調整します。
@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の場合と同様に動作します。
こんにちはMiroslav、ありがとうございました。はい、ログイン後に特定のページにユーザーをリダイレクトしようとしていました。私はLifecycleActionを実装する代わりにActionイベントを拡張しようとしていました。これは私のために働いています。ありがとう – Dipti