[Yanel-commits] rev 42098 - public/yanel/trunk/tools/apache-tomcat

guillaume at wyona.com guillaume at wyona.com
Mon Mar 23 09:29:11 CET 2009


Author: guillaume
Date: 2009-03-23 09:29:11 +0100 (Mon, 23 Mar 2009)
New Revision: 42098

Added:
   public/yanel/trunk/tools/apache-tomcat/configure-Tomcat-server.xslt
Log:
Simple script to change HTTP and SSL ports in Tomcat's server.xml configuration files.
Tested with Tomcat 5.5.20 but should work with Tomcat 5 and 6 as well.
Hopefully should work for all configurations in the wild.

Example of use: xsltproc --stringparam host localhost --stringparam ssl-port 8543 --stringparam http-port 8180 tools/apache-tomcat/configure-Tomcat-server.xslt local/apache-tomcat-5.5.20/conf/server.xml > new.server.xml

Issue: 6888


Copied: public/yanel/trunk/tools/apache-tomcat/configure-Tomcat-server.xslt (from rev 42077, public/yanel/trunk/src/build/connector.xsl)
===================================================================
--- public/yanel/trunk/tools/apache-tomcat/configure-Tomcat-server.xslt	                        (rev 0)
+++ public/yanel/trunk/tools/apache-tomcat/configure-Tomcat-server.xslt	2009-03-23 08:29:11 UTC (rev 42098)
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  
+  <xsl:output method="xml" indent="yes"/>
+  
+  <xsl:param name="host" select="'localhost'"/>
+  <xsl:param name="ssl-port" select="'NULL_SSL_PORT'"/>
+  <xsl:param name="http-port" select="'NULL_HTTP_PORT'"/>
+  
+  <xsl:template match="/">
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:template>
+  
+  <xsl:template match="Connector[(not(@protocol)) and (not(@secure) or @secure != 'true')]">
+    <xsl:copy> 
+      <xsl:copy-of select="@*"/>
+    <!--xsl:if test="../Engine[1]"-->
+    <xsl:if test="../Engine[1]//Host[@name = $host]">
+      <xsl:attribute name="port">
+        <xsl:value-of select="$http-port"/>
+      </xsl:attribute>
+    </xsl:if>
+      <xsl:copy-of select="node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="Connector[@secure = 'true']">
+    <xsl:copy> 
+      <xsl:copy-of select="@*"/>
+    <xsl:if test="../Engine[1]//Host[@name = $host]">
+      <xsl:attribute name="port">
+        <xsl:value-of select="$ssl-port"/>
+      </xsl:attribute>
+    </xsl:if>
+      <xsl:copy-of select="node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+</xsl:stylesheet>


Property changes on: public/yanel/trunk/tools/apache-tomcat/configure-Tomcat-server.xslt
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native



More information about the Yanel-commits mailing list