tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat/src/admin/contextAdmin contextAdd.jsp contextAdmin.html contextList.jsp contextRemove.jsp ctxDetail.jsp sessionState.jsp
Date Fri, 04 Apr 2003 06:33:20 GMT
billbarker    2003/04/03 22:33:20

  Modified:    src/admin/WEB-INF admin.tld
               src/admin/WEB-INF/classes/tadm TomcatAdmin.java
               src/admin/contextAdmin contextAdd.jsp contextAdmin.html
                        contextList.jsp contextRemove.jsp ctxDetail.jsp
                        sessionState.jsp
  Log:
  New impovments to the admin web-app.
  
  These include support for vhosts, and a 'Reload' option.
  
  The 'Reload' still needs a bit of work (e.g. steal the code from ReloadInterceptor), but
it's ok for non-configured web-apps.
  
  Submitted By: Zorro zorro.desbois@wanadoo.fr
  
  Revision  Changes    Path
  1.10      +4 -0      jakarta-tomcat/src/admin/WEB-INF/admin.tld
  
  Index: admin.tld
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/WEB-INF/admin.tld,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- admin.tld	23 Mar 2001 02:14:16 -0000	1.9
  +++ admin.tld	4 Apr 2003 06:33:20 -0000	1.10
  @@ -28,6 +28,10 @@
         <required>false</required>
       </attribute>
       <attribute>
  +      <name>ctxHostParam</name>
  +      <required>false</required>
  +    </attribute>
  +    <attribute>
         <name>ctxPathParam</name>
         <required>false</required>
       </attribute>
  
  
  
  1.14      +24 -6     jakarta-tomcat/src/admin/WEB-INF/classes/tadm/TomcatAdmin.java
  
  Index: TomcatAdmin.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/WEB-INF/classes/tadm/TomcatAdmin.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TomcatAdmin.java	31 Jan 2002 03:38:28 -0000	1.13
  +++ TomcatAdmin.java	4 Apr 2003 06:33:20 -0000	1.14
  @@ -18,8 +18,10 @@
    */
   public class TomcatAdmin extends TagSupport {
       private ContextManager cm;
  +    String ctxHost;
       String ctxPath;
       String docBase;
  +    String ctxHostParam;
       String ctxPathParam;
       String docBaseParam;
       String action;
  @@ -39,6 +41,11 @@
   	    }
   	    pageContext.setAttribute("cm", cm);
   	    Context ctx=null;
  +	    if( ctxHost == null && ctxHostParam != null) {
  +		ctxHost=req.getParameter( ctxHostParam );
  +		if( "".equals(ctxHost) )
  +		    ctxHost=null;
  +	    }
   	    if( ctxPath==null && ctxPathParam!=null ) {
   		ctxPath=req.getParameter( ctxPathParam );
   	    }
  @@ -48,7 +55,7 @@
   
   	    boolean found = false;
   	    if( ctxPath != null ) {
  -		System.out.println("Finding " + ctxPath );
  +		System.out.println("Finding host: "+ ctxHost + ",path=" + ctxPath );
   		if( ! ctxPath.startsWith("/") )
   		    ctxPath = "/" + ctxPath;
   		if( ctxPath.equals("/") )
  @@ -58,10 +65,13 @@
   		    ctx=(Context)en.nextElement();
   		    // XXX virtual host
   		    if( ctxPath.equals( ctx.getPath())) {
  -			found=true;
  -			pageContext.setAttribute("ctx", ctx);
  -			System.out.println("Found " + ctx );
  -			break;
  +			if( (ctxHost == null && ctx.getHost() == null ) ||
  +			    (ctxHost != null && ctxHost.equals(ctx.getHost()))){
  +			    found=true;
  +			    pageContext.setAttribute("ctx", ctx);
  +			    System.out.println("Found " + ctx );
  +			    break;
  +			} 
   		    }
   		}
   	    }
  @@ -70,7 +80,11 @@
   	    if("setLogger".equals( action ) )
   		setLogFile(  ctx, value );
   	    if("addContext".equals( action ) )
  -		addContext( cm, host, ctxPath, docBase );
  +		addContext( cm, ctxHost, ctxPath, docBase );
  +	    if("restartContext".equals(action) && found) {
  +		removeContext(cm, ctx);
  +		addContext( cm, ctxHost, ctxPath, docBase);
  +	    }
   	} catch (Exception ex ) {
   	    ex.printStackTrace();
   	}
  @@ -118,6 +132,9 @@
   	this.host=host;
       }
   
  +    public void setCtxHostParam( String hostP ) {
  +	this.ctxHostParam = hostP;
  +    }
       public void setAction( String action ) {
   	this.action=action;
       }
  @@ -167,6 +184,7 @@
   	System.out.println("Adding " + path + " " + docBase);
   	Context context = new Context();
   	context.setContextManager(cm);
  +	context.setHost(host);
   	context.setPath(path);
   	context.setDocBase(docBase);
   
  
  
  
  1.2       +6 -3      jakarta-tomcat/src/admin/contextAdmin/contextAdd.jsp
  
  Index: contextAdd.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/contextAdmin/contextAdd.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- contextAdd.jsp	27 Dec 2000 21:41:31 -0000	1.1
  +++ contextAdd.jsp	4 Apr 2003 06:33:20 -0000	1.2
  @@ -9,16 +9,19 @@
   
   <head>
   
  -    <title>Context remove</title>
  +    <title>Context Add</title>
   </head>
   
   <body bgcolor="white">
   
  -<h3>Adding <%= request.getParameter("addContextPath") %> </h3>
  +<h3>Adding <%= ("".equals(request.getParameter("addContextHost")) ? 
  +	"localhost" : request.getParameter("addContextHost") ) 
  +	%>:<%= request.getParameter("addContextPath") %> </h3>
   
   <adm:admin ctxPathParam="addContextPath"
  +	   ctxHostParam="addContextHost"
              docBaseParam="addContextDocBase"
              action="addContext" />
  -
  +<a href="contextList.jsp">Return to Context List</a>
   </body>
   </html>
  
  
  
  1.4       +20 -18    jakarta-tomcat/src/admin/contextAdmin/contextAdmin.html
  
  Index: contextAdmin.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/contextAdmin/contextAdmin.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- contextAdmin.html	31 Jan 2002 03:38:29 -0000	1.3
  +++ contextAdmin.html	4 Apr 2003 06:33:20 -0000	1.4
  @@ -13,14 +13,14 @@
   <table border=0 cellspacing=5>
     <tr>
       <td><a href="/">
  -        <img SRC="../../tomcat.gif" height=92 width=130 align=LEFT border=0 alt="Tomcat
Home Page"></a>
  -    <td valign=center><h2>Context Administration</h2>
  +        <img SRC="../../tomcat.gif" height=92 width=130 align=LEFT border=0 alt="Tomcat
Home Page"></a></td>
  +    <td valign=center><h2>Context Administration</h2></td>
     </tr>
     <tr>
         <td valign=top align=center>
           <b><font face="Arial, Helvetica, sans-serif" size=-5>
           <a href="/admin">Admin Home Page</a>
  -        </b></font>
  +        </b></font></td>
     </tr>
   </table>
   
  @@ -29,34 +29,36 @@
   
   <table border=0 cellspacing=5>
     <tr>
  -    <td><td>
  +    <td></td><td>
   	  <FORM type=POST action="contextList.jsp">
   	    <INPUT TYPE=submit name="submit" value="View All Contexts">
  -	  </FORM>
  +	  </FORM></td>
     </tr>
     <tr>
  -    <td><td>
  -    <td><td>Path:
  -    <td><td>Document Base:
  +    <td></td><td></td>
  +    <td></td><td>Host:</td>
  +    <td></td><td>Path:</td>
  +    <td></td><td>Document Base:</td>
     </tr>
     <tr>
       <form type=POST action=contextAdd.jsp>
  -    <td><td><INPUT TYPE=submit name="submit" value="Add Context">
  -    <td><td><INPUT TYPE=text name="addContextPath" size=20>
  -    <td><td><INPUT TYPE=text name="addContextDocBase" size=20>
  -    <td><td>
  +    <td></td><td><INPUT TYPE=submit name="submit" value="Add Context"></td>
  +    <td></td><td><INPUT TYPE=text name="addContextHost" size=20></td>
  +    <td></td><td><INPUT TYPE=text name="addContextPath" size=20></td>
  +    <td></td><td><INPUT TYPE=text name="addContextDocBase" size=20></td>
  +    <td></td><td></td>
       </form>
     </tr>
     <tr>
  -    <td><td>
  -    <td><td>Context Name:
  -    <td><td>Virtual host:
  +    <td></td><td></td>
  +    <td></td><td>Context Name:</td>
  +    <td></td><td>Virtual host:</td>
     </tr>
     <tr>
       <form type=POST action=contextRemove.jsp>
  -    <td><td><INPUT TYPE=submit name="submit" value="Remove Context">
  -    <td><td><INPUT TYPE=text name="removeContextName" size=20>
  -    <td><td><INPUT TYPE=text name="virtualHost" size=20>
  +    <td></td><td><INPUT TYPE=submit name="submit" value="Remove Context"></td>
  +    <td></td><td><INPUT TYPE=text name="removeContextName" size=20></td>
  +    <td></td><td><INPUT TYPE=text name="virtualHost" size=20></td>
       </form>
     </tr>
   </table>
  
  
  
  1.4       +39 -8     jakarta-tomcat/src/admin/contextAdmin/contextList.jsp
  
  Index: contextList.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/contextAdmin/contextList.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- contextList.jsp	22 Sep 2001 23:55:47 -0000	1.3
  +++ contextList.jsp	4 Apr 2003 06:33:20 -0000	1.4
  @@ -15,12 +15,24 @@
   
   <body bgcolor="white">
   
  -<adm:admin/>
  +<adm:admin ctxHostParam="ContextHost"
  +           ctxPathParam="ContextPath"
  +           docBaseParam="ContextDocBase"
  +           action="action" />
   
   <h3>Web applications</h3>
   
  +  <table border="0">
  +   <tr>
  +     <form method=POST action=contextsRestart.jsp>
  +     <td><INPUT TYPE=submit name="submit" value="Restart All contexts"></td>
  +     </form>
  +   </tr>
  +  </table>
  +
     <table border="0" cellpad="2" >
     <tr bgcolor="#e1e1e1">
  +    <th>Host</td>
       <th>path</th>
       <th>docBase </th>
     </tr>
  @@ -28,25 +40,44 @@
     <adm:iterate name="context" enumeration="<%= cm.getContexts() %>" 
                  type="org.apache.tomcat.core.Context" >
         <tr>
  -      <td> <a href="ctxDetail.jsp?ctx=<%= context.getPath() %>"> 
  +      <td><%= (context.getHost() == null) ? "localhost" : context.getHost() %></td>

  +      <td> <a href="ctxDetail.jsp?ctx=<%= context.getPath() %>&host=<%=
(context.getHost() == null) ? "" : context.getHost() %>">
   		<%= ("".equals( context.getPath() )) ? "ROOT" :  context.getPath() %>
              </a></td>
         <td> <%= context.getDocBase() %> </td>
         <td>
  -	<a href="contextRemove.jsp?removeContextName=<%= context.getPath() %>">
  -            remove
  -	</a>
  -      </td>
  -      <td>
   	<form method="POST" action="contextRemove.jsp" >
   	     <INPUT TYPE=hidden name="removeContextName" 
   		    value="<%= context.getPath() %>">
   	     <INPUT TYPE=submit name="submit" value="Remove">
  +	     <INPUT TYPE=hidden name="removeHost" 
  +	          value="<%= (context.getHost() == null) ? "" : context.getHost() %>">
   	   </form>
         </td>
  +      <td>
  +         <form method="POST" action="contextRestart.jsp">
  +           <INPUT TYPE=hidden name="restartHost" 
  +                value="<%= (context.getHost() == null) ? "" : context.getHost() %>">
  +          <INPUT TYPE=hidden name="restartContextName"
  +               value="<%= context.getPath() %>">
  +          <INPUT TYPE=hidden name="restartContextDocBase"
  +               value="<%= context.getDocBase() %>">
  +          <INPUT TYPE=submit name=submit value="Restart">
  +         </form>
  +       </td>
         </tr>
     </adm:iterate>
  -
  +   <tr>
  +       <form method="POST" action="contextAdd.jsp">
  +       <td><INPUT type=text name="addContextHost" size=20></td>
  +       <td><INPUT type=text name="addContextPath" size=20></td>
  +       <td><INPUT type=text name="addContextDocBase" size=40>
  +           <INPUT type=hidden name="action" value="addContext"></td>
  +       <td>&nbsp;</td>
  +       <td><INPUT type=submit name="submit" value="Add Context"></td>
  +       </form>
  +    </tr>
  +       
     </table>
   
   </body>
  
  
  
  1.2       +3 -1      jakarta-tomcat/src/admin/contextAdmin/contextRemove.jsp
  
  Index: contextRemove.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/contextAdmin/contextRemove.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- contextRemove.jsp	27 Dec 2000 21:41:31 -0000	1.1
  +++ contextRemove.jsp	4 Apr 2003 06:33:20 -0000	1.2
  @@ -15,9 +15,11 @@
   <body bgcolor="white">
   
   <h3>Removing <%= request.getParameter("removeContextName") %> </h3>
  -<%= request.getParameter("removeContextName") %>
  +<!-- <%= request.getParameter("removeContextName") %> -->
   <adm:admin ctxPathParam="removeContextName"
  +           ctxHostParam="removeHost"
              action="removeContext" />
   
  +<a href="contextList.jsp">Return to Context List</a>
   </body>
   </html>
  
  
  
  1.4       +5 -3      jakarta-tomcat/src/admin/contextAdmin/ctxDetail.jsp
  
  Index: ctxDetail.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/contextAdmin/ctxDetail.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ctxDetail.jsp	23 Mar 2001 02:14:17 -0000	1.3
  +++ ctxDetail.jsp	4 Apr 2003 06:33:20 -0000	1.4
  @@ -4,12 +4,12 @@
   
   <head>
   
  -    <title>Context list</title>
  +    <title>Context Detail</title>
   </head>
   
   <body bgcolor="white">
   
  -<adm:admin ctxPathParam="ctx" />
  +<adm:admin ctxPathParam="ctx" ctxHostParam="host" />
   
   <%
     if( ctx==null ) {
  @@ -17,7 +17,9 @@
     <h1>Error, no context for <%= request.getParameter( "ctx" ) %> </h1>
   <% } else { %>
   
  -  <a href="sessionState.jsp?ctx=<%= request.getParameter( "ctx" ) %>">Session
info</a>
  +  <a href="sessionState.jsp?ctx=<%= request.getParameter( "ctx" ) %>&host=<%=
  +           request.getParmeter("host") == null ? "" : 
  +	     request.getParameter("host")">Session info</a>
     <table border="0" cellpad="2" >
     <tr bgcolor="#e1e1e1">
   
  
  
  
  1.2       +1 -1      jakarta-tomcat/src/admin/contextAdmin/sessionState.jsp
  
  Index: sessionState.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/contextAdmin/sessionState.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sessionState.jsp	23 Mar 2001 02:14:17 -0000	1.1
  +++ sessionState.jsp	4 Apr 2003 06:33:20 -0000	1.2
  @@ -7,7 +7,7 @@
   
   <body bgcolor="white">
   
  -<adm:admin ctxPathParam="ctx"/>
  +<adm:admin ctxPathParam="ctx" ctxHostParams="host" />
   <adm:moduleAdmin var="store" 
   		 type="org.apache.tomcat.modules.session.SimpleSessionStore" />
   
  
  
  

---------------------------------------------------------------------
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