KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > webui > actions > BaseAction


1 /**
2  * Copyright 2004-2005 jManage.org
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.jmanage.webui.actions;
17
18 import org.apache.struts.action.Action;
19 import org.apache.struts.action.ActionForward;
20 import org.apache.struts.action.ActionMapping;
21 import org.apache.struts.action.ActionForm;
22 import org.jmanage.webui.util.WebContext;
23 import org.jmanage.core.util.ACLConstants;
24
25 import javax.servlet.http.HttpServletRequest JavaDoc;
26 import javax.servlet.http.HttpServletResponse JavaDoc;
27
28 /**
29  *
30  * date: Jun 6, 2004
31  * @author Rakesh Kalra
32  */

33 public abstract class BaseAction extends Action implements ACLConstants{
34
35     public final ActionForward execute(ActionMapping mapping,
36                                        ActionForm actionForm,
37                                        HttpServletRequest JavaDoc request,
38                                        HttpServletResponse JavaDoc response)
39             throws Exception JavaDoc {
40         WebContext context = WebContext.get(request);
41         return execute(context, mapping, actionForm, request, response);
42     }
43
44     public abstract ActionForward execute(WebContext context,
45                                           ActionMapping mapping,
46                                           ActionForm actionForm,
47                                           HttpServletRequest JavaDoc request,
48                                           HttpServletResponse JavaDoc response)
49             throws Exception JavaDoc;
50
51
52     /**
53      * Sets the response headers, so that this page is not cached.
54      */

55     protected static void makeResponseNotCacheable(HttpServletResponse JavaDoc response) {
56         response.setHeader("Pragma", "No-cache");
57         response.setDateHeader("Expires", 0);
58         response.setHeader("Cache-Control", "no-cache");
59     }
60 }
61
Popular Tags