KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > setup > actions > MessageQueueInformationAction


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.setup.actions;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23 import javax.servlet.http.HttpServletResponse JavaDoc;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27 import org.apache.struts.action.ActionForm;
28 import org.apache.struts.action.ActionForward;
29 import org.apache.struts.action.ActionMapping;
30
31 import com.sslexplorer.core.CoreServlet;
32 import com.sslexplorer.core.actions.AuthenticatedDispatchAction;
33 import com.sslexplorer.extensions.actions.ExtensionBundleInformationAction;
34 import com.sslexplorer.notification.Notifier;
35 import com.sslexplorer.notification.Notifier.MessageWrapper;
36 import com.sslexplorer.security.Constants;
37 import com.sslexplorer.security.SessionInfo;
38 import com.sslexplorer.setup.forms.MessageQueueInformationForm;
39
40 /**
41  */

42 public final class MessageQueueInformationAction extends AuthenticatedDispatchAction {
43    
44     final static Log log = LogFactory.getLog(MessageQueueInformationAction.class);
45
46     /* (non-Javadoc)
47      * @see org.apache.struts.actions.DispatchAction#unspecified(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
48      */

49     public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
50             try {
51                 long messageId = Long.parseLong(request.getParameter("messageId"));
52                 MessageWrapper message = CoreServlet.getServlet().getNotifier().getMessage(messageId);
53                 request.setAttribute(Constants.REQ_ATTR_INFO_RESOURCE, message);
54                 return messageQueueInformation(mapping, form, request, response);
55             } catch (Exception JavaDoc e) {
56               log.error("Failed to get message information. ", e);
57               response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
58             }
59             return null;
60         }
61         
62     /**
63      * @param mapping
64      * @param form
65      * @param request
66      * @param response
67      * @return ActionForward
68      * @throws Exception
69      */

70     public ActionForward messageQueueInformation(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
71         MessageQueueInformationForm informationForm = (MessageQueueInformationForm) form;
72         Notifier.MessageWrapper messageWrapper = (Notifier.MessageWrapper) request.getAttribute(Constants.REQ_ATTR_INFO_RESOURCE);
73         informationForm.initialise(messageWrapper);
74         return mapping.findForward("display");
75     }
76     
77     /* (non-Javadoc)
78      * @see com.sslexplorer.core.actions.CoreAction#getNavigationContext(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
79      */

80     public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) {
81         return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT;
82     }
83 }
Popular Tags