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

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

Introduction

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

Prototype

public String getPortletName();

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 . jav  a 2 s  .c  o m

    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());
}

From source file:com.liferay.portlet.display.template.web.internal.dynamic.data.mapping.util.PortletDisplayTemplateDDMDisplay.java

License:Open Source License

@Override
protected String getViewTemplatesURL(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse, long classNameId, long classPK, long resourceClassNameId)
        throws Exception {

    String portletName = liferayPortletRequest.getPortletName();

    PortletURL portletURL = null;//from w w  w  .jav  a 2 s .c  om

    if (portletName.equals(PortletKeys.PORTLET_DISPLAY_TEMPLATE)) {
        portletURL = _portal.getControlPanelPortletURL(liferayPortletRequest,
                PortletKeys.PORTLET_DISPLAY_TEMPLATE, PortletRequest.RENDER_PHASE);
    } else {
        long groupId = _portal.getScopeGroupId(liferayPortletRequest);

        portletURL = liferayPortletResponse.createRenderURL();

        portletURL.setParameter("mvcPath", "/view_template.jsp");
        portletURL.setParameter("groupId", String.valueOf(groupId));
        portletURL.setParameter("classNameId", String.valueOf(classNameId));
        portletURL.setParameter("classPK", String.valueOf(classPK));

        portletURL.setWindowState(LiferayWindowState.POP_UP);
    }

    return portletURL.toString();
}