1
14
15 package com.liferay.portlet.messageboards.action;
16
17 import com.liferay.portal.kernel.servlet.SessionErrors;
18 import com.liferay.portal.security.auth.PrincipalException;
19 import com.liferay.portal.struts.PortletAction;
20 import com.liferay.portlet.messageboards.BannedUserException;
21 import com.liferay.portlet.messageboards.NoSuchCategoryException;
22
23 import javax.portlet.PortletConfig;
24 import javax.portlet.RenderRequest;
25 import javax.portlet.RenderResponse;
26
27 import org.apache.struts.action.ActionForm;
28 import org.apache.struts.action.ActionForward;
29 import org.apache.struts.action.ActionMapping;
30
31
36 public class ViewAction extends PortletAction {
37
38 public ActionForward render(
39 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
40 RenderRequest renderRequest, RenderResponse renderResponse)
41 throws Exception {
42
43 try {
44 ActionUtil.getCategory(renderRequest);
45 }
46 catch (Exception e) {
47 if (e instanceof BannedUserException ||
48 e instanceof NoSuchCategoryException ||
49 e instanceof PrincipalException) {
50
51 SessionErrors.add(renderRequest, e.getClass().getName());
52
53 return mapping.findForward("portlet.message_boards.error");
54 }
55 else {
56 throw e;
57 }
58 }
59
60 return mapping.findForward("portlet.message_boards.view");
61 }
62
63 }