KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > core > actions > AbstractPopupAuthenticatedDispatchAction


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.core.actions;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23 import javax.servlet.http.HttpServletResponse JavaDoc;
24
25 import org.apache.struts.action.ActionForm;
26 import org.apache.struts.action.ActionForward;
27 import org.apache.struts.action.ActionMapping;
28
29 import com.sslexplorer.core.PopupException;
30 import com.sslexplorer.policyframework.Permission;
31 import com.sslexplorer.policyframework.ResourceType;
32 import com.sslexplorer.vfs.webdav.DAVAuthenticationRequiredException;
33
34
35 /**
36  * Abstract implementation of a {@link com.sslexplorer.core.actions.AuthenticatedDispatchAction}
37  * to be used by actions that exist in a popup window instead of the main interface.
38  * <p>
39  * Its primary use is to catch all exceptions and turn them into
40  * {@link com.sslexplorer.core.PopupException}. This is then detected by
41  * the globa error handler which makes sure a different error page is
42  * loaded more suitable for the <i>Popup</i> window it is in.
43  *
44  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
45  */

46 public abstract class AbstractPopupAuthenticatedDispatchAction extends AuthenticatedDispatchAction {
47
48
49     /**
50      * Use this constructor for actions that do not require any resource
51      * permissions
52      */

53     public AbstractPopupAuthenticatedDispatchAction() {
54         super();
55     }
56
57
58     /**
59      * Use this constructor for actions that require a resource permission to
60      * operator
61      *
62      * @param resourceType resource type
63      * @param permissions permission required
64      */

65     public AbstractPopupAuthenticatedDispatchAction(ResourceType resourceType, Permission[] permissions) {
66         super(resourceType, permissions);
67     }
68
69     /**
70      * Use this constructor for actions that require a resource permission to
71      * operator
72      *
73      * @param resourceType resource type
74      * @param permissions permission required
75      * @param requiresResources requires access to resources of type
76      */

77     public AbstractPopupAuthenticatedDispatchAction(ResourceType resourceType, Permission[] permissions,
78                                                     ResourceType requiresResources) {
79         super(resourceType, permissions, requiresResources);
80     }
81
82
83     /* (non-Javadoc)
84      * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
85      */

86     public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
87         try {
88             return super.execute(mapping, form, request, response);
89         }
90         catch(DAVAuthenticationRequiredException dare) {
91             // let this go through
92
throw dare;
93         }
94         catch(Throwable JavaDoc t) {
95             throw new PopupException(t);
96         }
97     }
98
99 }
100
Popular Tags