1 12 13 package org.ejtools.jmx.browser.web.action; 14 15 16 17 import java.io.IOException ; 18 19 import java.util.Locale ; 20 21 22 23 import javax.servlet.ServletContext ; 24 25 import javax.servlet.ServletException ; 26 27 import javax.servlet.http.HttpServletRequest ; 28 29 import javax.servlet.http.HttpServletResponse ; 30 31 32 33 import org.apache.struts.action.Action; 34 35 import org.apache.struts.action.ActionError; 36 37 import org.apache.struts.action.ActionErrors; 38 39 import org.apache.struts.action.ActionForm; 40 41 import org.apache.struts.action.ActionForward; 42 43 import org.apache.struts.action.ActionMapping; 44 45 import org.apache.struts.util.MessageResources; 46 47 import org.ejtools.jmx.browser.web.Constants; 48 49 import org.ejtools.jmx.browser.web.JMXContainer; 50 51 52 53 68 69 public class ClearNotificationAction extends Action 70 71 { 72 73 74 75 public ClearNotificationAction() { } 76 77 78 79 80 81 102 103 public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 104 105 throws IOException , ServletException 106 107 { 108 109 111 Locale locale = getLocale(request); 112 113 MessageResources messages = getResources(); 114 115 116 117 119 ActionErrors errors = new ActionErrors(); 120 121 122 123 ServletContext context = this.getServlet().getServletContext(); 124 125 JMXContainer tree = (JMXContainer) context.getAttribute(Constants.TREE); 126 127 128 129 if (tree != null) 130 131 { 132 133 tree.clearNotifications(); 134 135 } 136 137 else 138 139 { 140 141 errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("web.error.cannot.connect")); 142 143 } 144 145 146 147 149 if (!errors.empty()) 150 151 { 152 153 saveErrors(request, errors); 154 155 return (mapping.findForward("error")); 156 157 } 158 159 160 161 return (mapping.findForward("view")); 162 163 } 164 165 } 166 167 | Popular Tags |