Example usage for com.liferay.portal.kernel.portlet LiferayPortletRequest getPortlet

List of usage examples for com.liferay.portal.kernel.portlet LiferayPortletRequest getPortlet

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portlet LiferayPortletRequest getPortlet.

Prototype

public Portlet getPortlet();

Source Link

Usage

From source file:com.liferay.login.web.internal.portlet.action.LoginMVCActionCommand.java

License:Open Source License

protected void postProcessAuthFailure(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {

    LiferayPortletRequest liferayPortletRequest = _portal.getLiferayPortletRequest(actionRequest);

    String portletName = liferayPortletRequest.getPortletName();

    Layout layout = (Layout) actionRequest.getAttribute(WebKeys.LAYOUT);

    PortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, liferayPortletRequest.getPortlet(),
            layout, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("saveLastPath", Boolean.FALSE.toString());

    String redirect = ParamUtil.getString(actionRequest, "redirect");

    if (Validator.isNotNull(redirect)) {
        portletURL.setParameter("redirect", redirect);
    }/*from   w w w.  j a  v a2 s. com*/

    String login = ParamUtil.getString(actionRequest, "login");

    if (Validator.isNotNull(login)) {
        SessionErrors.add(actionRequest, "login", login);
    }

    if (portletName.equals(LoginPortletKeys.LOGIN)) {
        portletURL.setWindowState(WindowState.MAXIMIZED);
    } else {
        portletURL.setWindowState(actionRequest.getWindowState());
    }

    actionResponse.sendRedirect(portletURL.toString());
}