KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > views > engines > AbstractEngineAction


1 package org.jahia.views.engines;
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.ActionMessages;
11 import org.apache.struts.action.ActionForm;
12 import org.apache.struts.action.ActionForward;
13 import org.apache.struts.action.ActionMapping;
14
15 /**
16  *
17  * <p>Title: Abstract Engine Action Class</p>
18  * <p>Description: </p>
19  * <p>Copyright: Copyright (c) 2003</p>
20  * <p>Company: Jahia</p>
21  * @author Khue Nguyen
22  * @version 1.0
23  */

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

41     public abstract ActionForward execute(ActionMapping mapping,
42                                  ActionForm form,
43                                  HttpServletRequest JavaDoc request,
44                                  HttpServletResponse JavaDoc response)
45                                  throws IOException JavaDoc, ServletException JavaDoc;
46
47
48     /**
49      * Is the current session valid. Does it contain initialized session objects
50      * or not ?
51      *
52      * @param request
53      * @return
54      */

55     public abstract boolean isSessionValid(HttpServletRequest JavaDoc request);
56
57     /**
58      * Default errors Action Forward. If no errors, return a null ActionForward.
59      *
60      * @param mapping
61      * @param request
62      * @param errors
63      * @return
64      */

65     public ActionForward errorsForward(ActionMapping mapping,
66                                        HttpServletRequest JavaDoc request,
67                                        ActionMessages errors){
68         if(errors != null && !errors.isEmpty()){
69             saveErrors(request,errors);
70             return (new ActionForward(mapping.getInput()));
71         }
72         return null;
73     }
74
75     /**
76      * Default implementation for logging an exception.
77      *
78      * Do a call to servlet.log(msg,ex)
79      *
80      * @param msg
81      * @param ex
82      */

83     public void loggingException(String JavaDoc msg, Exception JavaDoc ex){
84         servlet.log(msg,ex);
85     }
86
87     /**
88      * Default implementation for logging a message.
89      *
90      * Do a call to servlet.log(msg)
91      *
92      * @param msg
93      * @param ex
94      */

95     public void loggingMsg(String JavaDoc msg){
96         servlet.log(msg);
97     }
98
99 }
100
Popular Tags