KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > bin > JahiaAction


1 package org.jahia.bin;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.servlet.ServletException JavaDoc;
6 import javax.servlet.http.HttpServletRequest JavaDoc;
7 import javax.servlet.http.HttpServletResponse JavaDoc;
8
9 import org.apache.struts.action.Action;
10 import org.apache.struts.action.ActionForm;
11 import org.apache.struts.action.ActionForward;
12 import org.apache.struts.action.ActionMapping;
13 import org.jahia.operations.OperationManager;
14 import org.jahia.params.ParamBean;
15
16 /**
17  * Jahia Default Engine Dispatcher Action class
18  *
19  * @author Khue Nguyen
20  */

21 public final class JahiaAction extends Action {
22     private static org.apache.log4j.Logger logger =
23             org.apache.log4j.Logger.getLogger(JahiaAction.class);
24     /**
25     * Process the specified HTTP request, and create the corresponding HTTP
26     * response (or forward to another web component that will create it).
27     * Return an <code>ActionForward</code> instance describing where and how
28     * control should be forwarded, or <code>null</code> if the response has
29     * already been completed.
30     *
31     * @param mapping The ActionMapping used to select this instance
32     * @param actionForm The optional ActionForm bean for this request (if any)
33     * @param request The HTTP request we are processing
34     * @param response The HTTP response we are creating
35     *
36     * @exception IOException if an input/output error occurs
37     * @exception ServletException if a servlet exception occurs
38     */

39     public ActionForward execute(ActionMapping mapping,
40                                  ActionForm form,
41                                  HttpServletRequest JavaDoc request,
42                                  HttpServletResponse JavaDoc response)
43         throws Exception JavaDoc {
44
45         try {
46             // Jahia Engine Default dispatcher
47
OperationManager operations = new OperationManager();
48             ParamBean jParams = (ParamBean)
49                                 request.getAttribute("org.jahia.params.ParamBean");
50             operations.handleOperations (jParams,Jahia.getSettings());
51         } catch ( Throwable JavaDoc t ){
52             logger.error("Error", JahiaErrorDisplay.getNestedException(t));
53             //should redirect to an error page here
54
JahiaErrorDisplay.DisplayException(request, response, servlet.getServletContext(), Jahia.getSettings(), t);
55             request.setAttribute(JahiaErrorDisplay.DISPLAY_JAHIA_ERROR,
56                                  Boolean.FALSE);
57             throw new Exception JavaDoc(t);
58         }
59         return null;
60     }
61
62 }
63
Popular Tags