KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > container > struts > PicoTilesRequestProcessor


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * ---------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * ---------------------------------------------------------
30  * $Log: PicoTilesRequestProcessor.java,v $
31  * Revision 1.2 2005/04/22 09:35:23 colinmacleod
32  * Added setup action interface so that
33  * the hibernate action can reset/delete all
34  * actions when the container is reloaded.
35  *
36  * Revision 1.1 2005/04/11 10:18:56 colinmacleod
37  * Added tiles support to request processor.
38  * Updated for new PicoContianerFactory singleton.
39  *
40  * ---------------------------------------------------------
41  */

42 package com.ivata.groupware.container.struts;
43
44 import java.io.IOException JavaDoc;
45
46 import javax.servlet.http.HttpServletRequest JavaDoc;
47 import javax.servlet.http.HttpServletResponse JavaDoc;
48
49 import org.apache.struts.action.Action;
50 import org.apache.struts.action.ActionMapping;
51
52 import com.ivata.groupware.container.PicoContainerFactory;
53 import com.ivata.groupware.struts.SetupAction;
54 import com.ivata.mask.util.SystemException;
55 import com.ivata.mask.web.struts.MaskTilesRequestProcessor;
56
57 /**
58  * <p>
59  * This Struts request processor extends the standard tiles class to instantiate
60  * actions and action forms in a <strong>PicoContainer</strong> friendly way.
61  * </p>
62  *
63  * @author Colin MacLeod
64  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
65  * @since ivata groupware 0.11 (2005-03-11)
66  * @version $Revision: 1.2 $
67  */

68 public class PicoTilesRequestProcessor extends MaskTilesRequestProcessor {
69     /**
70      * Constructor.
71      */

72     public PicoTilesRequestProcessor() throws SystemException {
73         super(PicoContainerFactory.getInstance().getMaskFactory(),
74                 PicoRequestProcessorImplementation.getPersistenceManager());
75         setImplementation(PicoRequestProcessorImplementation
76                 .getRequestProcessorImplementation());
77     }
78     /**
79      * <p>
80      * Overridden to watch out for the setup action and pass the actions to it
81      * so they can be cleared when the setup is finished.
82      * </p>
83      * <p>
84      * (This is drastic but I could not see another way to reset the actions in
85      * <strong>Struts</strong>.)
86      * </p>
87      *
88      * @param request The servlet request we are processing
89      * @param response The servlet response we are creating
90      * @param mapping The mapping we are using
91      *
92      * @exception IOException if an input/output error occurs
93      */

94     protected Action processActionCreate(final HttpServletRequest JavaDoc request,
95             final HttpServletResponse JavaDoc response,
96             final ActionMapping mapping) throws IOException JavaDoc {
97         Action action = super.processActionCreate(request,
98                 response,
99                 mapping);
100         if (action instanceof SetupAction) {
101             SetupAction setupAction = (SetupAction) action;
102             setupAction.setActions(actions);
103         }
104         return action;
105     }
106 }
107
Popular Tags