KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > api > components > ComponentAction


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3.api.components;
7
8 import java.io.IOException JavaDoc;
9
10 import javax.servlet.ServletException JavaDoc;
11 import javax.servlet.http.*;
12
13 import org.apache.struts.action.*;
14
15 import com.raptus.owxv3.*;
16 import com.raptus.owxv3.api.OmniaWebAction;
17
18 /**
19  *
20  * <hr>
21  * <table width="100%" border="0">
22  * <tr>
23  * <td width="24%"><b>Filename</b></td><td width="76%">ComponentAction.java</td>
24  * </tr>
25  * <tr>
26  * <td width="24%"><b>Author</b></td><td width="76%">Guy Z�rcher (gzuercher@raptus.com)</td>
27  * </tr>
28  * <tr>
29  * <td width="24%"><b>Date</b></td><td width="76%">28th of June 2001</td>
30  * </tr>
31  * </table>
32  * <hr>
33  * <table width="100%" border="0">
34  * <tr>
35  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
36  * </tr>
37  * </table>
38  * <hr>
39  */

40 public class ComponentAction extends OmniaWebAction
41 {
42     /**
43      * Process the specified HTTP request, and create the corresponding HTTP
44      * response (or forward to another web component that will create it).
45      * Return an <code>ActionForward</code> instance describing where and how
46      * control should be forwarded, or <code>null</code> if the response has
47      * already been completed.
48      *
49      * @param mapping The ActionMapping used to select this instance
50      * @param actionForm The optional ActionForm bean for this request (if any)
51      * @param request The HTTP request we are processing
52      * @param response The HTTP response we are creating
53      *
54      * @exception IOException if an input/output error occurs
55      * @exception ServletException if a servlet exception occurs
56      */

57     public ActionForward perform(ActionMapping mapping,
58                  ActionForm form,
59                  HttpServletRequest request,
60                  HttpServletResponse response)
61     throws IOException JavaDoc, ServletException JavaDoc
62     {
63         HttpSession session = request.getSession();
64         com.raptus.owxv3.api.usermgr.User user= checkForUserInSession(session);
65         if(user == null)
66         {
67             LoggingManager.log("Cannot find user in session. Displaying login screen.", this);
68             return mapping.findForward(Constants.SCREEN_LOGIN);
69         }
70
71         ActionForward myFwd = new ActionForward();
72         if(form != null)
73         {
74             ComponentContainer cc = ((ComponentBean) form).getContainer();
75             if(cc != null)
76             {
77                 myFwd.setName(ComponentConstants.COMPONENT_FWD_TEMPORARY);
78                 myFwd.setPath(cc.getURI());
79 // who/when/why?
80
// myFwd.setRedirect(true);
81
myFwd.setRedirect(false);
82                 dispatchComponent(request, (ComponentBean) form);
83             }
84         }
85
86         return myFwd;
87     }
88
89     /**
90      *
91      */

92     public void dispatchComponent(HttpServletRequest request,
93                                   ComponentBean cbean)
94     {
95     }
96
97 }
98
99 // eof
100
Popular Tags