1 25 29 package org.jresearch.gossip.actions; 30 31 import javax.servlet.http.HttpServletRequest ; 32 import javax.servlet.http.HttpServletResponse ; 33 34 import org.apache.struts.action.Action; 35 import org.apache.struts.action.ActionForm; 36 import org.apache.struts.action.ActionForward; 37 import org.apache.struts.action.ActionMapping; 38 import org.jresearch.gossip.exception.SystemException; 39 40 44 public class RelayAction extends Action { 45 46 public static final String DISPATCH_PARAM = "dispatch"; 47 48 56 public ActionForward execute(ActionMapping mapping, ActionForm form, 57 HttpServletRequest request, HttpServletResponse response) 58 throws Exception { 59 String dispatch = request.getParameter(DISPATCH_PARAM); 60 if (dispatch == null || dispatch.equals("")) { 61 throw new SystemException(new NullPointerException ( 62 "dispatch param can't be empty")); 63 } 64 ActionForward forward = mapping.findForward(request 65 .getParameter(DISPATCH_PARAM)); 66 if (forward == null) { 67 throw new SystemException(new NullPointerException (" forward '" 68 + dispatch + "' not found")); 69 } 70 return forward; 71 72 } 73 74 } | Popular Tags |