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.portlet.messageboards.action.EditDiscussionAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping actionMapping, ActionForm actionForm, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {/*from www .ja v a 2 s .c om*/ ActionUtil.getMessage(renderRequest); } catch (Exception e) { if (e instanceof NoSuchMessageException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return actionMapping.findForward("portlet.message_boards.error"); } else { throw e; } } return actionMapping.findForward(getForward(renderRequest, "portlet.message_boards.edit_discussion")); }
From source file:com.liferay.portlet.messageboards.action.EditMessageAction.java
License:Open Source License
public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/* w w w.ja v a 2 s . c o m*/ if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateMessage(actionRequest, actionResponse); } else if (cmd.equals(Constants.DELETE)) { deleteMessage(actionRequest); } else if (cmd.equals(Constants.SUBSCRIBE)) { subscribeMessage(actionRequest); } else if (cmd.equals(Constants.UNSUBSCRIBE)) { unsubscribeMessage(actionRequest); } if (cmd.equals(Constants.DELETE) || cmd.equals(Constants.SUBSCRIBE) || cmd.equals(Constants.UNSUBSCRIBE)) { sendRedirect(actionRequest, actionResponse); } } catch (Exception e) { if (e instanceof NoSuchMessageException || e instanceof PrincipalException || e instanceof RequiredMessageException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.message_boards.error"); } else if (e instanceof CaptchaTextException || e instanceof FileNameException || e instanceof FileSizeException || e instanceof MessageBodyException || e instanceof MessageSubjectException) { SessionErrors.add(actionRequest, e.getClass().getName()); } else if (e instanceof TagsEntryException) { SessionErrors.add(actionRequest, e.getClass().getName(), e); } else { throw e; } } }
From source file:com.liferay.portlet.messageboards.action.EditMessageAction.java
License:Open Source License
public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {//from w ww . j ava 2 s .c o m ActionUtil.getMessage(renderRequest); } catch (Exception e) { if (e instanceof NoSuchMessageException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.message_boards.error"); } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.message_boards.edit_message")); }
From source file:com.liferay.portlet.messageboards.action.MoveThreadAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { try {/* w w w.j a v a2 s . c om*/ moveThread(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof PrincipalException || e instanceof RequiredMessageException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.message_boards.error"); } else if (e instanceof MessageBodyException || e instanceof MessageSubjectException || e instanceof NoSuchThreadException) { SessionErrors.add(actionRequest, e.getClass().getName()); } else { throw e; } } }
From source file:com.liferay.portlet.messageboards.action.MoveThreadAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {/*from ww w . j a va 2 s . co m*/ ActionUtil.getThreadMessage(renderRequest); } catch (Exception e) { if (e instanceof NoSuchMessageException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.message_boards.error"); } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.message_boards.move_thread")); }
From source file:com.liferay.portlet.messageboards.action.SplitThreadAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { try {// ww w . j av a 2 s . c o m splitThread(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof PrincipalException || e instanceof RequiredMessageException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.message_boards.error"); } else if (e instanceof MessageBodyException || e instanceof MessageSubjectException || e instanceof NoSuchThreadException || e instanceof SplitThreadException) { SessionErrors.add(actionRequest, e.getClass().getName()); } else { throw e; } } }
From source file:com.liferay.portlet.messageboards.action.SplitThreadAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {// w w w . ja va2s . c o m ActionUtil.getMessage(renderRequest); } catch (Exception e) { if (e instanceof NoSuchMessageException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.message_boards.error"); } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.message_boards.split_thread")); }
From source file:com.liferay.portlet.messageboards.action.ViewAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {/*from w w w.j a v a 2s . c o m*/ ActionUtil.getCategory(renderRequest); } catch (Exception e) { if (e instanceof BannedUserException || e instanceof NoSuchCategoryException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.message_boards.error"); } else { throw e; } } return mapping.findForward("portlet.message_boards.view"); }
From source file:com.liferay.portlet.messageboards.action.ViewMessageAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {/*from ww w . ja va 2 s .com*/ long messageId = ParamUtil.getLong(renderRequest, "messageId"); PortalPreferences preferences = PortletPreferencesFactoryUtil.getPortalPreferences(renderRequest); String threadView = ParamUtil.getString(renderRequest, "threadView"); if (Validator.isNotNull(threadView)) { preferences.setValue(PortletKeys.MESSAGE_BOARDS, "thread-view", threadView); } else { threadView = preferences.getValue(PortletKeys.MESSAGE_BOARDS, "thread-view", PropsValues.MESSAGE_BOARDS_THREAD_VIEWS_DEFAULT); } if (!ArrayUtil.contains(PropsValues.MESSAGE_BOARDS_THREAD_VIEWS, threadView)) { threadView = PropsValues.MESSAGE_BOARDS_THREAD_VIEWS_DEFAULT; preferences.setValue(PortletKeys.MESSAGE_BOARDS, "thread-view", threadView); } boolean includePrevAndNext = PropsValues.MESSAGE_BOARDS_THREAD_PREVIOUS_AND_NEXT_NAVIGATION_ENABLED; MBMessageDisplay messageDisplay = MBMessageServiceUtil.getMessageDisplay(messageId, WorkflowConstants.STATUS_ANY, threadView, includePrevAndNext); renderRequest.setAttribute(WebKeys.MESSAGE_BOARDS_MESSAGE, messageDisplay); return mapping.findForward("portlet.message_boards.view_message"); } catch (Exception e) { if (e instanceof NoSuchMessageException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.message_boards.error"); } else { throw e; } } }
From source file:com.liferay.portlet.mobiledevicerules.action.EditActionAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/*from w w w . jav a 2 s .co m*/ if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateAction(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteAction(actionRequest); } sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.mobile_device_rules.error"); } else if (e instanceof NoSuchActionException || e instanceof NoSuchRuleGroupException) { SessionErrors.add(actionRequest, e.getClass().getName()); } else { throw e; } } }