stopserviceaction.java

来自「First of all, the Applet-phone is a SIP 」· Java 代码 · 共 55 行

JAVA
55
字号
/* * 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 + =
减小字号Ctrl + -
显示快捷键?