📄 stopserviceaction.java
字号:
/* * StopServiceAction.java * * Created on July 21, 2003, 3:01 PM */package gov.nist.struts.webapp.monitor;import java.util.Hashtable;import javax.servlet.ServletContext;import gov.nist.security.authentication.UserTag;import gov.nist.security.bcs.Service;import org.apache.log4j.Logger;/** * This class represents the process of stopping a service * @author DERUELLE Jean */public class StopServiceAction extends org.apache.struts.action.Action { /** log4j logging*/ static Logger logger = Logger.getLogger(StopServiceAction.class); /** * @see org.apache.struts.action.Action#perform(org.apache.struts.action.ActionMapping actionMapping, org.apache.struts.action.ActionForm actionForm, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) */ public org.apache.struts.action.ActionForward perform(org.apache.struts.action.ActionMapping actionMapping, org.apache.struts.action.ActionForm actionForm, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) throws java.io.IOException, javax.servlet.ServletException { ServiceForm startServiceForm=(ServiceForm)actionForm; //Get the file name String mainClass=startServiceForm.getMainClass(); String userURI=startServiceForm.getUserURI(); //Get the application context ServletContext applicationContext=this.getServlet().getServletContext(); //Get the user from the session context UserTag userTag=(UserTag)httpServletRequest.getSession().getAttribute("user"); //String sipURI=userTag.getUri(); //Stop the stack before Hashtable monitors=(Hashtable)applicationContext.getAttribute("monitors"); //stop the service Service service=(Service)monitors.get(mainClass+":"+userURI); if(service!=null){ Process process=service.getProcess(); if(process!=null) process.destroy(); } if(userTag.getUserGroup().equals("admin")) return actionMapping.findForward("stopped_admin"); return actionMapping.findForward("stopped"); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -