tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/admin/host host.jsp hosts.jsp
Date Mon, 03 Feb 2003 23:16:53 GMT
amyroh      2003/02/03 15:16:52

  Modified:    webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        Lists.java
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host
                        DeleteHostAction.java EditHostAction.java
               webapps/admin/host host.jsp hosts.jsp
  Log:
  Port change.
  
  Revision  Changes    Path
  1.3       +34 -4     jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.java
  
  Index: Lists.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Lists.java	16 Sep 2002 04:46:18 -0000	1.2
  +++ Lists.java	3 Feb 2003 23:16:52 -0000	1.3
  @@ -696,4 +696,34 @@
       }
   
   
  +    /**
  +     * Return the  <code>Host</code> object name string
  +     * that the admin app belongs to.
  +     *
  +     * @param mbserver MBeanServer from which to retrieve the list
  +     * @param request Http request
  +     *
  +     * @exception Exception if thrown while retrieving the list
  +     */
  +    public static String getAdminAppHost
  +        (MBeanServer mbserver, String domain, HttpServletRequest request)
  +        throws Exception {
  +
  +        // Get the admin app's host name
  +        StringBuffer sb = new StringBuffer(domain);
  +        sb.append(":type=Context");
  +        sb.append(",path=");
  +        sb.append(request.getContextPath());
  +        sb.append(",*");
  +        ObjectName search = new ObjectName(sb.toString());
  +        Iterator names = mbserver.queryNames(search, null).iterator();
  +        String host = null;
  +        while (names.hasNext()) {
  +            host = ((ObjectName)names.next()).getKeyProperty("host");
  +        }
  +        return host;
  +
  +    }
  +
  +
   }
  
  
  
  1.2       +21 -4     jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostAction.java
  
  Index: DeleteHostAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeleteHostAction.java	18 Jul 2002 16:48:25 -0000	1.1
  +++ DeleteHostAction.java	3 Feb 2003 23:16:52 -0000	1.2
  @@ -90,6 +90,7 @@
   import org.apache.struts.util.MessageResources;
   
   import org.apache.webapp.admin.ApplicationServlet;
  +import org.apache.webapp.admin.Lists;
   import org.apache.webapp.admin.TomcatTreeBuilder;
   
   /**
  @@ -153,6 +154,22 @@
               ("Cannot acquire MBeanServer reference", t);
           }
           
  +        String adminHost = null;
  +        // Get the host name the admin app runs on
  +        // this host cannot be deleted from the admin tool
  +        try {
  +            adminHost = Lists.getAdminAppHost(
  +                                  mBServer, "Catalina" ,request);
  +        } catch (Exception e) {
  +            String message =
  +                resources.getMessage("error.hostName.bad",
  +                                        adminHost);
  +            getServlet().log(message);
  +            response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
  +            return (null);
  +        }
  +        request.setAttribute("adminAppHost", adminHost);
  +                
           String serviceName = request.getParameter("serviceName");
           // Set up a form bean containing the currently selected
           // objects to be deleted
  
  
  
  1.4       +20 -4     jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/EditHostAction.java
  
  Index: EditHostAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/EditHostAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EditHostAction.java	16 Sep 2002 04:46:18 -0000	1.3
  +++ EditHostAction.java	3 Feb 2003 23:16:52 -0000	1.4
  @@ -147,6 +147,22 @@
               ("Cannot acquire MBeanServer reference", t);
           }
   
  +        String adminHost = null;
  +        // Get the host name the admin app runs on
  +        // this host cannot be deleted from the admin tool
  +        try {
  +            adminHost = Lists.getAdminAppHost(
  +                                  mBServer, "Catalina" ,request);
  +        } catch (Exception e) {
  +            String message =
  +                resources.getMessage("error.hostName.bad",
  +                                        adminHost);
  +            getServlet().log(message);
  +            response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
  +            return (null);
  +        }
  +        request.setAttribute("adminAppHost", adminHost);
  +        
           // Set up the object names of the MBeans we are manipulating
           ObjectName hname = null;
           StringBuffer sb = null;
  
  
  
  1.7       +1 -1      jakarta-tomcat-catalina/webapps/admin/host/host.jsp
  
  Index: host.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/host/host.jsp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- host.jsp	23 Jan 2003 00:07:08 -0000	1.6
  +++ host.jsp	3 Feb 2003 23:16:52 -0000	1.7
  @@ -78,7 +78,7 @@
                                     URLEncoder.encode(thisObjectName) %>'>
                   <bean:message key="actions.defaultcontexts.deletes"/>
               </controls:action-->                        
  -            <logic:notEqual name="hostName" value='<%= request.getServerName() %>'>
  +            <logic:notEqual name="hostName" value='<%= (String)request.getAttribute("adminAppHost")
%>'>
               <controls:action disabled="true">
                   -------------------------------------
               </controls:action>
  
  
  
  1.4       +9 -5      jakarta-tomcat-catalina/webapps/admin/host/hosts.jsp
  
  Index: hosts.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/host/hosts.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- hosts.jsp	23 Jan 2003 00:07:08 -0000	1.3
  +++ hosts.jsp	3 Feb 2003 23:16:52 -0000	1.4
  @@ -57,14 +57,18 @@
           <logic:iterate name="hostsList" id="host">
             <tr class="line-row">
               <td><div align="left" class="table-normal-text">&nbsp;
  -              <logic:match name="host" value='<%= "host="+request.getServerName()+","
%>'>
  -                <font color='red'>*</font>
  -              </logic:match>
  -              <logic:notMatch name="host" value='<%= "host="+request.getServerName()+","
%>'>
  -              <label for="hosts"></label>
  +            
  +             <logic:match name="host"
  +                        value='<%= (String)request.getAttribute("adminAppHost") %>'>
  +             <font color='red'>*</font>
  +             </logic:match>
  +             <logic:notMatch name="host"
  +                        value='<%= (String)request.getAttribute("adminAppHost") %>'>
  +              <label for="hosts"></label>          
                 <html:multibox property="hosts"
                                   value="<%= host.toString() %>" styleId="hosts"/>
                 </logic:notMatch>
  +              
               </div></td>
               <td><div align="left" class="table-normal-text">&nbsp;
                 <html:link page='<%= "/EditHost.do?select=" +
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message