Example usage for com.liferay.portal.kernel.servlet SessionErrors add

List of usage examples for com.liferay.portal.kernel.servlet SessionErrors add

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet SessionErrors add.

Prototype

public static void add(PortletRequest portletRequest, String key) 

Source Link

Usage

From source file:com.liferay.social.activity.web.internal.portlet.action.EditActivitySettingsMVCActionCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    try {/*from www  .  j  av a 2 s  .c o m*/
        if (cmd.equals(Constants.UPDATE)) {
            updateActivitySettings(actionRequest);
        }
    } catch (Exception e) {
        if (e instanceof PrincipalException) {
            SessionErrors.add(actionRequest, e.getClass());
        } else {
            throw e;
        }
    }
}

From source file:com.liferay.social.activity.web.internal.portlet.action.ViewMVCRenderCommand.java

License:Open Source License

@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException {

    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

    try {//from w  w w  .ja  va  2s.co m
        renderRequest.setAttribute(SocialActivityWebKeys.SOCIAL_ACTIVITY_SETTINGS_MAP,
                getActivitySettingsMap(themeDisplay));
    } catch (Exception e) {
        if (e instanceof PrincipalException) {
            SessionErrors.add(renderRequest, e.getClass());

            return "/error.jsp";
        } else {
            throw new PortletException(e);
        }
    }

    return "/view.jsp";
}

From source file:com.liferay.social.requests.web.internal.portlet.action.UpdateRequestMVCRenderCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    try {//  ww w.  j a v  a 2  s  .  com
        updateRequest(actionRequest);

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

        if (Validator.isNotNull(redirect)) {
            actionResponse.sendRedirect(redirect);
        }
    } catch (NoSuchRequestException | PrincipalException e) {
        SessionErrors.add(actionRequest, e.getClass());

        actionResponse.setRenderParameter("mvcPath", "/error.jsp");
    }
}