List of usage examples for com.liferay.portal.kernel.servlet SessionErrors add
public static void add(PortletRequest portletRequest, String key)
From source file:com.liferay.message.boards.web.internal.portlet.action.MoveThreadMVCActionCommand.java
License:Open Source License
@Override public void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { try {/*from w ww. j a v a 2 s. c om*/ moveThread(actionRequest, actionResponse); } catch (LockedThreadException | PrincipalException | RequiredMessageException e) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/message_boards/error.jsp"); } catch (MessageBodyException | MessageSubjectException | NoSuchThreadException e) { SessionErrors.add(actionRequest, e.getClass()); } }
From source file:com.liferay.message.boards.web.internal.portlet.action.MoveThreadMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {/*from w w w .jav a2 s . c om*/ MBMessage threadMessage = ActionUtil.getThreadMessage(renderRequest); renderRequest.setAttribute(WebKeys.MESSAGE_BOARDS_MESSAGE, threadMessage); } catch (NoSuchMessageException | PrincipalException e) { SessionErrors.add(renderRequest, e.getClass()); return "/message_boards/error.jsp"; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new PortletException(e); } return "/message_boards/move_thread.jsp"; }
From source file:com.liferay.message.boards.web.internal.portlet.action.SplitThreadMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { try {//from ww w . j a v a 2 s.co m splitThread(actionRequest, actionResponse); } catch (PrincipalException | RequiredMessageException e) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/message_boards/error.jsp"); } catch (MessageBodyException | MessageSubjectException | NoSuchThreadException | SplitThreadException e) { SessionErrors.add(actionRequest, e.getClass()); } }
From source file:com.liferay.message.boards.web.internal.portlet.action.ViewMessageMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {//from www .jav a 2 s. com MBMessageDisplay messageDisplay = ActionUtil.getMessageDisplay(renderRequest); renderRequest.setAttribute(WebKeys.MESSAGE_BOARDS_MESSAGE_DISPLAY, messageDisplay); return "/message_boards/view_message.jsp"; } catch (NoSuchMessageException | PrincipalException e) { SessionErrors.add(renderRequest, e.getClass()); return "/message_boards/error.jsp"; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new PortletException(e); } }
From source file:com.liferay.mobile.device.rules.web.internal.portlet.action.EditActionMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {//from w w w . j av a2 s . c om if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateAction(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteActions(actionRequest); } } catch (Exception e) { if (e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/error.jsp"); } else if (e instanceof ActionTypeException || e instanceof NoSuchActionException || e instanceof NoSuchRuleGroupException) { SessionErrors.add(actionRequest, e.getClass()); } else { throw e; } } }
From source file:com.liferay.mobile.device.rules.web.internal.portlet.action.EditRuleGroupInstanceMVCActionCommand.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 .ja v a 2 s . c o m*/ if (cmd.equals(Constants.DELETE)) { deleteRuleGroupInstance(actionRequest); } else if (cmd.equals(Constants.UPDATE)) { updateRuleGroupInstancesPriorities(actionRequest); } sendRedirect(actionRequest, actionResponse, getRedirect(actionRequest, actionResponse)); } catch (Exception e) { if (e instanceof NoSuchRuleGroupException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/error.jsp"); } else { throw e; } } }
From source file:com.liferay.mobile.device.rules.web.internal.portlet.action.EditRuleGroupMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {// ww w.j a v a 2s. co m if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateRuleGroup(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteRuleGroups(actionRequest); } else if (cmd.equals(Constants.COPY)) { copyRuleGroup(actionRequest); } sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof NoSuchRuleGroupException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/error.jsp"); } else { throw e; } } }
From source file:com.liferay.mobile.device.rules.web.internal.portlet.action.EditRuleGroupMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) { try {//from w ww. j a va 2 s .c o m long ruleGroupId = ParamUtil.getLong(renderRequest, "ruleGroupId"); MDRRuleGroup ruleGroup = _mdrRuleGroupService.fetchRuleGroup(ruleGroupId); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_GROUP, ruleGroup); return "/edit_rule_group.jsp"; } catch (PortalException pe) { SessionErrors.add(renderRequest, pe.getClass()); return "/error.jsp"; } }
From source file:com.liferay.mobile.device.rules.web.internal.portlet.action.EditRuleMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/*w w w .j a va2 s . c o m*/ if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateRule(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteRule(actionRequest); } } catch (Exception e) { if (e instanceof NoSuchActionException || e instanceof NoSuchRuleGroupException || e instanceof PrincipalException || e instanceof UnknownRuleHandlerException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/error.jsp"); } else { throw e; } } }
From source file:com.liferay.monitoring.web.internal.portlet.action.EditSessionMVCActionCommand.java
License:Open Source License
@Override public void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); if (!permissionChecker.isCompanyAdmin()) { SessionErrors.add(actionRequest, PrincipalException.MustBeCompanyAdmin.class.getName()); actionResponse.setRenderParameter("mvcPath", "/error.jsp"); return;//from ww w .j av a2s.c o m } invalidateSession(actionRequest); sendRedirect(actionRequest, actionResponse); }