[tomcat] branch 9.0.x updated: Update to CXF 3.4.0

2020-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 199f501  Update to CXF 3.4.0
199f501 is described below

commit 199f501ad225154fcb8a307ddd645f83bd6dada8
Author: remm 
AuthorDate: Thu Sep 24 16:04:22 2020 +0200

Update to CXF 3.4.0
---
 modules/cxf/pom.xml| 14 --
 webapps/docs/changelog.xml |  3 +++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/modules/cxf/pom.xml b/modules/cxf/pom.xml
index 5fe8f7d..84aec80 100644
--- a/modules/cxf/pom.xml
+++ b/modules/cxf/pom.xml
@@ -29,7 +29,7 @@
 Apache CXF for Apache Tomcat CDI
 Apache CXF packaged for Apache Tomcat CDI
 
-3.3.6
+3.4.0
 jar
 
 
@@ -125,11 +125,12 @@

 
 
-
javax.annotation:javax.annotation-api
-   
javax.el:*
-   
javax.enterprise:cdi-api
-   
javax.inject:*
-   
javax.interceptor:*
+jakarta.activation:*
+
jakarta.annotation:jakarta.annotation-api
+jakarta.el:*
+
jakarta.enterprise:jakarta.enterprise.cdi-api
+jakarta.inject:*
+jakarta.interceptor:*


org.apache.ant:*

org.codehaus.woodstox:*
@@ -152,6 +153,7 @@

META-INF/NOTICE.txt

META-INF/NOTICE


+module-info.class

META-INF/cxf/cxf.*

META-INF/cxf/cxf-servlet.*

META-INF/cxf/org.apache.cxf.bus.factory
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index be4a6f9..32c2ba7 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -163,6 +163,9 @@
   
 Update the OWB module to Apache OpenWebBeans 2.0.18. (remm)
   
+  
+Update the CXF module to Apache CXF 3.4.0. (remm)
+  
 
   
 


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



[tomcat] branch master updated: Fix new shade plugin warnings

2020-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new a8852a6  Fix new shade plugin warnings
a8852a6 is described below

commit a8852a6fa609d7353d9701ffaa331174f63e7330
Author: remm 
AuthorDate: Thu Sep 24 16:02:58 2020 +0200

Fix new shade plugin warnings
---
 modules/cxf/pom.xml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/cxf/pom.xml b/modules/cxf/pom.xml
index aa869ad..495ec6b 100644
--- a/modules/cxf/pom.xml
+++ b/modules/cxf/pom.xml
@@ -125,6 +125,7 @@

 
 
+jakarta.activation:*
 
jakarta.annotation:jakarta.annotation-api

jakarta.el:*

jakarta.enterprise:jakarta.enterprise.cdi-api
@@ -152,6 +153,7 @@

META-INF/NOTICE.txt

META-INF/NOTICE


+module-info.class

META-INF/cxf/cxf.*

META-INF/cxf/cxf-servlet.*

META-INF/cxf/org.apache.cxf.bus.factory


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



[tomcat] branch 9.0.x updated: OWB 2.0.18

2020-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 6cbf57d  OWB 2.0.18
6cbf57d is described below

commit 6cbf57d0c2853b46c51b758609400164111dd635
Author: remm 
AuthorDate: Thu Sep 24 15:12:15 2020 +0200

OWB 2.0.18
---
 modules/owb/pom.xml| 4 ++--
 webapps/docs/changelog.xml | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/owb/pom.xml b/modules/owb/pom.xml
index 7fe93e5..f9bc4f8 100644
--- a/modules/owb/pom.xml
+++ b/modules/owb/pom.xml
@@ -29,14 +29,14 @@
 Apache Tomcat CDI 2 support
 Apache Tomcat CDI 2 support using Apache 
OpenWebBeans
 
-2.0.17
+2.0.18
 jar
 
 
 1.0
 1.0
 1.0.1
-9.0.36
+9.0.38
 
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6f7f2c6..be4a6f9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -160,6 +160,9 @@
 Expand coverage of Russian translations. Pull request provided by
 Nikolay Gribanov. (markt)
   
+  
+Update the OWB module to Apache OpenWebBeans 2.0.18. (remm)
+  
 
   
 


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



[tomcat] branch master updated: Update to CXF 3.4.0

2020-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new d2f30cf  Update to CXF 3.4.0
 new 38e42dd  Merge branch 'master' of g...@github.com:apache/tomcat.git
d2f30cf is described below

commit d2f30cf0760c0ef3f6a2b3945411618fe8411a46
Author: remm 
AuthorDate: Thu Sep 24 15:08:06 2020 +0200

Update to CXF 3.4.0
---
 modules/cxf/pom.xml| 10 --
 webapps/docs/changelog.xml |  3 +++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/cxf/pom.xml b/modules/cxf/pom.xml
index 220ae64..aa869ad 100644
--- a/modules/cxf/pom.xml
+++ b/modules/cxf/pom.xml
@@ -29,7 +29,7 @@
 Apache CXF for Apache Tomcat CDI
 Apache CXF packaged for Apache Tomcat CDI
 
-3.3.6
+3.4.0
 jar
 
 
@@ -127,11 +127,9 @@
 
 
jakarta.annotation:jakarta.annotation-api

jakarta.el:*
-
javax.annotation:javax.annotation-api
-javax.el:*
-   
javax.enterprise:cdi-api
-   
javax.inject:*
-   
javax.interceptor:*
+   
jakarta.enterprise:jakarta.enterprise.cdi-api
+   
jakarta.inject:*
+   
jakarta.interceptor:*


org.apache.ant:*

org.codehaus.woodstox:*
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a6d3b84..f58a592 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -159,6 +159,9 @@
   
 Update the OWB module to Apache OpenWebBeans 2.0.18. (remm)
   
+  
+Update the CXF module to Apache CXF 3.4.0. (remm)
+  
 
   
 


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



[tomcat] branch master updated: OWB 2.0.18

2020-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 8713546  OWB 2.0.18
8713546 is described below

commit 8713546e8eaede2038e4ae9d293e8a335931b9dc
Author: remm 
AuthorDate: Thu Sep 24 11:16:31 2020 +0200

OWB 2.0.18
---
 modules/owb/pom.xml| 4 ++--
 webapps/docs/changelog.xml | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/owb/pom.xml b/modules/owb/pom.xml
index 2fd627b..b62360d 100644
--- a/modules/owb/pom.xml
+++ b/modules/owb/pom.xml
@@ -29,14 +29,14 @@
 Apache Tomcat CDI 2 support
 Apache Tomcat CDI 2 support using Apache 
OpenWebBeans
 
-2.0.17
+2.0.18
 jar
 
 
 1.0
 1.0
 1.0.1
-10.0.0-M6
+10.0.0-M8
 
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 685c7ad..a6d3b84 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -156,6 +156,9 @@
 Expand coverage of Russian translations. Pull request provided by
 Nikolay Gribanov. (markt)
   
+  
+Update the OWB module to Apache OpenWebBeans 2.0.18. (remm)
+  
 
   
 


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



[tomcat] branch master updated: Update version numbers

2020-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 6e509a8  Update version numbers
6e509a8 is described below

commit 6e509a856bfb9c2912b7451183f851afe77ed67a
Author: remm 
AuthorDate: Thu Sep 24 10:12:10 2020 +0200

Update version numbers
---
 modules/stuffed/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/stuffed/pom.xml b/modules/stuffed/pom.xml
index f1c84a3..c8dfa78 100644
--- a/modules/stuffed/pom.xml
+++ b/modules/stuffed/pom.xml
@@ -29,8 +29,8 @@
 
 UTF-8
 org.apache.catalina.startup.Tomcat
-10.0.0-M7
-
+10.0.0-M8
+
 
 
 


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



[tomcat] branch 9.0.x updated: Javadoc fix

2020-09-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 88afc14  Javadoc fix
88afc14 is described below

commit 88afc14d208bd37bc2304d382fdebb88e195cfe1
Author: remm 
AuthorDate: Wed Sep 23 12:04:35 2020 +0200

Javadoc fix
---
 java/org/apache/catalina/webresources/JarContents.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/webresources/JarContents.java 
b/java/org/apache/catalina/webresources/JarContents.java
index 1642d4c..c7da5e2 100644
--- a/java/org/apache/catalina/webresources/JarContents.java
+++ b/java/org/apache/catalina/webresources/JarContents.java
@@ -51,7 +51,7 @@ public final class JarContents {
 /**
  * Parses the passed-in jar and populates the bit array.
  *
- * @param jar
+ * @param jar the JAR file
  */
 public JarContents(JarFile jar) {
 Enumeration entries = jar.entries();


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



[tomcat] branch master updated (99647b3 -> 2b4e441)

2020-09-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 99647b3  Merge branch 'master' of g...@github.com:apache/tomcat.git
 add 2b4e441  Javadoc fix

No new revisions were added by this update.

Summary of changes:
 java/org/apache/catalina/webresources/JarContents.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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



[tomcat] branch 9.0.x updated: Add a bloom filter to speed up archive lookup

2020-09-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new ec2369d  Add a bloom filter to speed up archive lookup
ec2369d is described below

commit ec2369d4398f84bbc5f9a2fe338053439bd0b301
Author: remm 
AuthorDate: Wed Sep 23 11:49:12 2020 +0200

Add a bloom filter to speed up archive lookup

The can improve deployment speed of applications with a large number of
JARs.
Patch provided by Jatin Kamnani, with changes. PR #352
---
 java/org/apache/catalina/Context.java  |  15 +++
 java/org/apache/catalina/core/StandardContext.java |  19 +++
 .../apache/catalina/core/mbeans-descriptors.xml|   4 +
 .../org/apache/catalina/startup/FailedContext.java |   6 +
 .../webresources/AbstractArchiveResourceSet.java   |  16 ++-
 .../apache/catalina/webresources/JarContents.java  | 135 +
 .../catalina/webresources/TestJarContents.java |  93 ++
 test/org/apache/tomcat/unittest/TesterContext.java |   6 +
 webapps/docs/changelog.xml |   5 +
 webapps/docs/config/context.xml|   8 ++
 10 files changed, 305 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/Context.java 
b/java/org/apache/catalina/Context.java
index 5aac225..a53b977 100644
--- a/java/org/apache/catalina/Context.java
+++ b/java/org/apache/catalina/Context.java
@@ -1919,4 +1919,19 @@ public interface Context extends Container, ContextBind {
  * otherwise {@code false}
  */
 public boolean getCreateUploadTargets();
+
+
+/**
+ * @return true if the resources archive lookup will
+ * use a bloom filter.
+ */
+public boolean getUseBloomFilterForArchives();
+
+/**
+ * Set bloom filter flag value.
+ *
+ * @param useBloomFilterForArchives The new fast class path scan flag
+ */
+public void setUseBloomFilterForArchives(boolean 
useBloomFilterForArchives);
+
 }
diff --git a/java/org/apache/catalina/core/StandardContext.java 
b/java/org/apache/catalina/core/StandardContext.java
index 06f7621..6db44d3 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -830,6 +830,8 @@ public class StandardContext extends ContainerBase
 
 private boolean parallelAnnotationScanning = false;
 
+private boolean useBloomFilterForArchives = false;
+
 // - Context Properties
 
 @Override
@@ -1407,6 +1409,23 @@ public class StandardContext extends ContainerBase
 
 
 @Override
+public boolean getUseBloomFilterForArchives() {
+return this.useBloomFilterForArchives;
+}
+
+
+@Override
+public void setUseBloomFilterForArchives(boolean 
useBloomFilterForArchives) {
+
+boolean oldUseBloomFilterForArchives = this.useBloomFilterForArchives;
+this.useBloomFilterForArchives = useBloomFilterForArchives;
+support.firePropertyChange("useBloomFilterForArchives", 
oldUseBloomFilterForArchives,
+this.useBloomFilterForArchives);
+
+}
+
+
+@Override
 public void setParallelAnnotationScanning(boolean 
parallelAnnotationScanning) {
 
 boolean oldParallelAnnotationScanning = 
this.parallelAnnotationScanning;
diff --git a/java/org/apache/catalina/core/mbeans-descriptors.xml 
b/java/org/apache/catalina/core/mbeans-descriptors.xml
index 50be99f..c02cff3 100644
--- a/java/org/apache/catalina/core/mbeans-descriptors.xml
+++ b/java/org/apache/catalina/core/mbeans-descriptors.xml
@@ -325,6 +325,10 @@
description="Unpack WAR property"
type="boolean"/>
 
+
+
 
diff --git a/java/org/apache/catalina/startup/FailedContext.java 
b/java/org/apache/catalina/startup/FailedContext.java
index 7919943..21e5a81 100644
--- a/java/org/apache/catalina/startup/FailedContext.java
+++ b/java/org/apache/catalina/startup/FailedContext.java
@@ -828,4 +828,10 @@ public class FailedContext extends LifecycleMBeanBase 
implements Context {
 @Override
 public void setParallelAnnotationScanning(boolean 
parallelAnnotationScanning) {}
 
+@Override
+public boolean getUseBloomFilterForArchives() { return false; }
+
+@Override
+public void setUseBloomFilterForArchives(boolean 
useBloomFilterForArchives) {}
+
 }
\ No newline at end of file
diff --git 
a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java 
b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
index 8473480..2236491 100644
--- a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
+++ b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
@@ -36,12 +36,11 @@ public abstract class AbstractArchiveResourceSet extends 
Abstrac

[tomcat] branch master updated: Add a bloom filter to speed up archive lookup

2020-09-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new ce17ede  Add a bloom filter to speed up archive lookup
 new 99647b3  Merge branch 'master' of g...@github.com:apache/tomcat.git
ce17ede is described below

commit ce17edeee6c7c1a5965be4e60a4d1ccff96fbc38
Author: remm 
AuthorDate: Wed Sep 23 11:49:12 2020 +0200

Add a bloom filter to speed up archive lookup

The can improve deployment speed of applications with a large number of
JARs.
Patch provided by Jatin Kamnani, with changes. PR #352
---
 java/org/apache/catalina/Context.java  |  13 ++
 java/org/apache/catalina/core/StandardContext.java |  19 +++
 .../apache/catalina/core/mbeans-descriptors.xml|   4 +
 .../org/apache/catalina/startup/FailedContext.java |   6 +
 .../webresources/AbstractArchiveResourceSet.java   |  16 ++-
 .../apache/catalina/webresources/JarContents.java  | 135 +
 .../catalina/webresources/TestJarContents.java |  93 ++
 test/org/apache/tomcat/unittest/TesterContext.java |   6 +
 webapps/docs/changelog.xml |   5 +
 webapps/docs/config/context.xml|   8 ++
 10 files changed, 303 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/Context.java 
b/java/org/apache/catalina/Context.java
index 4cf844c..275063b 100644
--- a/java/org/apache/catalina/Context.java
+++ b/java/org/apache/catalina/Context.java
@@ -1946,4 +1946,17 @@ public interface Context extends Container, ContextBind {
 public void setDispatcherWrapsSameObject(boolean 
dispatcherWrapsSameObject);
 
 
+/**
+ * @return true if the resources archive lookup will
+ * use a bloom filter.
+ */
+public boolean getUseBloomFilterForArchives();
+
+/**
+ * Set bloom filter flag value.
+ *
+ * @param useBloomFilterForArchives The new fast class path scan flag
+ */
+public void setUseBloomFilterForArchives(boolean 
useBloomFilterForArchives);
+
 }
diff --git a/java/org/apache/catalina/core/StandardContext.java 
b/java/org/apache/catalina/core/StandardContext.java
index a34f14e..abb123f 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -835,6 +835,8 @@ public class StandardContext extends ContainerBase
 
 private boolean parallelAnnotationScanning = false;
 
+private boolean useBloomFilterForArchives = false;
+
 // - Context Properties
 
 @Override
@@ -1450,6 +1452,23 @@ public class StandardContext extends ContainerBase
 
 
 @Override
+public boolean getUseBloomFilterForArchives() {
+return this.useBloomFilterForArchives;
+}
+
+
+@Override
+public void setUseBloomFilterForArchives(boolean 
useBloomFilterForArchives) {
+
+boolean oldUseBloomFilterForArchives = this.useBloomFilterForArchives;
+this.useBloomFilterForArchives = useBloomFilterForArchives;
+support.firePropertyChange("useBloomFilterForArchives", 
oldUseBloomFilterForArchives,
+this.useBloomFilterForArchives);
+
+}
+
+
+@Override
 public void setParallelAnnotationScanning(boolean 
parallelAnnotationScanning) {
 
 boolean oldParallelAnnotationScanning = 
this.parallelAnnotationScanning;
diff --git a/java/org/apache/catalina/core/mbeans-descriptors.xml 
b/java/org/apache/catalina/core/mbeans-descriptors.xml
index 50be99f..c02cff3 100644
--- a/java/org/apache/catalina/core/mbeans-descriptors.xml
+++ b/java/org/apache/catalina/core/mbeans-descriptors.xml
@@ -325,6 +325,10 @@
description="Unpack WAR property"
type="boolean"/>
 
+
+
 
diff --git a/java/org/apache/catalina/startup/FailedContext.java 
b/java/org/apache/catalina/startup/FailedContext.java
index 84b12f5..4fee683 100644
--- a/java/org/apache/catalina/startup/FailedContext.java
+++ b/java/org/apache/catalina/startup/FailedContext.java
@@ -836,4 +836,10 @@ public class FailedContext extends LifecycleMBeanBase 
implements Context {
 @Override
 public void setParallelAnnotationScanning(boolean 
parallelAnnotationScanning) {}
 
+@Override
+public boolean getUseBloomFilterForArchives() { return false; }
+
+@Override
+public void setUseBloomFilterForArchives(boolean 
useBloomFilterForArchives) {}
+
 }
\ No newline at end of file
diff --git 
a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java 
b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
index 8473480..2236491 100644
--- a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
+++ b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
@@ -36,1

[tomcat-jakartaee-migration] branch master updated: Fix warning

2020-09-22 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git


The following commit(s) were added to refs/heads/master by this push:
 new c05cc61  Fix warning
c05cc61 is described below

commit c05cc614f4e5942b264309f110eb3a8e0bbc7134
Author: remm 
AuthorDate: Tue Sep 22 09:30:53 2020 +0200

Fix warning
---
 .../org/apache/tomcat/jakartaee/MigrationTest.java   | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java 
b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
index 418b57f..0e0ba2a 100644
--- a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
+++ b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
@@ -157,11 +157,12 @@ public class MigrationTest {
 assertEquals("jakarta.servlet.CommonGatewayInterface", 
cls.getSuperclass().getName());
 
 // check the modification of the Implementation-Version manifest 
attribute
-JarFile jar = new JarFile(jarFile);
-String implementationVersion = 
jar.getManifest().getMainAttributes().getValue("Implementation-Version");
-assertNotNull("Missing Implementation-Version manifest attribute", 
implementationVersion);
-assertNotEquals("Implementation-Version manifest attribute not 
changed", "1.2.3", implementationVersion);
-assertTrue("Implementation-Version manifest attribute doesn't match 
the expected pattern", 
implementationVersion.matches("1\\.2\\.3-migrated-[\\d\\.]+.*"));
+try (JarFile jar = new JarFile(jarFile)) {
+String implementationVersion = 
jar.getManifest().getMainAttributes().getValue("Implementation-Version");
+assertNotNull("Missing Implementation-Version manifest attribute", 
implementationVersion);
+assertNotEquals("Implementation-Version manifest attribute not 
changed", "1.2.3", implementationVersion);
+assertTrue("Implementation-Version manifest attribute doesn't 
match the expected pattern", 
implementationVersion.matches("1\\.2\\.3-migrated-[\\d\\.]+.*"));
+}
 }
 
 @Test
@@ -187,9 +188,10 @@ public class MigrationTest {
 migration.setDestination(jarFile);
 migration.execute();
 
-JarFile jar = new JarFile(jarFile);
-assertNull("Digest not removed from the manifest", 
jar.getManifest().getAttributes("org/apache/tomcat/jakartaee/HelloCGI.class"));
-assertNull("Signature key not removed", jar.getEntry("META-INF/" + 
algorithm.toUpperCase() + "." + algorithm.toUpperCase()));
-assertNull("Signed manifest not removed", jar.getEntry("META-INF/" + 
algorithm.toUpperCase() + ".SF"));
+try (JarFile jar = new JarFile(jarFile)) {
+assertNull("Digest not removed from the manifest", 
jar.getManifest().getAttributes("org/apache/tomcat/jakartaee/HelloCGI.class"));
+assertNull("Signature key not removed", jar.getEntry("META-INF/" + 
algorithm.toUpperCase() + "." + algorithm.toUpperCase()));
+assertNull("Signed manifest not removed", jar.getEntry("META-INF/" 
+ algorithm.toUpperCase() + ".SF"));
+}
 }
 }


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



[tomcat-jakartaee-migration] branch master updated: Improve tests results

2020-09-22 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git


The following commit(s) were added to refs/heads/master by this push:
 new 5bf42bb  Improve tests results
5bf42bb is described below

commit 5bf42bb3139f82e61b5098344e997e339ef14644
Author: remm 
AuthorDate: Tue Sep 22 09:30:26 2020 +0200

Improve tests results

migrateFile just ignores if the destination exists, so migrateDirectory
could do that as well.
---
 src/main/java/org/apache/tomcat/jakartaee/Migration.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java 
b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
index b297747..69a23c0 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
@@ -99,7 +99,7 @@ public class Migration {
 boolean result = true;
 long t1 = System.nanoTime();
 if (source.isDirectory()) {
-if (destination.mkdirs()) {
+if ((destination.exists() && destination.isDirectory()) || 
destination.mkdirs()) {
 result = result && migrateDirectory(source, destination);
 } else {
 logger.log(Level.WARNING, sm.getString("migration.mkdirError", 
destination.getAbsolutePath()));
@@ -129,7 +129,7 @@ public class Migration {
 File srcFile = new File(src, file);
 File destFile = new File(dest, file);
 if (srcFile.isDirectory()) {
-if (destFile.mkdir()) {
+if ((destFile.exists() && destFile.isDirectory()) || 
destFile.mkdir()) {
 result = result && migrateDirectory(srcFile, destFile);
 } else {
 logger.log(Level.WARNING, 
sm.getString("migration.mkdirError", destFile.getAbsolutePath()));


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



[tomcat] branch 9.0.x updated: Remove noop pool shutdown code

2020-09-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 514ef4e  Remove noop pool shutdown code
514ef4e is described below

commit 514ef4e7063a507b7e23cfd26f19a70dc3284ba6
Author: remm 
AuthorDate: Fri Sep 18 12:41:38 2020 +0200

Remove noop pool shutdown code

The utility executor shutdown is protected by a facade, so it just
worked fine.
---
 .../org/apache/catalina/startup/ContextConfig.java | 26 +-
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index f80bd1e..355dea3 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -2211,24 +2211,18 @@ public class ContextConfig implements LifecycleListener 
{
 Map javaClassCache) {
 Server s = getServer();
 ExecutorService pool = null;
+pool = s.getUtilityExecutor();
+List> futures = new ArrayList<>(fragments.size());
+for (WebXml fragment : fragments) {
+Runnable task = new AnnotationScanTask(fragment, handlesTypesOnly, 
javaClassCache);
+futures.add(pool.submit(task));
+}
 try {
-pool = s.getUtilityExecutor();
-List> futures = new ArrayList<>(fragments.size());
-for (WebXml fragment : fragments) {
-Runnable task = new AnnotationScanTask(fragment, 
handlesTypesOnly, javaClassCache);
-futures.add(pool.submit(task));
-}
-try {
-for (Future future : futures) {
-future.get();
-}
-} catch (Exception e) {
-throw new 
RuntimeException(sm.getString("contextConfig.processAnnotationsInParallelFailure"),
 e);
-}
-} finally {
-if (pool != null) {
-pool.shutdownNow();
+for (Future future : futures) {
+future.get();
 }
+} catch (Exception e) {
+throw new 
RuntimeException(sm.getString("contextConfig.processAnnotationsInParallelFailure"),
 e);
 }
 }
 


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



[tomcat] branch master updated: Remove noop pool shutdown code

2020-09-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new bbe29a8  Remove noop pool shutdown code
bbe29a8 is described below

commit bbe29a8c2d36b869996f2504032d666c49185362
Author: remm 
AuthorDate: Fri Sep 18 12:41:38 2020 +0200

Remove noop pool shutdown code

The utility executor shutdown is protected by a facade, so it just
worked fine.
---
 .../org/apache/catalina/startup/ContextConfig.java | 26 +-
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index e0c1edd..f47a8bd 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -2211,24 +2211,18 @@ public class ContextConfig implements LifecycleListener 
{
 Map javaClassCache) {
 Server s = getServer();
 ExecutorService pool = null;
+pool = s.getUtilityExecutor();
+List> futures = new ArrayList<>(fragments.size());
+for (WebXml fragment : fragments) {
+Runnable task = new AnnotationScanTask(fragment, handlesTypesOnly, 
javaClassCache);
+futures.add(pool.submit(task));
+}
 try {
-pool = s.getUtilityExecutor();
-List> futures = new ArrayList<>(fragments.size());
-for (WebXml fragment : fragments) {
-Runnable task = new AnnotationScanTask(fragment, 
handlesTypesOnly, javaClassCache);
-futures.add(pool.submit(task));
-}
-try {
-for (Future future : futures) {
-future.get();
-}
-} catch (Exception e) {
-throw new 
RuntimeException(sm.getString("contextConfig.processAnnotationsInParallelFailure"),
 e);
-}
-} finally {
-if (pool != null) {
-pool.shutdownNow();
+for (Future future : futures) {
+future.get();
 }
+} catch (Exception e) {
+throw new 
RuntimeException(sm.getString("contextConfig.processAnnotationsInParallelFailure"),
 e);
 }
 }
 


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



[tomcat] branch 9.0.x updated: Javadoc fix

2020-09-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 3c4971b  Javadoc fix
3c4971b is described below

commit 3c4971ba8919e6dedac0654dd330d4b77664eda2
Author: remm 
AuthorDate: Fri Sep 18 11:52:09 2020 +0200

Javadoc fix
---
 java/org/apache/catalina/startup/ContextConfig.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 3dc1638..f80bd1e 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -2205,6 +2205,7 @@ public class ContextConfig implements LifecycleListener {
  *
  * @param fragmentsSet of parallelizable scans
  * @param handlesTypesOnly Important parameter for the underlying scan
+ * @param javaClassCache The class cache
  */
 protected void processAnnotationsInParallel(Set fragments, boolean 
handlesTypesOnly,
 Map javaClassCache) {


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



[tomcat] branch master updated: Javadoc fix

2020-09-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 3607b4d  Javadoc fix
3607b4d is described below

commit 3607b4daae3b81ed372b73494701f5c334d257b9
Author: remm 
AuthorDate: Fri Sep 18 11:52:09 2020 +0200

Javadoc fix
---
 java/org/apache/catalina/startup/ContextConfig.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index a3cfcb8..e0c1edd 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -2205,6 +2205,7 @@ public class ContextConfig implements LifecycleListener {
  *
  * @param fragmentsSet of parallelizable scans
  * @param handlesTypesOnly Important parameter for the underlying scan
+ * @param javaClassCache The class cache
  */
 protected void processAnnotationsInParallel(Set fragments, boolean 
handlesTypesOnly,
 Map javaClassCache) {


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



[tomcat] branch 9.0.x updated: Use utility executor for scanning

2020-09-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 101476c  Use utility executor for scanning
101476c is described below

commit 101476c3536ac09a105d0b603b2c51dd0f3770e9
Author: remm 
AuthorDate: Fri Sep 18 11:40:17 2020 +0200

Use utility executor for scanning

PR354 submitted by Jatin Kamnani.
The flag in on the context, as that's where it belongs. Defaults to
false, can be configured through the context defaults or per context.
---
 java/org/apache/catalina/Context.java  |  14 +++
 java/org/apache/catalina/core/StandardContext.java |  19 
 .../apache/catalina/core/mbeans-descriptors.xml|   4 +
 .../org/apache/catalina/startup/ContextConfig.java | 116 +
 .../org/apache/catalina/startup/FailedContext.java |   6 ++
 .../catalina/startup/LocalStrings.properties   |   1 +
 test/org/apache/tomcat/unittest/TesterContext.java |   6 ++
 webapps/docs/changelog.xml |   4 +
 webapps/docs/config/context.xml|   8 ++
 9 files changed, 156 insertions(+), 22 deletions(-)

diff --git a/java/org/apache/catalina/Context.java 
b/java/org/apache/catalina/Context.java
index 3e647dc..5aac225 100644
--- a/java/org/apache/catalina/Context.java
+++ b/java/org/apache/catalina/Context.java
@@ -761,6 +761,20 @@ public interface Context extends Container, ContextBind {
 public String getContainerSciFilter();
 
 
+/**
+ * @return the value of the parallel annotation scanning flag.  If true,
+ * it will dispatch scanning to the utility executor.
+ */
+public boolean isParallelAnnotationScanning();
+
+/**
+ * Set the parallel annotation scanning value.
+ *
+ * @param parallelAnnotationScanning new parallel annotation scanning flag
+ */
+public void setParallelAnnotationScanning(boolean 
parallelAnnotationScanning);
+
+
 // - Public Methods
 
 /**
diff --git a/java/org/apache/catalina/core/StandardContext.java 
b/java/org/apache/catalina/core/StandardContext.java
index 12641d7..06f7621 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -828,6 +828,8 @@ public class StandardContext extends ContainerBase
 private boolean createUploadTargets = false;
 
 
+private boolean parallelAnnotationScanning = false;
+
 // - Context Properties
 
 @Override
@@ -1404,6 +1406,23 @@ public class StandardContext extends ContainerBase
 }
 
 
+@Override
+public void setParallelAnnotationScanning(boolean 
parallelAnnotationScanning) {
+
+boolean oldParallelAnnotationScanning = 
this.parallelAnnotationScanning;
+this.parallelAnnotationScanning = parallelAnnotationScanning;
+support.firePropertyChange("parallelAnnotationScanning", 
oldParallelAnnotationScanning,
+this.parallelAnnotationScanning);
+
+}
+
+
+@Override
+public boolean isParallelAnnotationScanning() {
+return this.parallelAnnotationScanning;
+}
+
+
 /**
  * @return the Locale to character set mapper for this Context.
  */
diff --git a/java/org/apache/catalina/core/mbeans-descriptors.xml 
b/java/org/apache/catalina/core/mbeans-descriptors.xml
index 1c0733f..50be99f 100644
--- a/java/org/apache/catalina/core/mbeans-descriptors.xml
+++ b/java/org/apache/catalina/core/mbeans-descriptors.xml
@@ -208,6 +208,10 @@
description="The name of this Context"
type="java.lang.String"/>
 
+
+
 
diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index d7b5a77..3dc1638 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -39,6 +39,8 @@ import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
 
 import javax.servlet.MultipartConfigElement;
 import javax.servlet.ServletContainerInitializer;
@@ -122,7 +124,6 @@ public class ContextConfig implements LifecycleListener {
 
 private static final Log log = LogFactory.getLog(ContextConfig.class);
 
-
 /**
  * The string resources for this package.
  */
@@ -1374,7 +1375,14 @@ public class ContextConfig implements LifecycleListener {
 protected void processClasses(WebXml webXml, Set orderedFragments) 
{
 // Step 4. Process /WEB-INF/classes for annotations and
 // @HandlesTypes matches
-Map javaClassCache = new HashMap&l

[tomcat] branch master updated: Use utility executor for scanning

2020-09-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 27bb36b  Use utility executor for scanning
27bb36b is described below

commit 27bb36bdaa56d62fdcc28d3b8e3d4c25f4a44a50
Author: remm 
AuthorDate: Fri Sep 18 11:40:17 2020 +0200

Use utility executor for scanning

PR354 submitted by Jatin Kamnani.
The flag in on the context, as that's where it belongs. Defaults to
false, can be configured through the context defaults or per context.
---
 java/org/apache/catalina/Context.java  |  14 +++
 java/org/apache/catalina/core/StandardContext.java |  19 
 .../apache/catalina/core/mbeans-descriptors.xml|   4 +
 .../org/apache/catalina/startup/ContextConfig.java | 116 +
 .../org/apache/catalina/startup/FailedContext.java |   5 +
 .../catalina/startup/LocalStrings.properties   |   1 +
 test/org/apache/tomcat/unittest/TesterContext.java |   5 +
 webapps/docs/changelog.xml |   4 +
 webapps/docs/config/context.xml|   8 ++
 9 files changed, 154 insertions(+), 22 deletions(-)

diff --git a/java/org/apache/catalina/Context.java 
b/java/org/apache/catalina/Context.java
index b8f55a0..4cf844c 100644
--- a/java/org/apache/catalina/Context.java
+++ b/java/org/apache/catalina/Context.java
@@ -762,6 +762,20 @@ public interface Context extends Container, ContextBind {
 public String getContainerSciFilter();
 
 
+/**
+ * @return the value of the parallel annotation scanning flag.  If true,
+ * it will dispatch scanning to the utility executor.
+ */
+public boolean isParallelAnnotationScanning();
+
+/**
+ * Set the parallel annotation scanning value.
+ *
+ * @param parallelAnnotationScanning new parallel annotation scanning flag
+ */
+public void setParallelAnnotationScanning(boolean 
parallelAnnotationScanning);
+
+
 // - Public Methods
 
 /**
diff --git a/java/org/apache/catalina/core/StandardContext.java 
b/java/org/apache/catalina/core/StandardContext.java
index ce51d6c..a34f14e 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -833,6 +833,8 @@ public class StandardContext extends ContainerBase
 
 private boolean dispatcherWrapsSameObject = 
Globals.STRICT_SERVLET_COMPLIANCE;
 
+private boolean parallelAnnotationScanning = false;
+
 // - Context Properties
 
 @Override
@@ -1447,6 +1449,23 @@ public class StandardContext extends ContainerBase
 }
 
 
+@Override
+public void setParallelAnnotationScanning(boolean 
parallelAnnotationScanning) {
+
+boolean oldParallelAnnotationScanning = 
this.parallelAnnotationScanning;
+this.parallelAnnotationScanning = parallelAnnotationScanning;
+support.firePropertyChange("parallelAnnotationScanning", 
oldParallelAnnotationScanning,
+this.parallelAnnotationScanning);
+
+}
+
+
+@Override
+public boolean isParallelAnnotationScanning() {
+return this.parallelAnnotationScanning;
+}
+
+
 /**
  * @return the Locale to character set mapper for this Context.
  */
diff --git a/java/org/apache/catalina/core/mbeans-descriptors.xml 
b/java/org/apache/catalina/core/mbeans-descriptors.xml
index 1c0733f..50be99f 100644
--- a/java/org/apache/catalina/core/mbeans-descriptors.xml
+++ b/java/org/apache/catalina/core/mbeans-descriptors.xml
@@ -208,6 +208,10 @@
description="The name of this Context"
type="java.lang.String"/>
 
+
+
 
diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index c1fe029..a3cfcb8 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -39,6 +39,8 @@ import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
 
 import jakarta.servlet.MultipartConfigElement;
 import jakarta.servlet.ServletContainerInitializer;
@@ -122,7 +124,6 @@ public class ContextConfig implements LifecycleListener {
 
 private static final Log log = LogFactory.getLog(ContextConfig.class);
 
-
 /**
  * The string resources for this package.
  */
@@ -1374,7 +1375,14 @@ public class ContextConfig implements LifecycleListener {
 protected void processClasses(WebXml webXml, Set orderedFragments) 
{
 // Step 4. Process /WEB-INF/classes for annotations and
 // @HandlesTypes matches
-   

[tomcat] branch 9.0.x updated: Implement checkContainersAvailable flag

2020-09-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 6916632  Implement checkContainersAvailable flag
6916632 is described below

commit 6916632c4083521c217e600620ad7faf948ba23f
Author: remm 
AuthorDate: Fri Sep 11 15:54:57 2020 +0200

Implement checkContainersAvailable flag
---
 java/org/apache/catalina/valves/HealthCheckValve.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/HealthCheckValve.java 
b/java/org/apache/catalina/valves/HealthCheckValve.java
index 5b75fd6..91b33e9 100644
--- a/java/org/apache/catalina/valves/HealthCheckValve.java
+++ b/java/org/apache/catalina/valves/HealthCheckValve.java
@@ -96,7 +96,7 @@ public class HealthCheckValve extends ValveBase {
 context ? request.getRequestPathMB() : 
request.getDecodedRequestURIMB();
 if (urlMB.equals(path)) {
 response.setContentType("application/json");
-if (isAvailable(getContainer())) {
+if (!checkContainersAvailable || (checkContainersAvailable && 
isAvailable(getContainer( {
 response.getOutputStream().print(UP);
 } else {
 response.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);


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



[tomcat] branch master updated: Implement checkContainersAvailable flag

2020-09-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 120bf9d  Implement checkContainersAvailable flag
120bf9d is described below

commit 120bf9d788a9959edae5417e3fea5b8cefffca02
Author: remm 
AuthorDate: Fri Sep 11 15:54:57 2020 +0200

Implement checkContainersAvailable flag
---
 java/org/apache/catalina/valves/HealthCheckValve.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/HealthCheckValve.java 
b/java/org/apache/catalina/valves/HealthCheckValve.java
index c111b3b..3dd9bec 100644
--- a/java/org/apache/catalina/valves/HealthCheckValve.java
+++ b/java/org/apache/catalina/valves/HealthCheckValve.java
@@ -96,7 +96,7 @@ public class HealthCheckValve extends ValveBase {
 context ? request.getRequestPathMB() : 
request.getDecodedRequestURIMB();
 if (urlMB.equals(path)) {
 response.setContentType("application/json");
-if (isAvailable(getContainer())) {
+if (!checkContainersAvailable || (checkContainersAvailable && 
isAvailable(getContainer( {
 response.getOutputStream().print(UP);
 } else {
 response.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);


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



[tomcat] branch 9.0.x updated: Improve the quality of the health check

2020-09-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 79c5de4  Improve the quality of the health check
79c5de4 is described below

commit 79c5de4deee98c2a8c5d6f6674db9fbee88f52d8
Author: remm 
AuthorDate: Fri Sep 11 13:26:44 2020 +0200

Improve the quality of the health check

The valve will check if its associated container and all its children
are available. Will return down if any is not available.
---
 .../apache/catalina/valves/HealthCheckValve.java   | 43 +-
 webapps/docs/changelog.xml |  8 
 webapps/docs/config/valve.xml  | 15 +---
 3 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/catalina/valves/HealthCheckValve.java 
b/java/org/apache/catalina/valves/HealthCheckValve.java
index fb4a8e2..5b75fd6 100644
--- a/java/org/apache/catalina/valves/HealthCheckValve.java
+++ b/java/org/apache/catalina/valves/HealthCheckValve.java
@@ -19,11 +19,14 @@ package org.apache.catalina.valves;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
 
+import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
+import org.apache.catalina.util.LifecycleBase;
 import org.apache.tomcat.util.buf.MessageBytes;
 
 
@@ -38,6 +41,12 @@ public class HealthCheckValve extends ValveBase {
 "  \"checks\": []\n" +
 "}";
 
+private static final String DOWN =
+"{\n" +
+"  \"status\": \"DOWN\",\n" +
+"  \"checks\": []\n" +
+"}";
+
 private String path = "/health";
 
 /**
@@ -45,6 +54,11 @@ public class HealthCheckValve extends ValveBase {
  */
 protected boolean context = false;
 
+/**
+ * Check if all child containers are available.
+ */
+protected boolean checkContainersAvailable = true;
+
 public HealthCheckValve() {
 super(true);
 }
@@ -57,6 +71,14 @@ public class HealthCheckValve extends ValveBase {
 this.path = path;
 }
 
+public boolean getCheckContainersAvailable() {
+return this.checkContainersAvailable;
+}
+
+public void setCheckContainersAvailable(boolean checkContainersAvailable) {
+this.checkContainersAvailable = checkContainersAvailable;
+}
+
 @Override
 protected synchronized void startInternal() throws LifecycleException {
 super.startInternal();
@@ -74,9 +96,28 @@ public class HealthCheckValve extends ValveBase {
 context ? request.getRequestPathMB() : 
request.getDecodedRequestURIMB();
 if (urlMB.equals(path)) {
 response.setContentType("application/json");
-response.getOutputStream().print(UP);
+if (isAvailable(getContainer())) {
+response.getOutputStream().print(UP);
+} else {
+response.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+response.getOutputStream().print(DOWN);
+}
 } else {
 getNext().invoke(request, response);
 }
 }
+
+protected boolean isAvailable(Container container) {
+for (Container child : container.findChildren()) {
+if (!isAvailable(child)) {
+return false;
+}
+}
+if (container instanceof LifecycleBase) {
+return ((LifecycleBase) container).getState().isAvailable();
+} else {
+return true;
+}
+}
+
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index cb6b9c6..fad0a39 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -45,6 +45,14 @@
   issues do not "pop up" wrt. others).
 -->
 
+  
+
+  
+The health check valve will now check the state of its associated
+containers to report availability. (remm)
+  
+
+  
 
 
   
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index aac0d5a..0a6b0c3 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -2232,10 +2232,7 @@
   
 
 The Health Check Valve responds to
-cloud orchestrators health checks. Note that it checks
-that a context is mapped (so that an application is deployed),
-for example if you don't have a ROOT context but demo-1.0
-you have to check for /demo-1.0/health
+cloud orchestrators health checks.
   
 
   
@@ -2251,10 +2248,18 @@
   
 
   
-Path by the clo

[tomcat] branch master updated: Improve the quality of the health check

2020-09-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 2ff7bba  Improve the quality of the health check
2ff7bba is described below

commit 2ff7bba79946a3716b136b0752c9fe7126b50499
Author: remm 
AuthorDate: Fri Sep 11 13:26:44 2020 +0200

Improve the quality of the health check

The valve will check if its associated container and all its children
are available. Will return down if any is not available.
---
 .../apache/catalina/valves/HealthCheckValve.java   | 43 +-
 webapps/docs/changelog.xml |  8 
 webapps/docs/config/valve.xml  | 15 +---
 3 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/catalina/valves/HealthCheckValve.java 
b/java/org/apache/catalina/valves/HealthCheckValve.java
index be9c487..c111b3b 100644
--- a/java/org/apache/catalina/valves/HealthCheckValve.java
+++ b/java/org/apache/catalina/valves/HealthCheckValve.java
@@ -19,11 +19,14 @@ package org.apache.catalina.valves;
 import java.io.IOException;
 
 import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletResponse;
 
+import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
+import org.apache.catalina.util.LifecycleBase;
 import org.apache.tomcat.util.buf.MessageBytes;
 
 
@@ -38,6 +41,12 @@ public class HealthCheckValve extends ValveBase {
 "  \"checks\": []\n" +
 "}";
 
+private static final String DOWN =
+"{\n" +
+"  \"status\": \"DOWN\",\n" +
+"  \"checks\": []\n" +
+"}";
+
 private String path = "/health";
 
 /**
@@ -45,6 +54,11 @@ public class HealthCheckValve extends ValveBase {
  */
 protected boolean context = false;
 
+/**
+ * Check if all child containers are available.
+ */
+protected boolean checkContainersAvailable = true;
+
 public HealthCheckValve() {
 super(true);
 }
@@ -57,6 +71,14 @@ public class HealthCheckValve extends ValveBase {
 this.path = path;
 }
 
+public boolean getCheckContainersAvailable() {
+return this.checkContainersAvailable;
+}
+
+public void setCheckContainersAvailable(boolean checkContainersAvailable) {
+this.checkContainersAvailable = checkContainersAvailable;
+}
+
 @Override
 protected synchronized void startInternal() throws LifecycleException {
 super.startInternal();
@@ -74,9 +96,28 @@ public class HealthCheckValve extends ValveBase {
 context ? request.getRequestPathMB() : 
request.getDecodedRequestURIMB();
 if (urlMB.equals(path)) {
 response.setContentType("application/json");
-response.getOutputStream().print(UP);
+if (isAvailable(getContainer())) {
+response.getOutputStream().print(UP);
+} else {
+response.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+response.getOutputStream().print(DOWN);
+}
 } else {
 getNext().invoke(request, response);
 }
 }
+
+protected boolean isAvailable(Container container) {
+for (Container child : container.findChildren()) {
+if (!isAvailable(child)) {
+return false;
+}
+}
+if (container instanceof LifecycleBase) {
+return ((LifecycleBase) container).getState().isAvailable();
+} else {
+return true;
+}
+}
+
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 737bf79..d8695c1 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -45,6 +45,14 @@
   issues do not "pop up" wrt. others).
 -->
 
+  
+
+  
+The health check valve will now check the state of its associated
+containers to report availability. (remm)
+  
+
+  
 
 
   
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 557ee32..3111fce 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -2236,10 +2236,7 @@
   
 
 The Health Check Valve responds to
-cloud orchestrators health checks. Note that it checks
-that a context is mapped (so that an application is deployed),
-for example if you don't have a ROOT context but demo-1.0
-you have to check for /demo-1.0/health
+cloud orchestrators health checks.
   
 
   
@@ -2255,10 +2252,18 @@
   
 
   
-

[tomcat] branch 8.5.x updated: Add the missing string

2020-09-08 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 2f64f96  Add the missing string
2f64f96 is described below

commit 2f64f965b274a87bb4c27ad84acb2f1936532308
Author: remm 
AuthorDate: Tue Sep 8 12:53:23 2020 +0200

Add the missing string
---
 java/org/apache/tomcat/util/net/LocalStrings.properties | 1 +
 java/org/apache/tomcat/util/net/SSLUtilBase.java| 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/LocalStrings.properties 
b/java/org/apache/tomcat/util/net/LocalStrings.properties
index 70cad95..cf9927e 100644
--- a/java/org/apache/tomcat/util/net/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/net/LocalStrings.properties
@@ -147,6 +147,7 @@ sslImplementation.cnfe=Unable to create SSLImplementation 
for class [{0}]
 
 sslUtilBase.active=The [{0}] that are active are : [{1}]
 sslUtilBase.alias_no_key_entry=Alias name [{0}] does not identify a key entry
+sslUtilBase.aliasIgnored=Alias name [{0}] will be ignored when using FIPS mode
 sslUtilBase.invalidTrustManagerClassName=The trustManagerClassName provided 
[{0}] does not implement javax.net.ssl.TrustManager
 sslUtilBase.keystore_load_failed=Failed to load keystore type [{0}] with path 
[{1}] due to [{2}]
 sslUtilBase.noCertFile=SSLHostConfig attribute certificateFile must be defined 
when using an SSL connector
diff --git a/java/org/apache/tomcat/util/net/SSLUtilBase.java 
b/java/org/apache/tomcat/util/net/SSLUtilBase.java
index 7433ffe..1c2fefe 100644
--- a/java/org/apache/tomcat/util/net/SSLUtilBase.java
+++ b/java/org/apache/tomcat/util/net/SSLUtilBase.java
@@ -299,7 +299,7 @@ public abstract class SSLUtilBase implements SSLUtil {
 if (kmf.getProvider().getInfo().indexOf("FIPS") != -1) {
 // FIPS doesn't like ANY wrapping nor key manipulation.
 if (keyAlias != null) {
-log.warn(sm.getString("sslUtilBase.alias_ignored", keyAlias));
+log.warn(sm.getString("sslUtilBase.aliasIgnored", keyAlias));
 }
 kmf.init(ksUsed, keyPassArray);
 return kmf.getKeyManagers();


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



[tomcat] branch 9.0.x updated: Add the missing string

2020-09-08 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 6ebfb5f  Add the missing string
6ebfb5f is described below

commit 6ebfb5faa9f1fe15668aaf7a65fb398a56109383
Author: remm 
AuthorDate: Tue Sep 8 12:53:23 2020 +0200

Add the missing string
---
 java/org/apache/tomcat/util/net/LocalStrings.properties | 1 +
 java/org/apache/tomcat/util/net/SSLUtilBase.java| 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/LocalStrings.properties 
b/java/org/apache/tomcat/util/net/LocalStrings.properties
index e2a16b9..efd962b 100644
--- a/java/org/apache/tomcat/util/net/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/net/LocalStrings.properties
@@ -164,6 +164,7 @@ sslImplementation.cnfe=Unable to create SSLImplementation 
for class [{0}]
 
 sslUtilBase.active=The [{0}] that are active are : [{1}]
 sslUtilBase.alias_no_key_entry=Alias name [{0}] does not identify a key entry
+sslUtilBase.aliasIgnored=Alias name [{0}] will be ignored when using FIPS mode
 sslUtilBase.invalidTrustManagerClassName=The trustManagerClassName provided 
[{0}] does not implement javax.net.ssl.TrustManager
 sslUtilBase.keystore_load_failed=Failed to load keystore type [{0}] with path 
[{1}] due to [{2}]
 sslUtilBase.noCertFile=SSLHostConfig attribute certificateFile must be defined 
when using an SSL connector
diff --git a/java/org/apache/tomcat/util/net/SSLUtilBase.java 
b/java/org/apache/tomcat/util/net/SSLUtilBase.java
index 143b2d2..09e3aa7 100644
--- a/java/org/apache/tomcat/util/net/SSLUtilBase.java
+++ b/java/org/apache/tomcat/util/net/SSLUtilBase.java
@@ -300,7 +300,7 @@ public abstract class SSLUtilBase implements SSLUtil {
 if (kmf.getProvider().getInfo().indexOf("FIPS") != -1) {
 // FIPS doesn't like ANY wrapping nor key manipulation.
 if (keyAlias != null) {
-log.warn(sm.getString("sslUtilBase.alias_ignored", keyAlias));
+log.warn(sm.getString("sslUtilBase.aliasIgnored", keyAlias));
 }
 kmf.init(ksUsed, keyPassArray);
 return kmf.getKeyManagers();


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



[tomcat] branch master updated: Add the missing string

2020-09-08 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 6515798  Add the missing string
6515798 is described below

commit 6515798cd693636350647f61eadcf80755bd8b11
Author: remm 
AuthorDate: Tue Sep 8 12:53:23 2020 +0200

Add the missing string
---
 java/org/apache/tomcat/util/net/LocalStrings.properties | 1 +
 java/org/apache/tomcat/util/net/SSLUtilBase.java| 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/LocalStrings.properties 
b/java/org/apache/tomcat/util/net/LocalStrings.properties
index e2a16b9..efd962b 100644
--- a/java/org/apache/tomcat/util/net/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/net/LocalStrings.properties
@@ -164,6 +164,7 @@ sslImplementation.cnfe=Unable to create SSLImplementation 
for class [{0}]
 
 sslUtilBase.active=The [{0}] that are active are : [{1}]
 sslUtilBase.alias_no_key_entry=Alias name [{0}] does not identify a key entry
+sslUtilBase.aliasIgnored=Alias name [{0}] will be ignored when using FIPS mode
 sslUtilBase.invalidTrustManagerClassName=The trustManagerClassName provided 
[{0}] does not implement javax.net.ssl.TrustManager
 sslUtilBase.keystore_load_failed=Failed to load keystore type [{0}] with path 
[{1}] due to [{2}]
 sslUtilBase.noCertFile=SSLHostConfig attribute certificateFile must be defined 
when using an SSL connector
diff --git a/java/org/apache/tomcat/util/net/SSLUtilBase.java 
b/java/org/apache/tomcat/util/net/SSLUtilBase.java
index 143b2d2..09e3aa7 100644
--- a/java/org/apache/tomcat/util/net/SSLUtilBase.java
+++ b/java/org/apache/tomcat/util/net/SSLUtilBase.java
@@ -300,7 +300,7 @@ public abstract class SSLUtilBase implements SSLUtil {
 if (kmf.getProvider().getInfo().indexOf("FIPS") != -1) {
 // FIPS doesn't like ANY wrapping nor key manipulation.
 if (keyAlias != null) {
-log.warn(sm.getString("sslUtilBase.alias_ignored", keyAlias));
+log.warn(sm.getString("sslUtilBase.aliasIgnored", keyAlias));
 }
 kmf.init(ksUsed, keyPassArray);
 return kmf.getKeyManagers();


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



[tomcat] branch 9.0.x updated: Fix path used by the health check valve

2020-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new e42ee16  Fix path used by the health check valve
e42ee16 is described below

commit e42ee169dbde36e9a6979f4b4036e3b2a0b1b3b4
Author: remm 
AuthorDate: Tue Sep 1 14:29:58 2020 +0200

Fix path used by the health check valve

When not associated with a Context, it should use the full URI.
---
 .../apache/catalina/valves/HealthCheckValve.java   | 23 --
 webapps/docs/changelog.xml |  4 
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/HealthCheckValve.java 
b/java/org/apache/catalina/valves/HealthCheckValve.java
index f8227ac..fb4a8e2 100644
--- a/java/org/apache/catalina/valves/HealthCheckValve.java
+++ b/java/org/apache/catalina/valves/HealthCheckValve.java
@@ -20,6 +20,8 @@ import java.io.IOException;
 
 import javax.servlet.ServletException;
 
+import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.tomcat.util.buf.MessageBytes;
@@ -35,8 +37,14 @@ public class HealthCheckValve extends ValveBase {
 "  \"status\": \"UP\",\n" +
 "  \"checks\": []\n" +
 "}";
+
 private String path = "/health";
 
+/**
+ * Will be set to true if the valve is associated with a context.
+ */
+protected boolean context = false;
+
 public HealthCheckValve() {
 super(true);
 }
@@ -50,10 +58,21 @@ public class HealthCheckValve extends ValveBase {
 }
 
 @Override
+protected synchronized void startInternal() throws LifecycleException {
+super.startInternal();
+if (getContainer() instanceof Context) {
+context = true;
+} else {
+context = false;
+}
+}
+
+@Override
 public void invoke(Request request, Response response)
 throws IOException, ServletException {
-MessageBytes requestPathMB = request.getRequestPathMB();
-if (requestPathMB.equals(path)) {
+MessageBytes urlMB =
+context ? request.getRequestPathMB() : 
request.getDecodedRequestURIMB();
+if (urlMB.equals(path)) {
 response.setContentType("application/json");
 response.getOutputStream().print(UP);
 } else {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1aa08b5..35dad91 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -101,6 +101,10 @@
 Use the correct method to calculate session idle time in
 PersistentValve. (kfujino)
   
+  
+Fix path used by the health check valve when it is not associated with
+a Context. (remm)
+  
 
   
   


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



[tomcat] branch master updated: Fix path used by the health check valve

2020-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 9609da1  Fix path used by the health check valve
9609da1 is described below

commit 9609da111f99ec387d64067d251669787620cff4
Author: remm 
AuthorDate: Tue Sep 1 14:29:58 2020 +0200

Fix path used by the health check valve

When not associated with a Context, it should use the full URI.
---
 .../apache/catalina/valves/HealthCheckValve.java   | 23 --
 webapps/docs/changelog.xml |  4 
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/HealthCheckValve.java 
b/java/org/apache/catalina/valves/HealthCheckValve.java
index 481e8bc..be9c487 100644
--- a/java/org/apache/catalina/valves/HealthCheckValve.java
+++ b/java/org/apache/catalina/valves/HealthCheckValve.java
@@ -20,6 +20,8 @@ import java.io.IOException;
 
 import jakarta.servlet.ServletException;
 
+import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.tomcat.util.buf.MessageBytes;
@@ -35,8 +37,14 @@ public class HealthCheckValve extends ValveBase {
 "  \"status\": \"UP\",\n" +
 "  \"checks\": []\n" +
 "}";
+
 private String path = "/health";
 
+/**
+ * Will be set to true if the valve is associated with a context.
+ */
+protected boolean context = false;
+
 public HealthCheckValve() {
 super(true);
 }
@@ -50,10 +58,21 @@ public class HealthCheckValve extends ValveBase {
 }
 
 @Override
+protected synchronized void startInternal() throws LifecycleException {
+super.startInternal();
+if (getContainer() instanceof Context) {
+context = true;
+} else {
+context = false;
+}
+}
+
+@Override
 public void invoke(Request request, Response response)
 throws IOException, ServletException {
-MessageBytes requestPathMB = request.getRequestPathMB();
-if (requestPathMB.equals(path)) {
+MessageBytes urlMB =
+context ? request.getRequestPathMB() : 
request.getDecodedRequestURIMB();
+if (urlMB.equals(path)) {
 response.setContentType("application/json");
 response.getOutputStream().print(UP);
 } else {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index dae52f6..d3327d7 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -101,6 +101,10 @@
 Use the correct method to calculate session idle time in
 PersistentValve. (kfujino)
   
+  
+Fix path used by the health check valve when it is not associated with
+a Context. (remm)
+  
 
   
   


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



[tomcat] branch master updated: Escape body text

2020-08-27 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new d2843a8  Escape body text
d2843a8 is described below

commit d2843a8fdb28e48b981434fbd24a78bd9cddf84a
Author: remm 
AuthorDate: Thu Aug 27 16:36:12 2020 +0200

Escape body text

Often seen in descriptions in the web.xml and tlds.
---
 java/org/apache/tomcat/util/digester/CallMethodRule.java | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/digester/CallMethodRule.java 
b/java/org/apache/tomcat/util/digester/CallMethodRule.java
index 0a521a9..e744a9d 100644
--- a/java/org/apache/tomcat/util/digester/CallMethodRule.java
+++ b/java/org/apache/tomcat/util/digester/CallMethodRule.java
@@ -393,7 +393,11 @@ public class CallMethodRule extends Rule {
 code.append(", ");
 }
 if (bodyText != null) {
-code.append("\"").append(bodyText).append("\"");
+StringBuilder bodyTextParam = new StringBuilder();
+for (String bodyPart : bodyText.split("\n")) {
+bodyTextParam.append(bodyPart.trim()).append(' ');
+}
+
code.append("\"").append(bodyTextParam.toString().trim().replace("\"", 
"\\\"")).append("\"");
 } else if (paramValues[i] instanceof String) {
 
code.append("\"").append(paramValues[i].toString()).append("\"");
 } else {


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



[tomcat] branch 9.0.x updated: Add system property to the doc

2020-08-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 28fa332  Add system property to the doc
28fa332 is described below

commit 28fa332bb810c7576780b9c1d6e9b87fc72e151c
Author: remm 
AuthorDate: Mon Aug 24 15:11:44 2020 +0200

Add system property to the doc

This should really be done by Graal itself, but it's not so it's better
to document that.
---
 webapps/docs/graal.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/webapps/docs/graal.xml b/webapps/docs/graal.xml
index 694ecab..24943d7 100644
--- a/webapps/docs/graal.xml
+++ b/webapps/docs/graal.xml
@@ -128,6 +128,7 @@ mvn package
 Run the GraalVM substrate VM using the trace agent:
 $JAVA_HOME/bin/java\
 -agentlib:native-image-agent=config-output-dir=$TOMCAT_STUFFED/target/\
+-Dorg.graalvm.nativeimage.imagecode=agent\
 -Dcatalina.base=. 
-Djava.util.logging.config.file=conf/logging.properties\
 -jar target/tomcat-stuffed-1.0.jar --catalina 
-useGeneratedCode
   


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



[tomcat] branch master updated: Add system property to the doc

2020-08-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new e6466f1  Add system property to the doc
e6466f1 is described below

commit e6466f1975990f134eb4db0fb90ebe242021d2fc
Author: remm 
AuthorDate: Mon Aug 24 15:11:44 2020 +0200

Add system property to the doc

This should really be done by Graal itself, but it's not so it's better
to document that.
---
 webapps/docs/graal.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/webapps/docs/graal.xml b/webapps/docs/graal.xml
index aaafbd2..67c5d83 100644
--- a/webapps/docs/graal.xml
+++ b/webapps/docs/graal.xml
@@ -128,6 +128,7 @@ mvn package
 Run the GraalVM substrate VM using the trace agent:
 $JAVA_HOME/bin/java\
 -agentlib:native-image-agent=config-output-dir=$TOMCAT_STUFFED/target/\
+-Dorg.graalvm.nativeimage.imagecode=agent\
 -Dcatalina.base=. 
-Djava.util.logging.config.file=conf/logging.properties\
 -jar target/tomcat-stuffed-1.0.jar --catalina 
-useGeneratedCode
   


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



svn commit: r1880531 - in /tomcat/site/trunk: docs/whoweare.html xdocs/whoweare.xml

2020-08-03 Thread remm
Author: remm
Date: Mon Aug  3 09:19:16 2020
New Revision: 1880531

URL: http://svn.apache.org/viewvc?rev=1880531=rev
Log:
Fix Rajiv's first name.

Modified:
tomcat/site/trunk/docs/whoweare.html
tomcat/site/trunk/xdocs/whoweare.xml

Modified: tomcat/site/trunk/docs/whoweare.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/whoweare.html?rev=1880531=1880530=1880531=diff
==
--- tomcat/site/trunk/docs/whoweare.html (original)
+++ tomcat/site/trunk/docs/whoweare.html Mon Aug  3 09:19:16 2020
@@ -177,7 +177,7 @@ Emeritus is defined in the Apache gl
 Gal Shachor (shachor at apache.org),
 Hans Bergsten (bergsten at apache.org),
 James Todd (gonzo at apache.org),
-Rain Mordani (mode at apache.org),
+Rajiv Mordani (mode at apache.org),
 Hans Granqvist (har at apache.org),
 Ian P. Springer (ishp at apache.org),
 Arun Jamwal (arun at apache.org),

Modified: tomcat/site/trunk/xdocs/whoweare.xml
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/whoweare.xml?rev=1880531=1880530=1880531=diff
==
--- tomcat/site/trunk/xdocs/whoweare.xml (original)
+++ tomcat/site/trunk/xdocs/whoweare.xml Mon Aug  3 09:19:16 2020
@@ -194,7 +194,7 @@ Emeritus is defined in the Apache gl
 Gal Shachor (shachor at apache.org),
 Hans Bergsten (bergsten at apache.org),
 James Todd (gonzo at apache.org),
-Rain Mordani (mode at apache.org),
+Rajiv Mordani (mode at apache.org),
 Hans Granqvist (har at apache.org),
 Ian P. Springer (ishp at apache.org),
 Arun Jamwal (arun at apache.org),



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



[tomcat] branch 9.0.x updated: Add code generation for TLD rules

2020-07-22 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 9c4b131  Add code generation for TLD rules
9c4b131 is described below

commit 9c4b1318646450b740607e38273a3438fd8e8662
Author: remm 
AuthorDate: Wed Jul 22 10:44:03 2020 +0200

Add code generation for TLD rules
---
 .../util/descriptor/tld/ImplicitTldRuleSet.java|  7 +++
 .../tomcat/util/descriptor/tld/TldRuleSet.java | 51 +-
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/descriptor/tld/ImplicitTldRuleSet.java 
b/java/org/apache/tomcat/util/descriptor/tld/ImplicitTldRuleSet.java
index 21dfe6a..9847be5 100644
--- a/java/org/apache/tomcat/util/descriptor/tld/ImplicitTldRuleSet.java
+++ b/java/org/apache/tomcat/util/descriptor/tld/ImplicitTldRuleSet.java
@@ -51,6 +51,13 @@ public class ImplicitTldRuleSet implements RuleSet {
 public void begin(String namespace, String name, Attributes 
attributes) {
 TaglibXml taglibXml = (TaglibXml) digester.peek();
 taglibXml.setJspVersion(attributes.getValue("version"));
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+
code.append(digester.toVariableName(taglibXml)).append(".setJspVersion(\"");
+code.append(attributes.getValue("version")).append("\");");
+code.append(System.lineSeparator());
+}
 }
 });
 digester.addCallMethod(PREFIX + "/shortname", "setShortName", 0);
diff --git a/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java 
b/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
index f298fd3..9af81d2 100644
--- a/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
+++ b/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
@@ -50,6 +50,13 @@ public class TldRuleSet implements RuleSet {
 public void begin(String namespace, String name, Attributes 
attributes) {
 TaglibXml taglibXml = (TaglibXml) digester.peek();
 taglibXml.setJspVersion(attributes.getValue("version"));
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+
code.append(digester.toVariableName(taglibXml)).append(".setJspVersion(\"");
+code.append(attributes.getValue("version")).append("\");");
+code.append(System.lineSeparator());
+}
 }
 });
 digester.addCallMethod(PREFIX + "/shortname", "setShortName", 0);
@@ -137,10 +144,21 @@ public class TldRuleSet implements RuleSet {
 }
 
 private static class TagAttributeRule extends Rule {
+private boolean allowShortNames = false;
 @Override
 public void begin(String namespace, String name, Attributes 
attributes) throws Exception {
 TaglibXml taglibXml = (TaglibXml) 
digester.peek(digester.getCount() - 1);
-digester.push(new 
Attribute("1.2".equals(taglibXml.getJspVersion(;
+allowShortNames = "1.2".equals(taglibXml.getJspVersion());
+Attribute attribute = new Attribute(allowShortNames);
+digester.push(attribute);
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+code.append(TldRuleSet.class.getName()).append(".Attribute 
").append(digester.toVariableName(attribute)).append(" = new ");
+
code.append(TldRuleSet.class.getName()).append(".Attribute").append('(').append(Boolean.toString(allowShortNames));
+code.append(");").append(System.lineSeparator());
+}
 }
 
 @Override
@@ -148,6 +166,13 @@ public class TldRuleSet implements RuleSet {
 Attribute attribute = (Attribute) digester.pop();
 TagXml tag = (TagXml) digester.peek();
 tag.getAttributes().add(attribute.toTagAttributeInfo());
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+
code.append(digester.toVariableName(tag)).append(".getAttributes().add(");
+
code.append(digester.toVariableName(attribute)).append(".toTagAttributeInfo());");
+code.append(System.lineSeparator());
+}
 }
 }
 
@@ -286,7 +311,15 @@ public class TldRuleSet implements RuleSet {
 private static class ScriptVariableRule exte

[tomcat] branch master updated: Add code generation for TLD rules

2020-07-22 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new d467154  Add code generation for TLD rules
d467154 is described below

commit d467154447863ffd9120f0878eeecde711e04d74
Author: remm 
AuthorDate: Wed Jul 22 10:44:03 2020 +0200

Add code generation for TLD rules
---
 .../util/descriptor/tld/ImplicitTldRuleSet.java|  7 +++
 .../tomcat/util/descriptor/tld/TldRuleSet.java | 51 +-
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/descriptor/tld/ImplicitTldRuleSet.java 
b/java/org/apache/tomcat/util/descriptor/tld/ImplicitTldRuleSet.java
index 21dfe6a..9847be5 100644
--- a/java/org/apache/tomcat/util/descriptor/tld/ImplicitTldRuleSet.java
+++ b/java/org/apache/tomcat/util/descriptor/tld/ImplicitTldRuleSet.java
@@ -51,6 +51,13 @@ public class ImplicitTldRuleSet implements RuleSet {
 public void begin(String namespace, String name, Attributes 
attributes) {
 TaglibXml taglibXml = (TaglibXml) digester.peek();
 taglibXml.setJspVersion(attributes.getValue("version"));
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+
code.append(digester.toVariableName(taglibXml)).append(".setJspVersion(\"");
+code.append(attributes.getValue("version")).append("\");");
+code.append(System.lineSeparator());
+}
 }
 });
 digester.addCallMethod(PREFIX + "/shortname", "setShortName", 0);
diff --git a/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java 
b/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
index 4f43a47..5a92b1f 100644
--- a/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
+++ b/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
@@ -50,6 +50,13 @@ public class TldRuleSet implements RuleSet {
 public void begin(String namespace, String name, Attributes 
attributes) {
 TaglibXml taglibXml = (TaglibXml) digester.peek();
 taglibXml.setJspVersion(attributes.getValue("version"));
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+
code.append(digester.toVariableName(taglibXml)).append(".setJspVersion(\"");
+code.append(attributes.getValue("version")).append("\");");
+code.append(System.lineSeparator());
+}
 }
 });
 digester.addCallMethod(PREFIX + "/shortname", "setShortName", 0);
@@ -137,10 +144,21 @@ public class TldRuleSet implements RuleSet {
 }
 
 private static class TagAttributeRule extends Rule {
+private boolean allowShortNames = false;
 @Override
 public void begin(String namespace, String name, Attributes 
attributes) throws Exception {
 TaglibXml taglibXml = (TaglibXml) 
digester.peek(digester.getCount() - 1);
-digester.push(new 
Attribute("1.2".equals(taglibXml.getJspVersion(;
+allowShortNames = "1.2".equals(taglibXml.getJspVersion());
+Attribute attribute = new Attribute(allowShortNames);
+digester.push(attribute);
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+code.append(TldRuleSet.class.getName()).append(".Attribute 
").append(digester.toVariableName(attribute)).append(" = new ");
+
code.append(TldRuleSet.class.getName()).append(".Attribute").append('(').append(Boolean.toString(allowShortNames));
+code.append(");").append(System.lineSeparator());
+}
 }
 
 @Override
@@ -148,6 +166,13 @@ public class TldRuleSet implements RuleSet {
 Attribute attribute = (Attribute) digester.pop();
 TagXml tag = (TagXml) digester.peek();
 tag.getAttributes().add(attribute.toTagAttributeInfo());
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+
code.append(digester.toVariableName(tag)).append(".getAttributes().add(");
+
code.append(digester.toVariableName(attribute)).append(".toTagAttributeInfo());");
+code.append(System.lineSeparator());
+}
 }
 }
 
@@ -286,7 +311,15 @@ public class TldRuleSet implements RuleSet {
 private static class ScriptVariableRule exte

[tomcat] branch 9.0.x updated: Add a dedicated loader for generated code

2020-07-21 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new b8669f7  Add a dedicated loader for generated code
b8669f7 is described below

commit b8669f777de284d18a55993afb0e4847a35c195b
Author: remm 
AuthorDate: Tue Jul 21 11:19:07 2020 +0200

Add a dedicated loader for generated code

This avoids dynamic classloading, and calling the classaloder for not
found xml.
---
 java/org/apache/catalina/startup/Catalina.java | 59 +++---
 .../org/apache/catalina/startup/ContextConfig.java | 21 +++-
 .../catalina/startup/LocalStrings.properties   |  1 +
 java/org/apache/tomcat/util/digester/Digester.java | 34 +
 webapps/docs/changelog.xml |  4 ++
 5 files changed, 98 insertions(+), 21 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index 9683df9..134a236 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -554,8 +554,30 @@ public class Catalina {
 ConfigFileLoader.setSource(new 
CatalinaBaseConfigurationSource(Bootstrap.getCatalinaBaseFile(), 
getConfigFile()));
 File file = configFile();
 
+if (useGeneratedCode && !Digester.isGeneratedCodeLoaderSet()) {
+// Load loader
+String loaderClassName = generatedCodePackage + 
".DigesterGeneratedCodeLoader";
+try {
+Digester.GeneratedCodeLoader loader =
+(Digester.GeneratedCodeLoader) 
Catalina.class.getClassLoader().loadClass(loaderClassName).newInstance();
+Digester.setGeneratedCodeLoader(loader);
+} catch (Exception e) {
+if (log.isDebugEnabled()) {
+log.info(sm.getString("catalina.noLoader", 
loaderClassName), e);
+} else {
+log.info(sm.getString("catalina.noLoader", 
loaderClassName));
+}
+// No loader so don't use generated code
+useGeneratedCode = false;
+}
+}
+
 // Init source location
 File serverXmlLocation = null;
+String xmlClassName = null;
+if (generateCode || useGeneratedCode) {
+xmlClassName = start ? generatedCodePackage + ".ServerXml" : 
generatedCodePackage + ".ServerXmlStop";
+}
 if (generateCode) {
 if (generatedCodeLocationParameter != null) {
 generatedCodeLocation = new 
File(generatedCodeLocationParameter);
@@ -575,12 +597,7 @@ public class Catalina {
 
 ServerXml serverXml = null;
 if (useGeneratedCode) {
-String xmlClassName = start ? generatedCodePackage + ".ServerXml" 
: generatedCodePackage + ".ServerXmlStop";
-try {
-serverXml = (ServerXml) 
Catalina.class.getClassLoader().loadClass(xmlClassName).newInstance();
-} catch (Exception e) {
-// Ignore, no generated code found
-}
+serverXml = (ServerXml) Digester.loadGeneratedClass(xmlClassName);
 }
 
 if (serverXml != null) {
@@ -605,6 +622,7 @@ public class Catalina {
 writer.write(digester.getGeneratedCode().toString());
 }
 digester.endGeneratingCode();
+Digester.addGeneratedClass(xmlClassName);
 }
 } catch (Exception e) {
 log.warn(sm.getString("catalina.configFail", 
file.getAbsolutePath()), e);
@@ -766,6 +784,11 @@ public class Catalina {
 log.info(sm.getString("catalina.startup", 
Long.toString(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1;
 }
 
+if (generateCode) {
+// Generate loader which will load all generated classes
+generateLoader();
+}
+
 // Register shutdown hook
 if (useShutdownHook) {
 if (shutdownHook == null) {
@@ -908,6 +931,30 @@ public class Catalina {
 }
 
 
+protected void generateLoader() {
+String loaderClassName = "DigesterGeneratedCodeLoader";
+StringBuilder code = new StringBuilder();
+code.append("package 
").append(generatedCodePackage).append(";").append(System.lineSeparator());
+code.append("public class ").append(loaderClassName);
+code.append(" implements 
org.apache.tomcat.util.digester.Digester.GeneratedCodeLoader 
{").append(System.lineSeparator());
+code.append("public Object loadGeneratedCode(String className) 
{").append(System.lineSep

[tomcat] branch master updated (17dab7a -> 577d39f)

2020-07-21 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 17dab7a  Fix regression in fix for BZ 64540.
 add 577d39f  Add a dedicated loader for generated code

No new revisions were added by this update.

Summary of changes:
 java/org/apache/catalina/startup/Catalina.java | 59 +++---
 .../org/apache/catalina/startup/ContextConfig.java | 21 +++-
 .../catalina/startup/LocalStrings.properties   |  1 +
 java/org/apache/tomcat/util/digester/Digester.java | 34 +
 webapps/docs/changelog.xml |  4 ++
 5 files changed, 98 insertions(+), 21 deletions(-)


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



[tomcat] branch 9.0.x updated: Add missing code generation for remaining digester rules

2020-07-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 09b8bea  Add missing code generation for remaining digester rules
09b8bea is described below

commit 09b8beabed15572431863dd65bd08ed2dab86c7c
Author: remm 
AuthorDate: Mon Jul 20 11:30:44 2020 +0200

Add missing code generation for remaining digester rules

A quick test with the web.xml files from Tomcat looks rather decent. I
don't know yet if it will be used by at least the functionality is more
complete this way.
Another item that can be added is generating a static loader as at the
moment each individual generated class is dynamically loaded, even
though the full list is known.
---
 .../tomcat/util/descriptor/web/WebRuleSet.java | 150 +++--
 .../tomcat/util/digester/CallMethodRule.java   |   4 +-
 webapps/docs/changelog.xml |   3 +
 3 files changed, 143 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java 
b/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
index 237d1c1..6bb972f 100644
--- a/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
+++ b/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
@@ -799,6 +799,13 @@ final class SetAuthConstraintRule extends Rule {
 digester.getLogger()
.debug("Calling SecurityConstraint.setAuthConstraint(true)");
 }
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+
code.append(digester.toVariableName(securityConstraint)).append(".setAuthConstraint(true);");
+code.append(System.lineSeparator());
+}
 }
 
 }
@@ -823,6 +830,13 @@ final class SetDistributableRule extends Rule {
 digester.getLogger().debug
(webXml.getClass().getName() + ".setDistributable(true)");
 }
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+
code.append(digester.toVariableName(webXml)).append(".setDistributable(true);");
+code.append(System.lineSeparator());
+}
 }
 }
 
@@ -846,6 +860,13 @@ final class SetDenyUncoveredHttpMethodsRule extends Rule {
 digester.getLogger().debug(webXml.getClass().getName() +
 ".setDenyUncoveredHttpMethods(true)");
 }
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+
code.append(digester.toVariableName(webXml)).append(".setDenyUncoveredHttpMethods(true);");
+code.append(System.lineSeparator());
+}
 }
 }
 
@@ -887,6 +908,13 @@ final class SetPublicIdRule extends Rule {
 digester.getLogger().debug("" + top.getClass().getName() + "."
+ method + "(" + paramValues[0] + ")");
 
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+
code.append(digester.toVariableName(top)).append(".").append(method).append("(\"");
+code.append(digester.getPublicId()).append("\");");
+code.append(System.lineSeparator());
+}
 }
 
 }
@@ -910,6 +938,13 @@ final class ServletDefCreateRule extends Rule {
 digester.push(servletDef);
 if (digester.getLogger().isDebugEnabled())
 digester.getLogger().debug("new " + 
servletDef.getClass().getName());
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+code.append(ServletDef.class.getName()).append(' 
').append(digester.toVariableName(servletDef)).append(" = new ");
+
code.append(ServletDef.class.getName()).append("();").append(System.lineSeparator());
+}
 }
 
 @Override
@@ -918,6 +953,11 @@ final class ServletDefCreateRule extends Rule {
 ServletDef servletDef = (ServletDef) digester.pop();
 if (digester.getLogger().isDebugEnabled())
 digester.getLogger().debug("pop " + 
servletDef.getClass().getName());
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+}
 }
 
 }
@@ -1043,6 +1083,24 @@ final class CallMethodMultiRule extends CallMethodRule {
 }
 IntrospectionUtils.callMethodN(target, method

[tomcat] branch master updated: Add missing code generation for remaining digester rules

2020-07-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 07d6188  Add missing code generation for remaining digester rules
07d6188 is described below

commit 07d6188233fa4de87afbc83b7a3cb36e69556d4c
Author: remm 
AuthorDate: Mon Jul 20 11:30:44 2020 +0200

Add missing code generation for remaining digester rules

A quick test with the web.xml files from Tomcat looks rather decent. I
don't know yet if it will be used by at least the functionality is more
complete this way.
Another item that can be added is generating a static loader as at the
moment each individual generated class is dynamically loaded, even
though the full list is known.
---
 .../tomcat/util/descriptor/web/WebRuleSet.java | 150 +++--
 .../tomcat/util/digester/CallMethodRule.java   |   4 +-
 webapps/docs/changelog.xml |   3 +
 3 files changed, 143 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java 
b/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
index 237d1c1..6bb972f 100644
--- a/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
+++ b/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
@@ -799,6 +799,13 @@ final class SetAuthConstraintRule extends Rule {
 digester.getLogger()
.debug("Calling SecurityConstraint.setAuthConstraint(true)");
 }
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+
code.append(digester.toVariableName(securityConstraint)).append(".setAuthConstraint(true);");
+code.append(System.lineSeparator());
+}
 }
 
 }
@@ -823,6 +830,13 @@ final class SetDistributableRule extends Rule {
 digester.getLogger().debug
(webXml.getClass().getName() + ".setDistributable(true)");
 }
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+
code.append(digester.toVariableName(webXml)).append(".setDistributable(true);");
+code.append(System.lineSeparator());
+}
 }
 }
 
@@ -846,6 +860,13 @@ final class SetDenyUncoveredHttpMethodsRule extends Rule {
 digester.getLogger().debug(webXml.getClass().getName() +
 ".setDenyUncoveredHttpMethods(true)");
 }
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+
code.append(digester.toVariableName(webXml)).append(".setDenyUncoveredHttpMethods(true);");
+code.append(System.lineSeparator());
+}
 }
 }
 
@@ -887,6 +908,13 @@ final class SetPublicIdRule extends Rule {
 digester.getLogger().debug("" + top.getClass().getName() + "."
+ method + "(" + paramValues[0] + ")");
 
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+
code.append(digester.toVariableName(top)).append(".").append(method).append("(\"");
+code.append(digester.getPublicId()).append("\");");
+code.append(System.lineSeparator());
+}
 }
 
 }
@@ -910,6 +938,13 @@ final class ServletDefCreateRule extends Rule {
 digester.push(servletDef);
 if (digester.getLogger().isDebugEnabled())
 digester.getLogger().debug("new " + 
servletDef.getClass().getName());
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+code.append(ServletDef.class.getName()).append(' 
').append(digester.toVariableName(servletDef)).append(" = new ");
+
code.append(ServletDef.class.getName()).append("();").append(System.lineSeparator());
+}
 }
 
 @Override
@@ -918,6 +953,11 @@ final class ServletDefCreateRule extends Rule {
 ServletDef servletDef = (ServletDef) digester.pop();
 if (digester.getLogger().isDebugEnabled())
 digester.getLogger().debug("pop " + 
servletDef.getClass().getName());
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+code.append(System.lineSeparator());
+}
 }
 
 }
@@ -1043,6 +1083,24 @@ final class CallMethodMultiRule extends CallMethodRule {
 }
 IntrospectionUtils.callMethodN(target, method

[tomcat] branch 9.0.x updated: Avoid possibly problematic default package name

2020-07-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 658425c  Avoid possibly problematic default package name
658425c is described below

commit 658425c8213ee7af4b822e4804bf61ecf87a89ca
Author: remm 
AuthorDate: Fri Jul 17 14:16:27 2020 +0200

Avoid possibly problematic default package name

Allow future configuration if needed.
---
 java/org/apache/catalina/startup/Catalina.java | 22 +++---
 .../org/apache/catalina/startup/ContextConfig.java | 20 +++-
 webapps/docs/changelog.xml |  5 +
 3 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index aa8fe4c..9683df9 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -152,6 +152,12 @@ public class Catalina {
 
 
 /**
+ * Top package name for generated source.
+ */
+protected String generatedCodePackage = "catalinaembedded";
+
+
+/**
  * Use generated code as a replacement for configuration files.
  */
 protected boolean useGeneratedCode = false;
@@ -217,6 +223,16 @@ public class Catalina {
 }
 
 
+public String getGeneratedCodePackage() {
+return this.generatedCodePackage;
+}
+
+
+public void setGeneratedCodePackage(String generatedCodePackage) {
+this.generatedCodePackage = generatedCodePackage;
+}
+
+
 /**
  * Set the shared extensions class loader.
  *
@@ -549,7 +565,7 @@ public class Catalina {
 } else {
 generatedCodeLocation = new 
File(Bootstrap.getCatalinaHomeFile(), "work");
 }
-serverXmlLocation = new File(generatedCodeLocation, "catalina");
+serverXmlLocation = new File(generatedCodeLocation, 
generatedCodePackage);
 if (!serverXmlLocation.isDirectory() && 
!serverXmlLocation.mkdirs()) {
 log.warn(sm.getString("catalina.generatedCodeLocationError", 
generatedCodeLocation.getAbsolutePath()));
 // Disable code generation
@@ -559,7 +575,7 @@ public class Catalina {
 
 ServerXml serverXml = null;
 if (useGeneratedCode) {
-String xmlClassName = start ? "catalina.ServerXml" : 
"catalina.ServerXmlStop";
+String xmlClassName = start ? generatedCodePackage + ".ServerXml" 
: generatedCodePackage + ".ServerXmlStop";
 try {
 serverXml = (ServerXml) 
Catalina.class.getClassLoader().loadClass(xmlClassName).newInstance();
 } catch (Exception e) {
@@ -894,7 +910,7 @@ public class Catalina {
 
 protected void generateClassHeader(Digester digester, boolean start) {
 StringBuilder code = digester.getGeneratedCode();
-code.append("package catalina;").append(System.lineSeparator());
+code.append("package 
").append(generatedCodePackage).append(";").append(System.lineSeparator());
 code.append("public class ServerXml");
 if (!start) {
 code.append("Stop");
diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index ebb65b0..4a79c2c 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -474,7 +474,17 @@ public class ContextConfig implements LifecycleListener {
 }
 
 
-protected static String getContextXmlPackageName(Container container) {
+protected String getGeneratedCodePackage() {
+Catalina catalina = 
Container.getService(context).getServer().getCatalina();
+if (catalina != null) {
+return catalina.getGeneratedCodePackage();
+} else {
+return "generatedCodePackage";
+}
+}
+
+
+protected static String getContextXmlPackageName(String 
generatedCodePackge, Container container) {
 StringBuilder result = new StringBuilder();
 Container host = null;
 Container engine = null;
@@ -486,7 +496,7 @@ public class ContextConfig implements LifecycleListener {
 }
 container = container.getParent();
 }
-result.append("catalina");
+result.append(generatedCodePackge);
 if (engine != null) {
 result.append('.');
 }
@@ -574,7 +584,7 @@ public class ContextConfig implements LifecycleListener {
 if (!context.getOverride()) {
 
 if (useGeneratedCode || generateCode) {
-contextXmlPackageName = "catalina";
+contextXm

[tomcat] branch master updated: Avoid possibly problematic default package name

2020-07-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 4071a0d  Avoid possibly problematic default package name
4071a0d is described below

commit 4071a0dbc4396c9158c0ef3660ca368f2ab93837
Author: remm 
AuthorDate: Fri Jul 17 14:16:27 2020 +0200

Avoid possibly problematic default package name

Allow future configuration if needed.
---
 java/org/apache/catalina/startup/Catalina.java | 22 +++---
 .../org/apache/catalina/startup/ContextConfig.java | 20 +++-
 webapps/docs/changelog.xml |  5 +
 3 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index 2c3f994..2f83d7e 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -159,6 +159,12 @@ public class Catalina {
 
 
 /**
+ * Top package name for generated source.
+ */
+protected String generatedCodePackage = "catalinaembedded";
+
+
+/**
  * Use generated code as a replacement for configuration files.
  */
 protected boolean useGeneratedCode = false;
@@ -224,6 +230,16 @@ public class Catalina {
 }
 
 
+public String getGeneratedCodePackage() {
+return this.generatedCodePackage;
+}
+
+
+public void setGeneratedCodePackage(String generatedCodePackage) {
+this.generatedCodePackage = generatedCodePackage;
+}
+
+
 /**
  * @return true if an exception should be thrown if an error
  * occurs during server init
@@ -574,7 +590,7 @@ public class Catalina {
 } else {
 generatedCodeLocation = new 
File(Bootstrap.getCatalinaHomeFile(), "work");
 }
-serverXmlLocation = new File(generatedCodeLocation, "catalina");
+serverXmlLocation = new File(generatedCodeLocation, 
generatedCodePackage);
 if (!serverXmlLocation.isDirectory() && 
!serverXmlLocation.mkdirs()) {
 log.warn(sm.getString("catalina.generatedCodeLocationError", 
generatedCodeLocation.getAbsolutePath()));
 // Disable code generation
@@ -584,7 +600,7 @@ public class Catalina {
 
 ServerXml serverXml = null;
 if (useGeneratedCode) {
-String xmlClassName = start ? "catalina.ServerXml" : 
"catalina.ServerXmlStop";
+String xmlClassName = start ? generatedCodePackage + ".ServerXml" 
: generatedCodePackage + ".ServerXmlStop";
 try {
 serverXml = (ServerXml) 
Catalina.class.getClassLoader().loadClass(xmlClassName).newInstance();
 } catch (Exception e) {
@@ -909,7 +925,7 @@ public class Catalina {
 
 protected void generateClassHeader(Digester digester, boolean start) {
 StringBuilder code = digester.getGeneratedCode();
-code.append("package catalina;").append(System.lineSeparator());
+code.append("package 
").append(generatedCodePackage).append(";").append(System.lineSeparator());
 code.append("public class ServerXml");
 if (!start) {
 code.append("Stop");
diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 19a1d80..dff8d1d 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -474,7 +474,17 @@ public class ContextConfig implements LifecycleListener {
 }
 
 
-protected static String getContextXmlPackageName(Container container) {
+protected String getGeneratedCodePackage() {
+Catalina catalina = 
Container.getService(context).getServer().getCatalina();
+if (catalina != null) {
+return catalina.getGeneratedCodePackage();
+} else {
+return "generatedCodePackage";
+}
+}
+
+
+protected static String getContextXmlPackageName(String 
generatedCodePackge, Container container) {
 StringBuilder result = new StringBuilder();
 Container host = null;
 Container engine = null;
@@ -486,7 +496,7 @@ public class ContextConfig implements LifecycleListener {
 }
 container = container.getParent();
 }
-result.append("catalina");
+result.append(generatedCodePackge);
 if (engine != null) {
 result.append('.');
 }
@@ -574,7 +584,7 @@ public class ContextConfig implements LifecycleListener {
 if (!context.getOverride()) {
 
 if (useGeneratedCode || generateCode) {
-contextXm

[tomcat] branch 7.0.x updated: Remove obsolete commented out ideas

2020-07-10 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 32d3e4b  Remove obsolete commented out ideas
32d3e4b is described below

commit 32d3e4b8776a5aaac16bf17a801a5318c9145f26
Author: remm 
AuthorDate: Fri Jul 10 16:09:26 2020 +0200

Remove obsolete commented out ideas

The NamingResources now hold and manage these.
---
 .../org/apache/catalina/startup/ContextConfig.java | 51 --
 1 file changed, 51 deletions(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 3cc4807..aff9a02 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -959,22 +959,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeConstraint(securityConstraints[i]);
 }
 
-// Removing Ejbs
-/*
-ContextEjb[] contextEjbs = context.findEjbs();
-for (i = 0; i < contextEjbs.length; i++) {
-context.removeEjb(contextEjbs[i].getName());
-}
-*/
-
-// Removing environments
-/*
-ContextEnvironment[] contextEnvironments = context.findEnvironments();
-for (i = 0; i < contextEnvironments.length; i++) {
-context.removeEnvironment(contextEnvironments[i].getName());
-}
-*/
-
 // Removing errors pages
 ErrorPage[] errorPages = context.findErrorPages();
 for (i = 0; i < errorPages.length; i++) {
@@ -993,14 +977,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeFilterMap(filterMaps[i]);
 }
 
-// Removing local ejbs
-/*
-ContextLocalEjb[] contextLocalEjbs = context.findLocalEjbs();
-for (i = 0; i < contextLocalEjbs.length; i++) {
-context.removeLocalEjb(contextLocalEjbs[i].getName());
-}
-*/
-
 // Removing Mime mappings
 String[] mimeMappings = context.findMimeMappings();
 for (i = 0; i < mimeMappings.length; i++) {
@@ -1013,31 +989,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeParameter(parameters[i]);
 }
 
-// Removing resource env refs
-/*
-String[] resourceEnvRefs = context.findResourceEnvRefs();
-for (i = 0; i < resourceEnvRefs.length; i++) {
-context.removeResourceEnvRef(resourceEnvRefs[i]);
-}
-*/
-
-// Removing resource links
-/*
-ContextResourceLink[] contextResourceLinks =
-context.findResourceLinks();
-for (i = 0; i < contextResourceLinks.length; i++) {
-context.removeResourceLink(contextResourceLinks[i].getName());
-}
-*/
-
-// Removing resources
-/*
-ContextResource[] contextResources = context.findResources();
-for (i = 0; i < contextResources.length; i++) {
-context.removeResource(contextResources[i].getName());
-}
-*/
-
 // Removing security role
 String[] securityRoles = context.findSecurityRoles();
 for (i = 0; i < securityRoles.length; i++) {
@@ -1050,8 +1001,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeServletMapping(servletMappings[i]);
 }
 
-// FIXME : Removing status pages
-
 // Removing welcome files
 String[] welcomeFiles = context.findWelcomeFiles();
 for (i = 0; i < welcomeFiles.length; i++) {


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



[tomcat] branch 8.5.x updated: Remove obsolete commented out ideas

2020-07-10 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 9eff420  Remove obsolete commented out ideas
9eff420 is described below

commit 9eff420acff085bbada9ece0c88cddc360a66341
Author: remm 
AuthorDate: Fri Jul 10 16:09:26 2020 +0200

Remove obsolete commented out ideas

The NamingResources now hold and manage these.
---
 .../org/apache/catalina/startup/ContextConfig.java | 51 --
 1 file changed, 51 deletions(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 1d89e3f..846a2d0 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -849,22 +849,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeConstraint(securityConstraints[i]);
 }
 
-// Removing Ejbs
-/*
-ContextEjb[] contextEjbs = context.findEjbs();
-for (i = 0; i < contextEjbs.length; i++) {
-context.removeEjb(contextEjbs[i].getName());
-}
-*/
-
-// Removing environments
-/*
-ContextEnvironment[] contextEnvironments = context.findEnvironments();
-for (i = 0; i < contextEnvironments.length; i++) {
-context.removeEnvironment(contextEnvironments[i].getName());
-}
-*/
-
 // Removing errors pages
 ErrorPage[] errorPages = context.findErrorPages();
 for (i = 0; i < errorPages.length; i++) {
@@ -883,14 +867,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeFilterMap(filterMaps[i]);
 }
 
-// Removing local ejbs
-/*
-ContextLocalEjb[] contextLocalEjbs = context.findLocalEjbs();
-for (i = 0; i < contextLocalEjbs.length; i++) {
-context.removeLocalEjb(contextLocalEjbs[i].getName());
-}
-*/
-
 // Removing Mime mappings
 String[] mimeMappings = context.findMimeMappings();
 for (i = 0; i < mimeMappings.length; i++) {
@@ -903,31 +879,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeParameter(parameters[i]);
 }
 
-// Removing resource env refs
-/*
-String[] resourceEnvRefs = context.findResourceEnvRefs();
-for (i = 0; i < resourceEnvRefs.length; i++) {
-context.removeResourceEnvRef(resourceEnvRefs[i]);
-}
-*/
-
-// Removing resource links
-/*
-ContextResourceLink[] contextResourceLinks =
-context.findResourceLinks();
-for (i = 0; i < contextResourceLinks.length; i++) {
-context.removeResourceLink(contextResourceLinks[i].getName());
-}
-*/
-
-// Removing resources
-/*
-ContextResource[] contextResources = context.findResources();
-for (i = 0; i < contextResources.length; i++) {
-context.removeResource(contextResources[i].getName());
-}
-*/
-
 // Removing security role
 String[] securityRoles = context.findSecurityRoles();
 for (i = 0; i < securityRoles.length; i++) {
@@ -940,8 +891,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeServletMapping(servletMappings[i]);
 }
 
-// FIXME : Removing status pages
-
 // Removing welcome files
 String[] welcomeFiles = context.findWelcomeFiles();
 for (i = 0; i < welcomeFiles.length; i++) {


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



[tomcat] branch 9.0.x updated: Remove obsolete commented out ideas

2020-07-10 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 6598898  Remove obsolete commented out ideas
6598898 is described below

commit 6598898e32b06547228c8187ba5fd9a32181ea2a
Author: remm 
AuthorDate: Fri Jul 10 16:09:26 2020 +0200

Remove obsolete commented out ideas

The NamingResources now hold and manage these.
---
 .../org/apache/catalina/startup/ContextConfig.java | 51 --
 1 file changed, 51 deletions(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 630b7c3..ebb65b0 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -1054,22 +1054,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeConstraint(securityConstraints[i]);
 }
 
-// Removing Ejbs
-/*
-ContextEjb[] contextEjbs = context.findEjbs();
-for (i = 0; i < contextEjbs.length; i++) {
-context.removeEjb(contextEjbs[i].getName());
-}
-*/
-
-// Removing environments
-/*
-ContextEnvironment[] contextEnvironments = context.findEnvironments();
-for (i = 0; i < contextEnvironments.length; i++) {
-context.removeEnvironment(contextEnvironments[i].getName());
-}
-*/
-
 // Removing errors pages
 ErrorPage[] errorPages = context.findErrorPages();
 for (i = 0; i < errorPages.length; i++) {
@@ -1088,14 +1072,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeFilterMap(filterMaps[i]);
 }
 
-// Removing local ejbs
-/*
-ContextLocalEjb[] contextLocalEjbs = context.findLocalEjbs();
-for (i = 0; i < contextLocalEjbs.length; i++) {
-context.removeLocalEjb(contextLocalEjbs[i].getName());
-}
-*/
-
 // Removing Mime mappings
 String[] mimeMappings = context.findMimeMappings();
 for (i = 0; i < mimeMappings.length; i++) {
@@ -1108,31 +1084,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeParameter(parameters[i]);
 }
 
-// Removing resource env refs
-/*
-String[] resourceEnvRefs = context.findResourceEnvRefs();
-for (i = 0; i < resourceEnvRefs.length; i++) {
-context.removeResourceEnvRef(resourceEnvRefs[i]);
-}
-*/
-
-// Removing resource links
-/*
-ContextResourceLink[] contextResourceLinks =
-context.findResourceLinks();
-for (i = 0; i < contextResourceLinks.length; i++) {
-context.removeResourceLink(contextResourceLinks[i].getName());
-}
-*/
-
-// Removing resources
-/*
-ContextResource[] contextResources = context.findResources();
-for (i = 0; i < contextResources.length; i++) {
-context.removeResource(contextResources[i].getName());
-}
-*/
-
 // Removing security role
 String[] securityRoles = context.findSecurityRoles();
 for (i = 0; i < securityRoles.length; i++) {
@@ -1145,8 +1096,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeServletMapping(servletMappings[i]);
 }
 
-// FIXME : Removing status pages
-
 // Removing welcome files
 String[] welcomeFiles = context.findWelcomeFiles();
 for (i = 0; i < welcomeFiles.length; i++) {


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



[tomcat] branch master updated: Remove obsolete commented out ideas

2020-07-10 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 407105e  Remove obsolete commented out ideas
407105e is described below

commit 407105e94eaac3a56d1e3e41cdfbbd654833494d
Author: remm 
AuthorDate: Fri Jul 10 16:09:26 2020 +0200

Remove obsolete commented out ideas

The NamingResources now hold and manage these.
---
 .../org/apache/catalina/startup/ContextConfig.java | 51 --
 1 file changed, 51 deletions(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 307d4b8..19a1d80 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -1054,22 +1054,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeConstraint(securityConstraints[i]);
 }
 
-// Removing Ejbs
-/*
-ContextEjb[] contextEjbs = context.findEjbs();
-for (i = 0; i < contextEjbs.length; i++) {
-context.removeEjb(contextEjbs[i].getName());
-}
-*/
-
-// Removing environments
-/*
-ContextEnvironment[] contextEnvironments = context.findEnvironments();
-for (i = 0; i < contextEnvironments.length; i++) {
-context.removeEnvironment(contextEnvironments[i].getName());
-}
-*/
-
 // Removing errors pages
 ErrorPage[] errorPages = context.findErrorPages();
 for (i = 0; i < errorPages.length; i++) {
@@ -1088,14 +1072,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeFilterMap(filterMaps[i]);
 }
 
-// Removing local ejbs
-/*
-ContextLocalEjb[] contextLocalEjbs = context.findLocalEjbs();
-for (i = 0; i < contextLocalEjbs.length; i++) {
-context.removeLocalEjb(contextLocalEjbs[i].getName());
-}
-*/
-
 // Removing Mime mappings
 String[] mimeMappings = context.findMimeMappings();
 for (i = 0; i < mimeMappings.length; i++) {
@@ -1108,31 +1084,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeParameter(parameters[i]);
 }
 
-// Removing resource env refs
-/*
-String[] resourceEnvRefs = context.findResourceEnvRefs();
-for (i = 0; i < resourceEnvRefs.length; i++) {
-context.removeResourceEnvRef(resourceEnvRefs[i]);
-}
-*/
-
-// Removing resource links
-/*
-ContextResourceLink[] contextResourceLinks =
-context.findResourceLinks();
-for (i = 0; i < contextResourceLinks.length; i++) {
-context.removeResourceLink(contextResourceLinks[i].getName());
-}
-*/
-
-// Removing resources
-/*
-ContextResource[] contextResources = context.findResources();
-for (i = 0; i < contextResources.length; i++) {
-context.removeResource(contextResources[i].getName());
-}
-*/
-
 // Removing security role
 String[] securityRoles = context.findSecurityRoles();
 for (i = 0; i < securityRoles.length; i++) {
@@ -1145,8 +1096,6 @@ public class ContextConfig implements LifecycleListener {
 context.removeServletMapping(servletMappings[i]);
 }
 
-// FIXME : Removing status pages
-
 // Removing welcome files
 String[] welcomeFiles = context.findWelcomeFiles();
 for (i = 0; i < welcomeFiles.length; i++) {


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



[tomcat] branch master updated: Push removal to the next major version

2020-07-08 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 0678edb  Push removal to the next major version
0678edb is described below

commit 0678edb189afc5a285d33b3fe033052e6bc31aad
Author: remm 
AuthorDate: Wed Jul 8 10:07:50 2020 +0200

Push removal to the next major version
---
 java/org/apache/coyote/Request.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/Request.java 
b/java/org/apache/coyote/Request.java
index dc77bf0..a2af283 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -571,7 +571,7 @@ public final class Request {
 /**
  *
  * @param startTime time
- * @deprecated This setter will be removed in Tomcat 10.1.
+ * @deprecated This setter will be removed in Tomcat 11
  */
 @Deprecated
 public void setStartTime(long startTime) {


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



[tomcat] branch master updated: Remove deprecated items marked for Tomcat 10 removal

2020-07-08 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new c180b3e  Remove deprecated items marked for Tomcat 10 removal
c180b3e is described below

commit c180b3e160aff5e2374fcf987bac9c0e589b0b94
Author: remm 
AuthorDate: Wed Jul 8 09:57:11 2020 +0200

Remove deprecated items marked for Tomcat 10 removal

Noticed while I was looking at CookieProcessor.
---
 .../apache/tomcat/util/http/CookieProcessor.java   | 25 +--
 .../tomcat/util/http/LegacyCookieProcessor.java|  6 
 .../tomcat/util/http/Rfc6265CookieProcessor.java   |  6 
 .../util/http/TestCookieProcessorGeneration.java   | 36 +++---
 webapps/docs/changelog.xml |  8 +
 5 files changed, 27 insertions(+), 54 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/CookieProcessor.java 
b/java/org/apache/tomcat/util/http/CookieProcessor.java
index c230d4f..6ea0fe9 100644
--- a/java/org/apache/tomcat/util/http/CookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/CookieProcessor.java
@@ -34,21 +34,6 @@ public interface CookieProcessor {
 
 /**
  * Generate the {@code Set-Cookie} HTTP header value for the given Cookie.
- *
- * @param cookie The cookie for which the header will be generated
- *
- * @return The header value in a form that can be added directly to the
- * response
- *
- * @deprecated This method has been replaced with
- * {@link #generateHeader(Cookie, HttpServletRequest)} and will
- * be removed from Tomcat 10 onwards.
- */
-@Deprecated
-String generateHeader(Cookie cookie);
-
-/**
- * Generate the {@code Set-Cookie} HTTP header value for the given Cookie.
  * This method receives as parameter the servlet request so that it can 
make
  * decisions based on request properties. One such use-case is decide if 
the
  * SameSite attribute should be added to the cookie based on the User-Agent
@@ -56,12 +41,6 @@ public interface CookieProcessor {
  * with the SameSite attribute. This is described by https://www.chromium.org/updates/same-site/incompatible-clients;>the
  * Chromium project.
- * 
- * The default implementation calls the deprecated
- * {@link #generateHeader(Cookie)} method. Implementors should not rely on
- * this default method as it is present only for transitional compatibility
- * and will be removed in Tomcat 10 at the same time as the
- * {@link #generateHeader(Cookie)} method.
  *
  * @param request The servlet request
  *
@@ -70,9 +49,7 @@ public interface CookieProcessor {
  * @return The header value in a form that can be added directly to the
  * response
  */
-default String generateHeader(Cookie cookie, HttpServletRequest request) {
-return generateHeader(cookie);
-}
+String generateHeader(Cookie cookie, HttpServletRequest request);
 
 /**
  * Obtain the character set that will be used when converting between bytes
diff --git a/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java 
b/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
index a3fc73b..9a5078e 100644
--- a/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
@@ -234,12 +234,6 @@ public final class LegacyCookieProcessor extends 
CookieProcessorBase {
 
 
 @Override
-public String generateHeader(Cookie cookie) {
-return generateHeader(cookie, null);
-}
-
-
-@Override
 public String generateHeader(Cookie cookie, HttpServletRequest request) {
 
 /*
diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java 
b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
index d747880..0864750 100644
--- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
@@ -100,12 +100,6 @@ public class Rfc6265CookieProcessor extends 
CookieProcessorBase {
 
 
 @Override
-public String generateHeader(jakarta.servlet.http.Cookie cookie) {
-return generateHeader(cookie, null);
-}
-
-
-@Override
 public String generateHeader(jakarta.servlet.http.Cookie cookie, 
HttpServletRequest request) {
 
 // Can't use StringBuilder due to DateFormat
diff --git 
a/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java 
b/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
index dfbd794..166be60 100644
--- a/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
+++ b/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
@@ -261,32 +261,32 @@ public class TestCookieProcessorGeneration {
 
 Cookie cookie = 

[tomcat] branch master updated: Push removal to the next major version

2020-07-08 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new f95125c  Push removal to the next major version
f95125c is described below

commit f95125cb2579b23a97472f345030ccf3e0f5776c
Author: remm 
AuthorDate: Wed Jul 8 09:55:50 2020 +0200

Push removal to the next major version
---
 java/org/apache/catalina/realm/GenericPrincipal.java | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/realm/GenericPrincipal.java 
b/java/org/apache/catalina/realm/GenericPrincipal.java
index 6d57730..7260da4 100644
--- a/java/org/apache/catalina/realm/GenericPrincipal.java
+++ b/java/org/apache/catalina/realm/GenericPrincipal.java
@@ -68,7 +68,7 @@ public class GenericPrincipal implements TomcatPrincipal, 
Serializable {
  * @param password  Unused
  * @param roles List of roles (must be Strings) possessed by this user
  *
- * @deprecated This method will be removed in Tomcat 10.0.1 onwards
+ * @deprecated This method will be removed in Tomcat 11 onwards
  */
 @Deprecated
 public GenericPrincipal(String name, String password, List roles) {
@@ -99,7 +99,7 @@ public class GenericPrincipal implements TomcatPrincipal, 
Serializable {
  * @param userPrincipal - the principal to be returned from the request
  *getUserPrincipal call if not null; if null, this will be returned
  *
- * @deprecated This method will be removed in Tomcat 10.0.1 onwards
+ * @deprecated This method will be removed in Tomcat 11 onwards
  */
 @Deprecated
 public GenericPrincipal(String name, String password, List roles,
@@ -135,7 +135,7 @@ public class GenericPrincipal implements TomcatPrincipal, 
Serializable {
  * @param loginContext  - If provided, this will be used to log out the 
user
  *at the appropriate time
  *
- * @deprecated This method will be removed in Tomcat 10.0.1 onwards
+ * @deprecated This method will be removed in Tomcat 11 onwards
  */
 @Deprecated
 public GenericPrincipal(String name, String password, List roles,
@@ -187,7 +187,7 @@ public class GenericPrincipal implements TomcatPrincipal, 
Serializable {
  *at the appropriate time
  * @param gssCredential - If provided, the user's delegated credentials
  *
- * @deprecated This method will be removed in Tomcat 10.0.1 onwards
+ * @deprecated This method will be removed in Tomcat 11 onwards
  */
 @Deprecated
 public GenericPrincipal(String name, String password, List roles,


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



[tomcat] 01/02: Revert "Direct use of the ALPN API"

2020-07-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 35d84487fd10bfd6f2a00494078a5e3eef1b1830
Author: remm 
AuthorDate: Fri Jul 3 11:16:24 2020 +0200

Revert "Direct use of the ALPN API"

This reverts commit 7763877a98e5c74bb579b64f31e938fea17290a5.
---
 java/org/apache/tomcat/util/compat/JreCompat.java  | 69 ++
 .../tomcat/util/compat/LocalStrings.properties |  3 +
 .../tomcat/util/net/AbstractJsseEndpoint.java  | 20 ++-
 .../apache/tomcat/util/net/SSLImplementation.java  |  1 +
 java/org/apache/tomcat/util/net/SSLUtil.java   | 12 
 .../apache/tomcat/util/net/SecureNio2Channel.java  |  9 ++-
 .../apache/tomcat/util/net/SecureNioChannel.java   |  9 ++-
 .../tomcat/util/net/jsse/JSSEImplementation.java   |  5 ++
 .../tomcat/util/net/openssl/OpenSSLEngine.java |  5 +-
 .../util/net/openssl/OpenSSLImplementation.java|  5 ++
 10 files changed, 131 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/JreCompat.java 
b/java/org/apache/tomcat/util/compat/JreCompat.java
index 2f0268f..8275e60 100644
--- a/java/org/apache/tomcat/util/compat/JreCompat.java
+++ b/java/org/apache/tomcat/util/compat/JreCompat.java
@@ -19,11 +19,18 @@ package org.apache.tomcat.util.compat;
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.Deque;
 import java.util.jar.JarFile;
 
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLParameters;
+
+import org.apache.tomcat.util.res.StringManager;
+
 /**
  * This is the base implementation class for JRE compatibility and provides an
  * implementation based on Java 8. Sub-classes may extend this class and 
provide
@@ -37,6 +44,10 @@ public class JreCompat {
 private static final boolean graalAvailable;
 private static final boolean jre11Available;
 private static final boolean jre9Available;
+private static final StringManager sm = 
StringManager.getManager(JreCompat.class);
+
+protected static final Method setApplicationProtocolsMethod;
+protected static final Method getApplicationProtocolMethod;
 
 static {
 // This is Tomcat 9 with a minimum Java version of Java 8.
@@ -55,6 +66,17 @@ public class JreCompat {
 jre9Available = false;
 }
 jre11Available = instance.jarFileRuntimeMajorVersion() >= 11;
+
+Method m1 = null;
+Method m2 = null;
+try {
+m1 = SSLParameters.class.getMethod("setApplicationProtocols", 
String[].class);
+m2 = SSLEngine.class.getMethod("getApplicationProtocol");
+} catch (ReflectiveOperationException | IllegalArgumentException e) {
+// Only the newest Java 8 have the ALPN API, so ignore
+}
+setApplicationProtocolsMethod = m1;
+getApplicationProtocolMethod = m2;
 }
 
 
@@ -68,6 +90,11 @@ public class JreCompat {
 }
 
 
+public static boolean isAlpnSupported() {
+return setApplicationProtocolsMethod != null && 
getApplicationProtocolMethod != null;
+}
+
+
 public static boolean isJre9Available() {
 return jre9Available;
 }
@@ -96,6 +123,48 @@ public class JreCompat {
 
 
 /**
+ * Set the application protocols the server will accept for ALPN
+ *
+ * @param sslParameters The SSL parameters for a connection
+ * @param protocols The application protocols to be allowed for that
+ *  connection
+ */
+public void setApplicationProtocols(SSLParameters sslParameters, String[] 
protocols) {
+if (setApplicationProtocolsMethod != null) {
+try {
+setApplicationProtocolsMethod.invoke(sslParameters, (Object) 
protocols);
+} catch (IllegalAccessException | IllegalArgumentException | 
InvocationTargetException e) {
+throw new UnsupportedOperationException(e);
+}
+} else {
+throw new 
UnsupportedOperationException(sm.getString("jreCompat.noApplicationProtocols"));
+}
+}
+
+
+/**
+ * Get the application protocol that has been negotiated for connection
+ * associated with the given SSLEngine.
+ *
+ * @param sslEngine The SSLEngine for which to obtain the negotiated
+ *  protocol
+ *
+ * @return The name of the negotiated protocol
+ */
+public String getApplicationProtocol(SSLEngine sslEngine) {
+if (getApplicationProtocolMethod != null) {
+try {
+return (String) getApplicationProtocolMethod.invoke(sslEngine);
+} catch (IllegalAccessException | IllegalArgumentException | 
In

[tomcat] 02/02: Revert

2020-07-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 091f11ff5c31e32b8615347ec88cd97dc858885a
Author: remm 
AuthorDate: Fri Jul 3 11:17:40 2020 +0200

Revert
---
 webapps/docs/changelog.xml | 8 
 1 file changed, 8 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 16e4fb2..fcd4cc8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -45,14 +45,6 @@
   issues do not "pop up" wrt. others).
 -->
 
-  
-
-  
-Remove ALPN abstraction to simplify code. Tomcat now requires
-Java 8 251 or 252 for TLS support. (remm)
-  
-
-  
 
 
   


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



[tomcat] branch master updated (7763877 -> 091f11f)

2020-07-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 7763877  Direct use of the ALPN API
 new 35d8448  Revert "Direct use of the ALPN API"
 new 091f11f  Revert

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/tomcat/util/compat/JreCompat.java  | 69 ++
 .../tomcat/util/compat/LocalStrings.properties |  3 +
 .../tomcat/util/net/AbstractJsseEndpoint.java  | 20 ++-
 .../apache/tomcat/util/net/SSLImplementation.java  |  1 +
 java/org/apache/tomcat/util/net/SSLUtil.java   | 12 
 .../apache/tomcat/util/net/SecureNio2Channel.java  |  9 ++-
 .../apache/tomcat/util/net/SecureNioChannel.java   |  9 ++-
 .../tomcat/util/net/jsse/JSSEImplementation.java   |  5 ++
 .../tomcat/util/net/openssl/OpenSSLEngine.java |  5 +-
 .../util/net/openssl/OpenSSLImplementation.java|  5 ++
 webapps/docs/changelog.xml |  8 ---
 11 files changed, 131 insertions(+), 15 deletions(-)


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



[tomcat] branch master updated: Direct use of the ALPN API

2020-07-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 7763877  Direct use of the ALPN API
7763877 is described below

commit 7763877a98e5c74bb579b64f31e938fea17290a5
Author: remm 
AuthorDate: Fri Jul 3 10:37:58 2020 +0200

Direct use of the ALPN API

Tomcat 10 will now require at least Java 8_251, which was released in
April 2020, for TLS support. Any Java 9+ JVM will work too.
This will not be backported to Tomcat 9.0 as it slightly changes the
APIs, although the changes are trivial.
---
 java/org/apache/tomcat/util/compat/JreCompat.java  | 69 --
 .../tomcat/util/compat/LocalStrings.properties |  3 -
 .../tomcat/util/net/AbstractJsseEndpoint.java  | 20 +--
 .../apache/tomcat/util/net/SSLImplementation.java  |  1 -
 java/org/apache/tomcat/util/net/SSLUtil.java   | 12 
 .../apache/tomcat/util/net/SecureNio2Channel.java  |  9 +--
 .../apache/tomcat/util/net/SecureNioChannel.java   |  9 +--
 .../tomcat/util/net/jsse/JSSEImplementation.java   |  5 --
 .../tomcat/util/net/openssl/OpenSSLEngine.java |  5 +-
 .../util/net/openssl/OpenSSLImplementation.java|  5 --
 10 files changed, 7 insertions(+), 131 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/JreCompat.java 
b/java/org/apache/tomcat/util/compat/JreCompat.java
index 8275e60..2f0268f 100644
--- a/java/org/apache/tomcat/util/compat/JreCompat.java
+++ b/java/org/apache/tomcat/util/compat/JreCompat.java
@@ -19,18 +19,11 @@ package org.apache.tomcat.util.compat;
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.Deque;
 import java.util.jar.JarFile;
 
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLParameters;
-
-import org.apache.tomcat.util.res.StringManager;
-
 /**
  * This is the base implementation class for JRE compatibility and provides an
  * implementation based on Java 8. Sub-classes may extend this class and 
provide
@@ -44,10 +37,6 @@ public class JreCompat {
 private static final boolean graalAvailable;
 private static final boolean jre11Available;
 private static final boolean jre9Available;
-private static final StringManager sm = 
StringManager.getManager(JreCompat.class);
-
-protected static final Method setApplicationProtocolsMethod;
-protected static final Method getApplicationProtocolMethod;
 
 static {
 // This is Tomcat 9 with a minimum Java version of Java 8.
@@ -66,17 +55,6 @@ public class JreCompat {
 jre9Available = false;
 }
 jre11Available = instance.jarFileRuntimeMajorVersion() >= 11;
-
-Method m1 = null;
-Method m2 = null;
-try {
-m1 = SSLParameters.class.getMethod("setApplicationProtocols", 
String[].class);
-m2 = SSLEngine.class.getMethod("getApplicationProtocol");
-} catch (ReflectiveOperationException | IllegalArgumentException e) {
-// Only the newest Java 8 have the ALPN API, so ignore
-}
-setApplicationProtocolsMethod = m1;
-getApplicationProtocolMethod = m2;
 }
 
 
@@ -90,11 +68,6 @@ public class JreCompat {
 }
 
 
-public static boolean isAlpnSupported() {
-return setApplicationProtocolsMethod != null && 
getApplicationProtocolMethod != null;
-}
-
-
 public static boolean isJre9Available() {
 return jre9Available;
 }
@@ -123,48 +96,6 @@ public class JreCompat {
 
 
 /**
- * Set the application protocols the server will accept for ALPN
- *
- * @param sslParameters The SSL parameters for a connection
- * @param protocols The application protocols to be allowed for that
- *  connection
- */
-public void setApplicationProtocols(SSLParameters sslParameters, String[] 
protocols) {
-if (setApplicationProtocolsMethod != null) {
-try {
-setApplicationProtocolsMethod.invoke(sslParameters, (Object) 
protocols);
-} catch (IllegalAccessException | IllegalArgumentException | 
InvocationTargetException e) {
-throw new UnsupportedOperationException(e);
-}
-} else {
-throw new 
UnsupportedOperationException(sm.getString("jreCompat.noApplicationProtocols"));
-}
-}
-
-
-/**
- * Get the application protocol that has been negotiated for connection
- * associated with the given SSLEngine.
- *
- * @param sslEngine The SSLEngine for which to obtain the negotiated
- *  protocol
- *
- * @return The name of the negoti

[tomcat] branch master updated: Update changelog to verify Java version in CI

2020-07-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 7414188  Update changelog to verify Java version in CI
7414188 is described below

commit 7414188065876a79ce42d22776dc76ff58cea65c
Author: remm 
AuthorDate: Fri Jul 3 08:55:17 2020 +0200

Update changelog to verify Java version in CI
---
 webapps/docs/changelog.xml | 8 
 1 file changed, 8 insertions(+)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index fcd4cc8..16e4fb2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -45,6 +45,14 @@
   issues do not "pop up" wrt. others).
 -->
 
+  
+
+  
+Remove ALPN abstraction to simplify code. Tomcat now requires
+Java 8 251 or 252 for TLS support. (remm)
+  
+
+  
 
 
   


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



[tomcat] branch 9.0.x updated: Fix path

2020-06-29 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 47d7674  Fix path
47d7674 is described below

commit 47d76745c3cf84ab2bbf031a174833ce80861e3f
Author: remm 
AuthorDate: Mon Jun 29 22:44:28 2020 +0200

Fix path
---
 webapps/docs/graal.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/webapps/docs/graal.xml b/webapps/docs/graal.xml
index 442ba22..694ecab 100644
--- a/webapps/docs/graal.xml
+++ b/webapps/docs/graal.xml
@@ -64,9 +64,9 @@
 cd $JAVA_HOME/bin
 ./gu install native-image
Mandrel already includes the Native Image tool ready to use, so this
-   step can be skipped. Only JAVA_HOME must be set to the mandrelJDK folder,
-   such as:
-   export 
JAVA_HOME=/absolute...path...to/mandrel-javaXX-platform-x.x.x.x
+   step can be skipped. Only JAVA_HOME must be set to the folder which
+   contains the bin folder with the JVM binaries, such as:
+   export 
JAVA_HOME=/absolute...path...to/mandrel-javaXX-platform-x.x.x.x/mandrelJDK
   
 
   


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



[tomcat] branch master updated: Fix path

2020-06-29 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 19c191e  Fix path
19c191e is described below

commit 19c191ea029089c62ece640de27adb2fa18d5769
Author: remm 
AuthorDate: Mon Jun 29 22:44:28 2020 +0200

Fix path
---
 webapps/docs/graal.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/webapps/docs/graal.xml b/webapps/docs/graal.xml
index b89dc1d..aaafbd2 100644
--- a/webapps/docs/graal.xml
+++ b/webapps/docs/graal.xml
@@ -64,9 +64,9 @@
 cd $JAVA_HOME/bin
 ./gu install native-image
Mandrel already includes the Native Image tool ready to use, so this
-   step can be skipped. Only JAVA_HOME must be set to the mandrelJDK folder,
-   such as:
-   export 
JAVA_HOME=/absolute...path...to/mandrel-javaXX-platform-x.x.x.x
+   step can be skipped. Only JAVA_HOME must be set to the folder which
+   contains the bin folder with the JVM binaries, such as:
+   export 
JAVA_HOME=/absolute...path...to/mandrel-javaXX-platform-x.x.x.x/mandrelJDK
   
 
   


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



[tomcat] branch 9.0.x updated (dd35fd4 -> 1094d17)

2020-06-25 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from dd35fd4  Make sure recycle() is called once the Stream is closed
 new 9eec670  Delete AOT Maven packaging from 9
 new 1094d17  Update Graal documentation to reflect changes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 res/tomcat-maven/Dockerfile |  56 
 res/tomcat-maven/DockerfileGraal|  40 
 res/tomcat-maven/README.md  |  88 -
 res/tomcat-maven/graal-webapp.ant.xml   |  50 --
 res/tomcat-maven/pom.xml| 111 
 res/tomcat-maven/tomcat-jni.json|   7 --
 res/tomcat-maven/tomcat-reflection.json |  51 ---
 res/tomcat-maven/tomcat-resource.json   |  82 ---
 res/tomcat-maven/tomcat.yaml|  36 ---
 webapps/docs/graal.xml  |  70 +---
 10 files changed, 48 insertions(+), 543 deletions(-)
 delete mode 100644 res/tomcat-maven/Dockerfile
 delete mode 100644 res/tomcat-maven/DockerfileGraal
 delete mode 100644 res/tomcat-maven/README.md
 delete mode 100644 res/tomcat-maven/graal-webapp.ant.xml
 delete mode 100644 res/tomcat-maven/pom.xml
 delete mode 100644 res/tomcat-maven/tomcat-jni.json
 delete mode 100644 res/tomcat-maven/tomcat-reflection.json
 delete mode 100644 res/tomcat-maven/tomcat-resource.json
 delete mode 100644 res/tomcat-maven/tomcat.yaml


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



[tomcat] 02/02: Update Graal documentation to reflect changes

2020-06-25 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 1094d17cfbdfbbc635582fd133612e4b5907ea7d
Author: remm 
AuthorDate: Thu Jun 25 14:57:54 2020 +0200

Update Graal documentation to reflect changes
---
 webapps/docs/graal.xml | 70 ++
 1 file changed, 48 insertions(+), 22 deletions(-)

diff --git a/webapps/docs/graal.xml b/webapps/docs/graal.xml
index 0d9535f..442ba22 100644
--- a/webapps/docs/graal.xml
+++ b/webapps/docs/graal.xml
@@ -35,7 +35,7 @@
   
 
   
-Tomcat supports using the GraalVM Native Image tool to produce
+Tomcat supports using the GraalVM/Mandrel Native Image tool to produce
 a native binary including the container. This documentation page
 describes the build process of such an image.
   
@@ -49,21 +49,31 @@
 the process will use the Maven shade plugin JAR packaging (fat JAR). The
 idea is to produce a single JAR that contains all necessary classes from
 Tomcat, the webapps and all additional dependencies. Although Tomcat has
-received compatibility fixes to support GraalVM native images, any library
+received compatibility fixes to support native images, any library
 may not be compatible and may require replacement code (the GraalVM
 documentation has more details about this).
   
 
   
-Download and install GraalVM. The first step is then to add the
-native-image tool.
-export JAVA_HOME=/absolute...path...to/graalvm-ce-javaX-x.y.z
+Download and install GraalVM or Mandrel.
+  
+
+  
+   If using GraalVM, the first step is then to add the Native Image tool.
+   export JAVA_HOME=/absolute...path...to/graalvm-ce-javaX-x.y.z
 cd $JAVA_HOME/bin
 ./gu install native-image
-Download the Tomcat Maven packaging from
-https://github.com/apache/tomcat/tree/master/res/tomcat-maven and place
-all the files in a folder (named tomcat-maven in this documentation.
-export TOMCAT_MAVEN=/absolute...path...to/tomcat-maven
+   Mandrel already includes the Native Image tool ready to use, so this
+   step can be skipped. Only JAVA_HOME must be set to the mandrelJDK folder,
+   such as:
+   export 
JAVA_HOME=/absolute...path...to/mandrel-javaXX-platform-x.x.x.x
+  
+
+  
+Download the Tomcat Stuffed module from
+https://github.com/apache/tomcat/tree/master/modules/stuffed and place
+all the files in a folder stuffed in this documentation.
+export TOMCAT_STUFFED=/absolute...path...to/stuffed
 The build process now requires both Ant and Maven.
   
 
@@ -72,7 +82,7 @@ cd $JAVA_HOME/bin
   
 
   
-Inside the tomcat-maven folder, the directory structure is the same as for
+Inside the tomcat-stuffed folder, the directory structure is the same as 
for
 regular Tomcat. The main configuration files are placed in the conf folder,
 and if using the default server.xml the webapps are placed in the webapps
 folder.
@@ -81,14 +91,28 @@ cd $JAVA_HOME/bin
   
 The first step is to build the fat Tomcat JAR with all dependencies.
 Any JSP in the webapp must all be precompiled and packaged.
-cd $TOMCAT_MAVEN
+cd $TOMCAT_STUFFED
 mvn package
-ant -Dwebapp.name=somewebapp -f graal-webapp.ant.xml
+ant -Dwebapp.name=somewebapp -f webapp-jspc.ant.xml
 Dependencies for the webapp should now be added to the main pom.xml,
 following with building the complete fat JAR.
 mvn package
   
 
+  
+As it is best to avoid using reflection whenever possible with Ahead of
+Time compilation, it can be a good idea to generate and compile Tomcat
+Embedded code out of the main server.xml configuration as well as the
+context.xml files used to configure the contexts.
+$JAVA_HOME/bin/java\
+-Dcatalina.base=. 
-Djava.util.logging.config.file=conf/logging.properties\
+-jar target/tomcat-stuffed-1.0.jar --catalina -generateCode 
src/main/java
+mvn package
+The rest of the process described here will assume this step was done and
+the --catalina -useGeneratedCode arguments are added to the
+command lines. If this was not the case, they should be removed.
+  
+
   
 
   
@@ -103,9 +127,9 @@ ant -Dwebapp.name=somewebapp -f 
graal-webapp.ant.xml
   
 Run the GraalVM substrate VM using the trace agent:
 $JAVA_HOME/bin/java\
--agentlib:native-image-agent=config-output-dir=$TOMCAT_MAVEN/target/\
+-agentlib:native-image-agent=config-output-dir=$TOMCAT_STUFFED/target/\
 -Dcatalina.base=. 
-Djava.util.logging.config.file=conf/logging.properties\
--jar target/tomcat-maven-1.0.jar
+-jar target/tomcat-stuffed-1.0.jar --catalina 
-useGeneratedCode
   
 
   
@@ -136,18 +160,18 @@ ant -Dwebapp.name=somewebapp -f 
graal-webapp.ant.xml
 
--initialize-at-build-time=org.eclipse.jdt,org.apache.el.parser.SimpleNode,javax.servlet.jsp.JspFactory

[tomcat] 01/02: Delete AOT Maven packaging from 9

2020-06-25 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 9eec670512e044b0dc7f9e943375cf882e88e430
Author: remm 
AuthorDate: Thu Jun 25 15:00:25 2020 +0200

Delete AOT Maven packaging from 9

For now, it doesn't need separate duplicate instructions and
configuration, so no need to not use it from trunk.
---
 res/tomcat-maven/Dockerfile |  56 
 res/tomcat-maven/DockerfileGraal|  40 
 res/tomcat-maven/README.md  |  88 -
 res/tomcat-maven/graal-webapp.ant.xml   |  50 --
 res/tomcat-maven/pom.xml| 111 
 res/tomcat-maven/tomcat-jni.json|   7 --
 res/tomcat-maven/tomcat-reflection.json |  51 ---
 res/tomcat-maven/tomcat-resource.json   |  82 ---
 res/tomcat-maven/tomcat.yaml|  36 ---
 9 files changed, 521 deletions(-)

diff --git a/res/tomcat-maven/Dockerfile b/res/tomcat-maven/Dockerfile
deleted file mode 100644
index 512f232..000
--- a/res/tomcat-maven/Dockerfile
+++ /dev/null
@@ -1,56 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-FROM openjdk:8-jre-alpine
-VOLUME /tmp
-
-USER root
-RUN mkdir -m 777 -p /deployments
-
-ADD target/tomcat-maven-1.0.jar /deployments/app.jar
-ADD conf /deployments/conf
-ADD webapps /deployments/webapps
-RUN chmod 777 /deployments/webapps
-
-WORKDIR /deployments
-
-ARG namespace=tomcat
-ENV KUBERNETES_NAMESPACE=$namespace
-ARG port=8080
-EXPOSE $port
-
-ENV JAVA_OPTS="-Dcatalina.base=. -Djava.security.egd=file:/dev/urandom"
-
-# Add JULI logging configuration
-ENV JAVA_OPTS="${JAVA_OPTS} 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djava.util.logging.config.file=conf/logging.properties"
-
-RUN sh -c 'touch app.jar'
-
-RUN mkdir -p /opt
-
-# Optional: Add Jolokia agent for JMX monitoring and management
-# RUN mkdir /opt/jolokia && wget 
https://repo.maven.apache.org/maven2/org/jolokia/jolokia-jvm/1.6.2/jolokia-jvm-1.6.2-agent.jar
 -O /opt/jolokia/jolokia.jar
-# ARG jolokiaport=8778
-# ENV 
JAVA_OPTS="-javaagent:/opt/jolokia/jolokia.jar=host=*,port=$jolokiaport,protocol=https,authIgnoreCerts=true
 ${JAVA_OPTS}"
-# EXPOSE $jolokiaport
-
-# Optional: Add Prometheus agent for JMX monitoring
-# RUN mkdir /opt/prometheus && wget 
https://repo.maven.apache.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.12.0/jmx_prometheus_javaagent-0.12.0.jar
 -O /opt/prometheus/prometheus.jar && wget 
https://raw.githubusercontent.com/prometheus/jmx_exporter/master/example_configs/tomcat.yml
 -O conf/prometheus.yaml
-# ARG prometheusport=9404
-# ENV 
JAVA_OPTS="-javaagent:/opt/prometheus/prometheus.jar=$prometheusport:conf/prometheus.yaml
 ${JAVA_OPTS}"
-# EXPOSE $prometheusport
-
-ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar app.jar" ]
diff --git a/res/tomcat-maven/DockerfileGraal b/res/tomcat-maven/DockerfileGraal
deleted file mode 100644
index b801aa3..000
--- a/res/tomcat-maven/DockerfileGraal
+++ /dev/null
@@ -1,40 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-FROM busybox:glibc
-
-VOLUME /tmp
-
-USER root
-RUN mkdir -m 777 -p /deployments
-
-ADD tomcat-maven-1.0 /deployments/app
-ADD conf /deploy

[tomcat] branch master updated: Update Graal documentation to reflect changes

2020-06-25 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 6a3cae6  Update Graal documentation to reflect changes
6a3cae6 is described below

commit 6a3cae6adf866a40eed8df3a571253bc295ec421
Author: remm 
AuthorDate: Thu Jun 25 14:57:54 2020 +0200

Update Graal documentation to reflect changes
---
 webapps/docs/graal.xml | 70 ++
 1 file changed, 48 insertions(+), 22 deletions(-)

diff --git a/webapps/docs/graal.xml b/webapps/docs/graal.xml
index 0852595..b89dc1d 100644
--- a/webapps/docs/graal.xml
+++ b/webapps/docs/graal.xml
@@ -35,7 +35,7 @@
   
 
   
-Tomcat supports using the GraalVM Native Image tool to produce
+Tomcat supports using the GraalVM/Mandrel Native Image tool to produce
 a native binary including the container. This documentation page
 describes the build process of such an image.
   
@@ -49,21 +49,31 @@
 the process will use the Maven shade plugin JAR packaging (fat JAR). The
 idea is to produce a single JAR that contains all necessary classes from
 Tomcat, the webapps and all additional dependencies. Although Tomcat has
-received compatibility fixes to support GraalVM native images, any library
+received compatibility fixes to support native images, any library
 may not be compatible and may require replacement code (the GraalVM
 documentation has more details about this).
   
 
   
-Download and install GraalVM. The first step is then to add the
-native-image tool.
-export JAVA_HOME=/absolute...path...to/graalvm-ce-javaX-x.y.z
+Download and install GraalVM or Mandrel.
+  
+
+  
+   If using GraalVM, the first step is then to add the Native Image tool.
+   export JAVA_HOME=/absolute...path...to/graalvm-ce-javaX-x.y.z
 cd $JAVA_HOME/bin
 ./gu install native-image
-Download the Tomcat Maven packaging from
-https://github.com/apache/tomcat/tree/master/res/tomcat-maven and place
-all the files in a folder (named tomcat-maven in this documentation.
-export TOMCAT_MAVEN=/absolute...path...to/tomcat-maven
+   Mandrel already includes the Native Image tool ready to use, so this
+   step can be skipped. Only JAVA_HOME must be set to the mandrelJDK folder,
+   such as:
+   export 
JAVA_HOME=/absolute...path...to/mandrel-javaXX-platform-x.x.x.x
+  
+
+  
+Download the Tomcat Stuffed module from
+https://github.com/apache/tomcat/tree/master/modules/stuffed and place
+all the files in a folder stuffed in this documentation.
+export TOMCAT_STUFFED=/absolute...path...to/stuffed
 The build process now requires both Ant and Maven.
   
 
@@ -72,7 +82,7 @@ cd $JAVA_HOME/bin
   
 
   
-Inside the tomcat-maven folder, the directory structure is the same as for
+Inside the tomcat-stuffed folder, the directory structure is the same as 
for
 regular Tomcat. The main configuration files are placed in the conf folder,
 and if using the default server.xml the webapps are placed in the webapps
 folder.
@@ -81,14 +91,28 @@ cd $JAVA_HOME/bin
   
 The first step is to build the fat Tomcat JAR with all dependencies.
 Any JSP in the webapp must all be precompiled and packaged.
-cd $TOMCAT_MAVEN
+cd $TOMCAT_STUFFED
 mvn package
-ant -Dwebapp.name=somewebapp -f graal-webapp.ant.xml
+ant -Dwebapp.name=somewebapp -f webapp-jspc.ant.xml
 Dependencies for the webapp should now be added to the main pom.xml,
 following with building the complete fat JAR.
 mvn package
   
 
+  
+As it is best to avoid using reflection whenever possible with Ahead of
+Time compilation, it can be a good idea to generate and compile Tomcat
+Embedded code out of the main server.xml configuration as well as the
+context.xml files used to configure the contexts.
+$JAVA_HOME/bin/java\
+-Dcatalina.base=. 
-Djava.util.logging.config.file=conf/logging.properties\
+-jar target/tomcat-stuffed-1.0.jar --catalina -generateCode 
src/main/java
+mvn package
+The rest of the process described here will assume this step was done and
+the --catalina -useGeneratedCode arguments are added to the
+command lines. If this was not the case, they should be removed.
+  
+
   
 
   
@@ -103,9 +127,9 @@ ant -Dwebapp.name=somewebapp -f 
graal-webapp.ant.xml
   
 Run the GraalVM substrate VM using the trace agent:
 $JAVA_HOME/bin/java\
--agentlib:native-image-agent=config-output-dir=$TOMCAT_MAVEN/target/\
+-agentlib:native-image-agent=config-output-dir=$TOMCAT_STUFFED/target/\
 -Dcatalina.base=. 
-Djava.util.logging.config.file=conf/logging.properties\
--jar target/tomcat-maven-1.0.jar
+-jar target/tomcat-stuffed-1.0.jar --catalina 
-useGeneratedCode
   
 
   
@@ -136,18 +160,18 @@ ant -Dwebapp.name

[tomcat] branch master updated: Move AOT compilation packaging to a new module

2020-06-25 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new a1a4457  Move AOT compilation packaging to a new module
a1a4457 is described below

commit a1a445749526a4497908270e3b2bfbff15066b8a
Author: remm 
AuthorDate: Thu Jun 25 14:56:54 2020 +0200

Move AOT compilation packaging to a new module

Also cleanup and improvements based on newest changes.
---
 {res/tomcat-maven => modules/stuffed}/Dockerfile|  6 +++---
 {res/tomcat-maven => modules/stuffed}/DockerfileGraal   |  5 +++--
 {res/tomcat-maven => modules/stuffed}/README.md |  8 
 {res/tomcat-maven => modules/stuffed}/pom.xml   | 17 ++---
 {res/tomcat-maven => modules/stuffed}/tomcat-jni.json   |  0
 .../stuffed}/tomcat-reflection.json |  0
 .../stuffed}/tomcat-resource.json   |  0
 {res/tomcat-maven => modules/stuffed}/tomcat.yaml   |  2 +-
 .../stuffed/webapp-jspc.ant.xml |  6 +++---
 9 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/res/tomcat-maven/Dockerfile b/modules/stuffed/Dockerfile
similarity index 91%
rename from res/tomcat-maven/Dockerfile
rename to modules/stuffed/Dockerfile
index 512f232..83e5b6e 100644
--- a/res/tomcat-maven/Dockerfile
+++ b/modules/stuffed/Dockerfile
@@ -14,13 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM openjdk:8-jre-alpine
+FROM openjdk:8-jre
 VOLUME /tmp
 
 USER root
 RUN mkdir -m 777 -p /deployments
 
-ADD target/tomcat-maven-1.0.jar /deployments/app.jar
+ADD target/tomcat-stuffed-1.0.jar /deployments/app.jar
 ADD conf /deployments/conf
 ADD webapps /deployments/webapps
 RUN chmod 777 /deployments/webapps
@@ -48,7 +48,7 @@ RUN mkdir -p /opt
 # EXPOSE $jolokiaport
 
 # Optional: Add Prometheus agent for JMX monitoring
-# RUN mkdir /opt/prometheus && wget 
https://repo.maven.apache.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.12.0/jmx_prometheus_javaagent-0.12.0.jar
 -O /opt/prometheus/prometheus.jar && wget 
https://raw.githubusercontent.com/prometheus/jmx_exporter/master/example_configs/tomcat.yml
 -O conf/prometheus.yaml
+# RUN mkdir /opt/prometheus && wget 
https://repo.maven.apache.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.13.0/jmx_prometheus_javaagent-0.13.0.jar
 -O /opt/prometheus/prometheus.jar && wget 
https://raw.githubusercontent.com/prometheus/jmx_exporter/master/example_configs/tomcat.yml
 -O conf/prometheus.yaml
 # ARG prometheusport=9404
 # ENV 
JAVA_OPTS="-javaagent:/opt/prometheus/prometheus.jar=$prometheusport:conf/prometheus.yaml
 ${JAVA_OPTS}"
 # EXPOSE $prometheusport
diff --git a/res/tomcat-maven/DockerfileGraal b/modules/stuffed/DockerfileGraal
similarity index 88%
rename from res/tomcat-maven/DockerfileGraal
rename to modules/stuffed/DockerfileGraal
index b801aa3..19e2353 100644
--- a/res/tomcat-maven/DockerfileGraal
+++ b/modules/stuffed/DockerfileGraal
@@ -21,7 +21,7 @@ VOLUME /tmp
 USER root
 RUN mkdir -m 777 -p /deployments
 
-ADD tomcat-maven-1.0 /deployments/app
+ADD tomcat-stuffed-1.0 /deployments/app
 ADD conf /deployments/conf
 ADD webapps /deployments/webapps
 
@@ -33,8 +33,9 @@ ARG port=8080
 EXPOSE $port
 
 ENV JAVA_OPTS="-Dcatalina.base=. -Djava.security.egd=file:/dev/urandom"
+ENV CATALINA_OPTS="--catalina -useGeneratedCode"
 
 # Add JULI logging configuration
 ENV JAVA_OPTS="${JAVA_OPTS} 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djava.util.logging.config.file=conf/logging.properties"
 
-ENTRYPOINT [ "sh", "-c", "/deployments/app $JAVA_OPTS" ]
+ENTRYPOINT [ "sh", "-c", "/deployments/app $JAVA_OPTS $CATALINA_OPTS" ]
diff --git a/res/tomcat-maven/README.md b/modules/stuffed/README.md
similarity index 93%
rename from res/tomcat-maven/README.md
rename to modules/stuffed/README.md
index b5e54f7..7e50576 100644
--- a/res/tomcat-maven/README.md
+++ b/modules/stuffed/README.md
@@ -19,7 +19,7 @@
 
 -->
 
-# Apache Tomcat distribution for Apache Maven
+# Apache Tomcat distribution for container platforms
 
 ## Configuration
 
@@ -37,7 +37,7 @@ mvn clean; mvn package
 ### Docker build
 
 ```
-docker build -t apache/tomcat-maven:1.0 -f ./Dockerfile .
+docker build -t apache/tomcat-stuffed:1.0 -f ./Dockerfile .
 ```
 Docker build arguments include `namepsace` (default is `tomcat`) and `port` 
which should match the Tomcat port in `server.xml` (default is `8080`). Other 
ports that need to be exposed can be added in the `Dockerfile` as needed. 
Webapps should be added to the `webapps` folder where they will be auto 
deployed by the host if using the defaults. Otherwise, the `Docker

[tomcat] branch 9.0.x updated: Fix incorrect argument processing

2020-06-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 0ab464c  Fix incorrect argument processing
0ab464c is described below

commit 0ab464c455831fc019f1738828da3297606e8f21
Author: remm 
AuthorDate: Wed Jun 24 13:59:18 2020 +0200

Fix incorrect argument processing

Adding the same break is needed to avoid an error for unknown arguments.
---
 java/org/apache/catalina/startup/Tomcat.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/java/org/apache/catalina/startup/Tomcat.java 
b/java/org/apache/catalina/startup/Tomcat.java
index af895ed..65baf1d 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -1350,6 +1350,7 @@ public class Tomcat {
 } else if (args[i].equals("--catalina")) {
 // This was already processed before
 // Skip the rest of the arguments as they are for Catalina
+break;
 } else {
 throw new 
IllegalArgumentException(sm.getString("tomcat.invalidCommandLine", args[i]));
 }


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



[tomcat] branch master updated: Fix incorrect argument processing

2020-06-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 0be0a6a  Fix incorrect argument processing
0be0a6a is described below

commit 0be0a6a65fe02ea9e54e7bf5d4dbbd109dc8d837
Author: remm 
AuthorDate: Wed Jun 24 13:59:18 2020 +0200

Fix incorrect argument processing

Adding the same break is needed to avoid an error for unknown arguments.
---
 java/org/apache/catalina/startup/Tomcat.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/java/org/apache/catalina/startup/Tomcat.java 
b/java/org/apache/catalina/startup/Tomcat.java
index 1ec95c5..5de7256 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -1350,6 +1350,7 @@ public class Tomcat {
 } else if (args[i].equals("--catalina")) {
 // This was already processed before
 // Skip the rest of the arguments as they are for Catalina
+break;
 } else {
 throw new 
IllegalArgumentException(sm.getString("tomcat.invalidCommandLine", args[i]));
 }


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



[tomcat] branch 9.0.x updated: Fix changelog error

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 5f49acf  Fix changelog error
5f49acf is described below

commit 5f49acfddf430b8e6be8ce35e12a121368d24f08
Author: remm 
AuthorDate: Tue Jun 23 23:49:51 2020 +0200

Fix changelog error
---
 webapps/docs/changelog.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 43a2485..1e581c8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -71,11 +71,11 @@
 response is returned for an HTTP/2 request if the mapped servlet does
 implement the requested method rather than the more general
 400 response. (markt)
+  
   
 Add generated classes using Tomcat embedded as an optional replacement
 for the Catalina configuration files. (remm)
   
-  
 
   
   


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



[tomcat] branch master updated: Fix changelog error

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 0bab3b2  Fix changelog error
0bab3b2 is described below

commit 0bab3b264ce43078199aff6e4f281db2091c5eed
Author: remm 
AuthorDate: Tue Jun 23 23:49:51 2020 +0200

Fix changelog error
---
 webapps/docs/changelog.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index ed6ee45..a7d0320 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -74,11 +74,11 @@
 response is returned for an HTTP/2 request if the mapped servlet does
 implement the requested method rather than the more general
 400 response. (markt)
+  
   
 Add generated classes using Tomcat embedded as an optional replacement
 for the Catalina configuration files. (remm)
   
-  
 
   
   


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



[tomcat] branch master updated: Remove unused deprecated classes

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 88e06fc  Remove unused deprecated classes
88e06fc is described below

commit 88e06fc1483feac111f198e9c0c7ff0fcdf9aad6
Author: remm 
AuthorDate: Tue Jun 23 14:06:08 2020 +0200

Remove unused deprecated classes
---
 .../catalina/startup/SetAllPropertiesRule.java | 42 
 .../catalina/startup/SetContextPropertiesRule.java | 46 --
 2 files changed, 88 deletions(-)

diff --git a/java/org/apache/catalina/startup/SetAllPropertiesRule.java 
b/java/org/apache/catalina/startup/SetAllPropertiesRule.java
deleted file mode 100644
index 7288fe6..000
--- a/java/org/apache/catalina/startup/SetAllPropertiesRule.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.catalina.startup;
-
-import org.apache.tomcat.util.digester.SetPropertiesRule;
-
-/**
- * Rule that uses the introspection utils to set properties.
- *
- * @author Remy Maucherat
- * @deprecated This will be removed in Tomcat 10
- */
-@Deprecated
-public class SetAllPropertiesRule extends SetPropertiesRule {
-
-
-// --- Constructors
-public SetAllPropertiesRule() {
-super();
-}
-
-public SetAllPropertiesRule(String[] exclude) {
-super(exclude);
-}
-
-}
diff --git a/java/org/apache/catalina/startup/SetContextPropertiesRule.java 
b/java/org/apache/catalina/startup/SetContextPropertiesRule.java
deleted file mode 100644
index 36ad6a9..000
--- a/java/org/apache/catalina/startup/SetContextPropertiesRule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.catalina.startup;
-
-import org.apache.tomcat.util.digester.SetPropertiesRule;
-
-/**
- * Rule that uses the introspection utils to set properties of a context
- * (everything except "path").
- *
- * @author Remy Maucherat
- * @deprecated This will be removed in Tomcat 10
- */
-@Deprecated
-public class SetContextPropertiesRule extends SetPropertiesRule {
-
-
-// --- Constructors
-
-public SetContextPropertiesRule() {
-super(new String[]{"path", "docBase"});
-}
-
-// - Instance Variables
-
-
-// - Public Methods
-
-
-}


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



[tomcat] 03/05: Do the code generation tooling for context.xml files

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 1d10b19c7ced08d6f81e8c93a67d321a1307c47f
Author: remm 
AuthorDate: Mon Jun 22 17:20:24 2020 +0200

Do the code generation tooling for context.xml files

Drop the hack that used the hash code to create variable names since it
does not work, instead a list of objects used had to be kept. The names
are more readable so it's not a bad move anyway.
Using the generated code (beyond looking for a Tomcat embedded example)
during load will be done only when using an explicit flag.
I will document this tooling.
Most likely some additional escaping and fixes are needed.
---
 java/org/apache/catalina/startup/Catalina.java |  84 +---
 .../org/apache/catalina/startup/ContextConfig.java | 231 +++--
 .../catalina/startup/ListenerCreateRule.java   |  12 +-
 .../apache/catalina/startup/SetNextNamingRule.java |  12 +-
 .../org/apache/tomcat/util/IntrospectionUtils.java |  31 ++-
 .../tomcat/util/descriptor/web/ContextEjb.java |   5 -
 .../util/descriptor/web/ContextEnvironment.java|   3 -
 .../tomcat/util/descriptor/web/ContextHandler.java |   4 -
 .../util/descriptor/web/ContextLocalEjb.java   |   4 -
 .../util/descriptor/web/ContextResource.java   |   4 -
 .../util/descriptor/web/ContextResourceEnvRef.java |   4 -
 .../util/descriptor/web/ContextResourceLink.java   |   4 -
 .../tomcat/util/descriptor/web/ContextService.java |   4 -
 .../util/descriptor/web/MessageDestination.java|   4 -
 .../util/descriptor/web/MessageDestinationRef.java |   4 -
 .../tomcat/util/descriptor/web/ResourceBase.java   |  10 -
 .../tomcat/util/digester/CallMethodRule.java   |   6 +-
 java/org/apache/tomcat/util/digester/Digester.java |  30 ++-
 18 files changed, 346 insertions(+), 110 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index b03d4ce..5e6bb12 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -135,11 +135,17 @@ public class Catalina {
 
 
 /**
- * Generate Tomcat embedded code from server.xml.
+ * Generate Tomcat embedded code from configuration files.
  */
 protected boolean generateCode = false;
 
 
+/**
+ * Use generated code as a replacement for configuration files.
+ */
+protected boolean useGeneratedCode = false;
+
+
 // --- Constructors
 
 public Catalina() {
@@ -170,6 +176,26 @@ public class Catalina {
 }
 
 
+public boolean getGenerateCode() {
+return this.generateCode;
+}
+
+
+public void setGenerateCode(boolean generateCode) {
+this.generateCode = generateCode;
+}
+
+
+public boolean getUseGeneratedCode() {
+return this.useGeneratedCode;
+}
+
+
+public void setUseGeneratedCode(boolean useGeneratedCode) {
+this.useGeneratedCode = useGeneratedCode;
+}
+
+
 /**
  * Set the shared extensions class loader.
  *
@@ -247,6 +273,8 @@ public class Catalina {
 isConfig = true;
 } else if (arg.equals("-generateCode")) {
 generateCode = true;
+} else if (arg.equals("-useGeneratedCode")) {
+useGeneratedCode = true;
 } else if (arg.equals("-nonaming")) {
 setUseNaming(false);
 } else if (arg.equals("-help")) {
@@ -558,50 +586,49 @@ public class Catalina {
 ConfigFileLoader.setSource(new 
CatalinaBaseConfigurationSource(Bootstrap.getCatalinaBaseFile(), 
getConfigFile()));
 File file = configFile();
 
-try (ConfigurationSource.Resource resource = 
ConfigFileLoader.getSource().getServerXml()) {
-String serverXmlId = String.valueOf(resource.getLastModified());
-String serverXmlClassName = "catalina.ServerXml_" + serverXmlId;
-ServerXml serverXml = null;
+ServerXml serverXml = null;
+if (useGeneratedCode) {
+String xmlClassName = "catalina.ServerXml";
 try {
-serverXml = (ServerXml) 
Catalina.class.getClassLoader().loadClass(serverXmlClassName).newInstance();
-} catch (ClassNotFoundException e) {
+serverXml = (ServerXml) 
Catalina.class.getClassLoader().loadClass(xmlClassName).newInstance();
+} catch (Exception e) {
 // Ignore, no generated code found
 }
-if (serverXml != null) {
-serverXml.load(this);
-} else {
+}
+
+if (serverXml != null) {
+serverXml.load(this);
+} else {
+try (ConfigurationSource.Re

[tomcat] 04/05: Various improvements to code generation

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 0306b6b0eda5d8225c725af932af441d0299f40e
Author: remm 
AuthorDate: Tue Jun 23 12:02:48 2020 +0200

Various improvements to code generation

Add a configuration for the location of the generated sources.
Catalina start and stop will now use the same code. As a result, stop
will now use the configuration source and will also generate stop code.
If the use generated flag is enabled, ContextConfig will not look at the
real files at all, this is just simpler (and there could be 100s of
webapps too).
Pass arguments from Tomcat to Catalina, since in addition to educational
uses, the feature would be useful with AOT compilation.
---
 java/org/apache/catalina/startup/Catalina.java | 177 +
 .../catalina/startup/ConnectorCreateRule.java  |   1 +
 .../org/apache/catalina/startup/ContextConfig.java |  39 +++--
 .../catalina/startup/LocalStrings.properties   |   3 +-
 java/org/apache/catalina/startup/Tomcat.java   |  39 -
 .../tomcat/util/digester/ObjectCreateRule.java |   1 +
 .../tomcat/util/digester/SetPropertiesRule.java|   3 -
 webapps/docs/changelog.xml |   4 +
 8 files changed, 182 insertions(+), 85 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index 5e6bb12..d2456d6 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -18,7 +18,6 @@ package org.apache.catalina.startup;
 
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
@@ -141,6 +140,18 @@ public class Catalina {
 
 
 /**
+ * Location of generated sources.
+ */
+protected File generatedCodeLocation = null;
+
+
+/**
+ * Value of the argument.
+ */
+protected String generatedCodeLocationParameter = null;
+
+
+/**
  * Use generated code as a replacement for configuration files.
  */
 protected boolean useGeneratedCode = false;
@@ -196,6 +207,16 @@ public class Catalina {
 }
 
 
+public File getGeneratedCodeLocation() {
+return this.generatedCodeLocation;
+}
+
+
+public void setGeneratedCodeLocation(File generatedCodeLocation) {
+this.generatedCodeLocation = generatedCodeLocation;
+}
+
+
 /**
  * Set the shared extensions class loader.
  *
@@ -259,6 +280,7 @@ public class Catalina {
 protected boolean arguments(String args[]) {
 
 boolean isConfig = false;
+boolean isGenerateCode = false;
 
 if (args.length < 1) {
 usage();
@@ -272,20 +294,29 @@ public class Catalina {
 } else if (arg.equals("-config")) {
 isConfig = true;
 } else if (arg.equals("-generateCode")) {
-generateCode = true;
+setGenerateCode(true);
+isGenerateCode = true;
 } else if (arg.equals("-useGeneratedCode")) {
-useGeneratedCode = true;
+setUseGeneratedCode(true);
+isGenerateCode = false;
 } else if (arg.equals("-nonaming")) {
 setUseNaming(false);
+isGenerateCode = false;
 } else if (arg.equals("-help")) {
 usage();
 return false;
 } else if (arg.equals("start")) {
+isGenerateCode = false;
 // NOOP
 } else if (arg.equals("configtest")) {
+isGenerateCode = false;
 // NOOP
 } else if (arg.equals("stop")) {
+isGenerateCode = false;
 // NOOP
+} else if (isGenerateCode) {
+generatedCodeLocationParameter = arg;
+isGenerateCode = false;
 } else {
 usage();
 return false;
@@ -502,6 +533,72 @@ public class Catalina {
 }
 
 
+protected void parseServerXml(boolean start) {
+// Set configuration source
+ConfigFileLoader.setSource(new 
CatalinaBaseConfigurationSource(Bootstrap.getCatalinaBaseFile(), 
getConfigFile()));
+File file = configFile();
+
+// Init source location
+File serverXmlLocation = null;
+if (generateCode) {
+if (generatedCodeLocationParameter != null) {
+generatedCodeLocation = new 
File(generatedCodeLocationParameter);
+if (!generatedCodeLocation.isAbsolute()) {
+generatedCodeLocation = new 
File(Bootstrap.getCatalinaHomeFile(), generatedCodeLocationParameter);
+}
+} else

[tomcat] 01/05: Add a code generator for server.xml by taking advantage of the digester

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 55ef30d459f859d92a562eed9bd1b7d080a510b4
Author: remm 
AuthorDate: Thu Jun 18 15:07:39 2020 +0200

Add a code generator for server.xml by taking advantage of the digester

This produces a Tomcat embedded out of server.xml. Only the rules used
by server.xml have code generation at the moment. The code is generated
in the work directory.
Also minor refactorings and simplifications, like for the properties
related rules which could use the main one.
For some reason, it is only marginally faster than actually using the
digester and regular XML parsing. I expected better results overall and
it could be useful to investigate.
However this still has benefits:
- It is better for AOT compilation; I will likely be moving the Tomcat
standalone "blueprint" for AOT compilation use from res/tomcat-maven to
a new module since this will eventually expand to include all the extra
steps that can benefit AOT
- It can be educational about how to use the Tomcat embedded API
- People using Tomcat embedded could use it to generate code for complex
configurations, and this guarantees server.xml equivalence
- Maybe there will be benefits if the technique is applied to the larger
and more numerous web.xml files (but it is possible other methods are
better there, I will investigate)
---
 .../apache/catalina/startup/AddPortOffsetRule.java |   7 +
 java/org/apache/catalina/startup/Catalina.java | 144 +++--
 .../catalina/startup/CertificateCreateRule.java|  11 +-
 .../catalina/startup/ConnectorCreateRule.java  |  31 -
 .../apache/catalina/startup/ContextRuleSet.java|   2 +-
 .../startup/CopyParentClassLoaderRule.java |   6 +
 .../catalina/startup/LifecycleListenerRule.java|   6 +
 .../org/apache/catalina/startup/NamingRuleSet.java |  12 +-
 .../catalina/startup/SetAllPropertiesRule.java |  52 +---
 .../catalina/startup/SetContextPropertiesRule.java |  42 +-
 .../apache/catalina/startup/SetNextNamingRule.java |   7 +
 .../org/apache/tomcat/util/IntrospectionUtils.java |  31 -
 .../tomcat/util/descriptor/web/ContextEjb.java |   4 +
 .../util/descriptor/web/ContextEnvironment.java|   4 +
 .../tomcat/util/descriptor/web/ContextHandler.java |   4 +
 .../util/descriptor/web/ContextLocalEjb.java   |   4 +
 .../util/descriptor/web/ContextResource.java   |   4 +
 .../util/descriptor/web/ContextResourceEnvRef.java |   4 +
 .../util/descriptor/web/ContextResourceLink.java   |   4 +
 .../tomcat/util/descriptor/web/ContextService.java |   4 +
 .../util/descriptor/web/MessageDestination.java|   4 +
 .../util/descriptor/web/MessageDestinationRef.java |   4 +
 .../tomcat/util/descriptor/web/ResourceBase.java   |  10 ++
 .../tomcat/util/digester/CallMethodRule.java   |  14 ++
 java/org/apache/tomcat/util/digester/Digester.java |  27 
 .../tomcat/util/digester/ObjectCreateRule.java |  10 ++
 .../apache/tomcat/util/digester/SetNextRule.java   |   6 +
 .../tomcat/util/digester/SetPropertiesRule.java|  48 ++-
 28 files changed, 362 insertions(+), 144 deletions(-)

diff --git a/java/org/apache/catalina/startup/AddPortOffsetRule.java 
b/java/org/apache/catalina/startup/AddPortOffsetRule.java
index 9b961cb..50f3fc0 100644
--- a/java/org/apache/catalina/startup/AddPortOffsetRule.java
+++ b/java/org/apache/catalina/startup/AddPortOffsetRule.java
@@ -32,5 +32,12 @@ public class AddPortOffsetRule extends Rule {
 
 int portOffset = server.getPortOffset();
 conn.setPortOffset(portOffset);
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+
code.append(digester.toVariableName(conn)).append(".setPortOffset(");
+
code.append(digester.toVariableName(server)).append(".getPortOffset());");
+code.append(System.lineSeparator());
+}
 }
 }
\ No newline at end of file
diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index 00c820e..ecf197f 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -19,6 +19,7 @@ package org.apache.catalina.startup;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -29,6 +30,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.LogManager;
 
 import org.apache.catalina.Container;
@@ -132,6 +134,19 @@ public class Catalina {
 protected boolean loaded = false;
 
 
+/**
+ * Reth

[tomcat] branch 9.0.x updated (e358d0d -> 05ba3d4)

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from e358d0d  Tab police
 new 55ef30d  Add a code generator for server.xml by taking advantage of 
the digester
 new 93a7a3b  Drop from merge
 new 1d10b19  Do the code generation tooling for context.xml files
 new 0306b6b  Various improvements to code generation
 new 05ba3d4  Fix IDE nags

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/catalina/startup/AddPortOffsetRule.java |   7 +
 java/org/apache/catalina/startup/Catalina.java | 264 +++--
 .../catalina/startup/CertificateCreateRule.java|  11 +-
 .../catalina/startup/ConnectorCreateRule.java  |  32 ++-
 .../org/apache/catalina/startup/ContextConfig.java | 246 +--
 .../apache/catalina/startup/ContextRuleSet.java|   2 +-
 .../startup/CopyParentClassLoaderRule.java |   6 +
 .../catalina/startup/LifecycleListenerRule.java|   6 +
 .../catalina/startup/ListenerCreateRule.java   |  12 +-
 .../catalina/startup/LocalStrings.properties   |   3 +-
 .../org/apache/catalina/startup/NamingRuleSet.java |  12 +-
 .../catalina/startup/SetAllPropertiesRule.java |  53 +
 .../catalina/startup/SetContextPropertiesRule.java |  43 +---
 .../apache/catalina/startup/SetNextNamingRule.java |  13 +
 java/org/apache/catalina/startup/Tomcat.java   |  39 ++-
 .../org/apache/tomcat/util/IntrospectionUtils.java |  58 -
 .../tomcat/util/descriptor/web/ContextEjb.java |   1 -
 .../util/descriptor/web/ContextEnvironment.java|   1 +
 .../tomcat/util/digester/CallMethodRule.java   |  18 ++
 java/org/apache/tomcat/util/digester/Digester.java |  47 
 .../tomcat/util/digester/ObjectCreateRule.java |  11 +
 .../apache/tomcat/util/digester/SetNextRule.java   |   6 +
 .../tomcat/util/digester/SetPropertiesRule.java|  45 +++-
 webapps/docs/changelog.xml |   4 +
 24 files changed, 743 insertions(+), 197 deletions(-)


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



[tomcat] 02/05: Drop from merge

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 93a7a3bbc94c8afc56c7ea65fce17f2ac7c6c038
Author: remm 
AuthorDate: Tue Jun 23 13:28:50 2020 +0200

Drop from merge
---
 java/org/apache/catalina/startup/Catalina.java | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index ecf197f..b03d4ce 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -135,13 +135,6 @@ public class Catalina {
 
 
 /**
- * Rethrow exceptions on init failure.
- */
-protected boolean throwOnInitFailure =
-
Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE");
-
-
-/**
  * Generate Tomcat embedded code from server.xml.
  */
 protected boolean generateCode = false;


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



[tomcat] 05/05: Fix IDE nags

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 05ba3d4d1ca6261ec12967b1010d34ba7adc6ccb
Author: Mark Thomas 
AuthorDate: Tue Jun 23 12:08:20 2020 +0100

Fix IDE nags
---
 java/org/apache/catalina/startup/Catalina.java | 4 ++--
 java/org/apache/catalina/startup/SetAllPropertiesRule.java | 1 +
 java/org/apache/catalina/startup/SetContextPropertiesRule.java | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index d2456d6..215f179 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -697,7 +697,7 @@ public class Catalina {
 }
 
 if(log.isInfoEnabled()) {
-log.info(sm.getString("catalina.init", 
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1)));
+log.info(sm.getString("catalina.init", 
Long.toString(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1;
 }
 }
 
@@ -747,7 +747,7 @@ public class Catalina {
 }
 
 if (log.isInfoEnabled()) {
-log.info(sm.getString("catalina.startup", 
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1)));
+log.info(sm.getString("catalina.startup", 
Long.toString(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1;
 }
 
 // Register shutdown hook
diff --git a/java/org/apache/catalina/startup/SetAllPropertiesRule.java 
b/java/org/apache/catalina/startup/SetAllPropertiesRule.java
index 93d59e9..7288fe6 100644
--- a/java/org/apache/catalina/startup/SetAllPropertiesRule.java
+++ b/java/org/apache/catalina/startup/SetAllPropertiesRule.java
@@ -26,6 +26,7 @@ import org.apache.tomcat.util.digester.SetPropertiesRule;
  * @author Remy Maucherat
  * @deprecated This will be removed in Tomcat 10
  */
+@Deprecated
 public class SetAllPropertiesRule extends SetPropertiesRule {
 
 
diff --git a/java/org/apache/catalina/startup/SetContextPropertiesRule.java 
b/java/org/apache/catalina/startup/SetContextPropertiesRule.java
index fda8742..36ad6a9 100644
--- a/java/org/apache/catalina/startup/SetContextPropertiesRule.java
+++ b/java/org/apache/catalina/startup/SetContextPropertiesRule.java
@@ -27,6 +27,7 @@ import org.apache.tomcat.util.digester.SetPropertiesRule;
  * @author Remy Maucherat
  * @deprecated This will be removed in Tomcat 10
  */
+@Deprecated
 public class SetContextPropertiesRule extends SetPropertiesRule {
 
 


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



[tomcat] branch master updated: Various improvements to code generation

2020-06-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new fd431c2  Various improvements to code generation
fd431c2 is described below

commit fd431c2f18cd1c04bc2902400fe3344fa58a656f
Author: remm 
AuthorDate: Tue Jun 23 12:02:48 2020 +0200

Various improvements to code generation

Add a configuration for the location of the generated sources.
Catalina start and stop will now use the same code. As a result, stop
will now use the configuration source and will also generate stop code.
If the use generated flag is enabled, ContextConfig will not look at the
real files at all, this is just simpler (and there could be 100s of
webapps too).
Pass arguments from Tomcat to Catalina, since in addition to educational
uses, the feature would be useful with AOT compilation.
---
 java/org/apache/catalina/startup/Catalina.java | 177 +
 .../catalina/startup/ConnectorCreateRule.java  |   1 +
 .../org/apache/catalina/startup/ContextConfig.java |  39 +++--
 .../catalina/startup/LocalStrings.properties   |   3 +-
 java/org/apache/catalina/startup/Tomcat.java   |  39 -
 .../tomcat/util/digester/ObjectCreateRule.java |   1 +
 .../tomcat/util/digester/SetPropertiesRule.java|   3 -
 webapps/docs/changelog.xml |   4 +
 8 files changed, 182 insertions(+), 85 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index 272d428..5280d32 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -18,7 +18,6 @@ package org.apache.catalina.startup;
 
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
@@ -148,6 +147,18 @@ public class Catalina {
 
 
 /**
+ * Location of generated sources.
+ */
+protected File generatedCodeLocation = null;
+
+
+/**
+ * Value of the argument.
+ */
+protected String generatedCodeLocationParameter = null;
+
+
+/**
  * Use generated code as a replacement for configuration files.
  */
 protected boolean useGeneratedCode = false;
@@ -203,6 +214,16 @@ public class Catalina {
 }
 
 
+public File getGeneratedCodeLocation() {
+return this.generatedCodeLocation;
+}
+
+
+public void setGeneratedCodeLocation(File generatedCodeLocation) {
+this.generatedCodeLocation = generatedCodeLocation;
+}
+
+
 /**
  * @return true if an exception should be thrown if an error
  * occurs during server init
@@ -284,6 +305,7 @@ public class Catalina {
 protected boolean arguments(String args[]) {
 
 boolean isConfig = false;
+boolean isGenerateCode = false;
 
 if (args.length < 1) {
 usage();
@@ -297,20 +319,29 @@ public class Catalina {
 } else if (arg.equals("-config")) {
 isConfig = true;
 } else if (arg.equals("-generateCode")) {
-generateCode = true;
+setGenerateCode(true);
+isGenerateCode = true;
 } else if (arg.equals("-useGeneratedCode")) {
-useGeneratedCode = true;
+setUseGeneratedCode(true);
+isGenerateCode = false;
 } else if (arg.equals("-nonaming")) {
 setUseNaming(false);
+isGenerateCode = false;
 } else if (arg.equals("-help")) {
 usage();
 return false;
 } else if (arg.equals("start")) {
+isGenerateCode = false;
 // NOOP
 } else if (arg.equals("configtest")) {
+isGenerateCode = false;
 // NOOP
 } else if (arg.equals("stop")) {
+isGenerateCode = false;
 // NOOP
+} else if (isGenerateCode) {
+generatedCodeLocationParameter = arg;
+isGenerateCode = false;
 } else {
 usage();
 return false;
@@ -527,6 +558,72 @@ public class Catalina {
 }
 
 
+protected void parseServerXml(boolean start) {
+// Set configuration source
+ConfigFileLoader.setSource(new 
CatalinaBaseConfigurationSource(Bootstrap.getCatalinaBaseFile(), 
getConfigFile()));
+File file = configFile();
+
+// Init source location
+File serverXmlLocation = null;
+if (generateCode) {
+if (generatedCodeLocationParameter != null) {
+generatedCodeLocation = new 
File(gene

[tomcat] branch master updated: Do the code generation tooling for context.xml files

2020-06-22 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 3037ad9  Do the code generation tooling for context.xml files
3037ad9 is described below

commit 3037ad9b4c1c7dfb36e7149262b929960a42bd03
Author: remm 
AuthorDate: Mon Jun 22 17:20:24 2020 +0200

Do the code generation tooling for context.xml files

Drop the hack that used the hash code to create variable names since it
does not work, instead a list of objects used had to be kept. The names
are more readable so it's not a bad move anyway.
Using the generated code (beyond looking for a Tomcat embedded example)
during load will be done only when using an explicit flag.
I will document this tooling.
Most likely some additional escaping and fixes are needed.
---
 java/org/apache/catalina/startup/Catalina.java |  84 +---
 .../org/apache/catalina/startup/ContextConfig.java | 231 +++--
 .../catalina/startup/ListenerCreateRule.java   |  12 +-
 .../apache/catalina/startup/SetNextNamingRule.java |  12 +-
 .../org/apache/tomcat/util/IntrospectionUtils.java |  31 ++-
 .../tomcat/util/descriptor/web/ContextEjb.java |   5 -
 .../util/descriptor/web/ContextEnvironment.java|   3 -
 .../tomcat/util/descriptor/web/ContextHandler.java |   4 -
 .../util/descriptor/web/ContextLocalEjb.java   |   4 -
 .../util/descriptor/web/ContextResource.java   |   4 -
 .../util/descriptor/web/ContextResourceEnvRef.java |   4 -
 .../util/descriptor/web/ContextResourceLink.java   |   4 -
 .../tomcat/util/descriptor/web/ContextService.java |   4 -
 .../util/descriptor/web/MessageDestination.java|   4 -
 .../util/descriptor/web/MessageDestinationRef.java |   4 -
 .../tomcat/util/descriptor/web/ResourceBase.java   |  10 -
 .../tomcat/util/digester/CallMethodRule.java   |   6 +-
 java/org/apache/tomcat/util/digester/Digester.java |  30 ++-
 18 files changed, 346 insertions(+), 110 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index 0b23219..272d428 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -142,11 +142,17 @@ public class Catalina {
 
 
 /**
- * Generate Tomcat embedded code from server.xml.
+ * Generate Tomcat embedded code from configuration files.
  */
 protected boolean generateCode = false;
 
 
+/**
+ * Use generated code as a replacement for configuration files.
+ */
+protected boolean useGeneratedCode = false;
+
+
 // --- Constructors
 
 public Catalina() {
@@ -177,6 +183,26 @@ public class Catalina {
 }
 
 
+public boolean getGenerateCode() {
+return this.generateCode;
+}
+
+
+public void setGenerateCode(boolean generateCode) {
+this.generateCode = generateCode;
+}
+
+
+public boolean getUseGeneratedCode() {
+return this.useGeneratedCode;
+}
+
+
+public void setUseGeneratedCode(boolean useGeneratedCode) {
+this.useGeneratedCode = useGeneratedCode;
+}
+
+
 /**
  * @return true if an exception should be thrown if an error
  * occurs during server init
@@ -272,6 +298,8 @@ public class Catalina {
 isConfig = true;
 } else if (arg.equals("-generateCode")) {
 generateCode = true;
+} else if (arg.equals("-useGeneratedCode")) {
+useGeneratedCode = true;
 } else if (arg.equals("-nonaming")) {
 setUseNaming(false);
 } else if (arg.equals("-help")) {
@@ -581,50 +609,49 @@ public class Catalina {
 ConfigFileLoader.setSource(new 
CatalinaBaseConfigurationSource(Bootstrap.getCatalinaBaseFile(), 
getConfigFile()));
 File file = configFile();
 
-try (ConfigurationSource.Resource resource = 
ConfigFileLoader.getSource().getServerXml()) {
-String serverXmlId = String.valueOf(resource.getLastModified());
-String serverXmlClassName = "catalina.ServerXml_" + serverXmlId;
-ServerXml serverXml = null;
+ServerXml serverXml = null;
+if (useGeneratedCode) {
+String xmlClassName = "catalina.ServerXml";
 try {
-serverXml = (ServerXml) 
Catalina.class.getClassLoader().loadClass(serverXmlClassName).newInstance();
-} catch (ClassNotFoundException e) {
+serverXml = (ServerXml) 
Catalina.class.getClassLoader().loadClass(xmlClassName).newInstance();
+} catch (Exception e) {
 // Ignore, no generated code found
 }
-if (serverXml != null) 

[tomcat] branch master updated: Add a code generator for server.xml by taking advantage of the digester

2020-06-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 564c000  Add a code generator for server.xml by taking advantage of 
the digester
564c000 is described below

commit 564c575f630ccc432b0ba9b52adefe4387aa
Author: remm 
AuthorDate: Thu Jun 18 15:07:39 2020 +0200

Add a code generator for server.xml by taking advantage of the digester

This produces a Tomcat embedded out of server.xml. Only the rules used
by server.xml have code generation at the moment. The code is generated
in the work directory.
Also minor refactorings and simplifications, like for the properties
related rules which could use the main one.
For some reason, it is only marginally faster than actually using the
digester and regular XML parsing. I expected better results overall and
it could be useful to investigate.
However this still has benefits:
- It is better for AOT compilation; I will likely be moving the Tomcat
standalone "blueprint" for AOT compilation use from res/tomcat-maven to
a new module since this will eventually expand to include all the extra
steps that can benefit AOT
- It can be educational about how to use the Tomcat embedded API
- People using Tomcat embedded could use it to generate code for complex
configurations, and this guarantees server.xml equivalence
- Maybe there will be benefits if the technique is applied to the larger
and more numerous web.xml files (but it is possible other methods are
better there, I will investigate)
---
 .../apache/catalina/startup/AddPortOffsetRule.java |   7 ++
 java/org/apache/catalina/startup/Catalina.java | 137 +++--
 .../catalina/startup/CertificateCreateRule.java|  11 +-
 .../catalina/startup/ConnectorCreateRule.java  |  31 -
 .../apache/catalina/startup/ContextRuleSet.java|   2 +-
 .../startup/CopyParentClassLoaderRule.java |   6 +
 .../catalina/startup/LifecycleListenerRule.java|   6 +
 .../org/apache/catalina/startup/NamingRuleSet.java |  12 +-
 .../catalina/startup/SetAllPropertiesRule.java |  52 ++--
 .../catalina/startup/SetContextPropertiesRule.java |  42 +--
 .../apache/catalina/startup/SetNextNamingRule.java |   7 ++
 .../org/apache/tomcat/util/IntrospectionUtils.java |  31 -
 .../tomcat/util/descriptor/web/ContextEjb.java |   4 +
 .../util/descriptor/web/ContextEnvironment.java|   4 +
 .../tomcat/util/descriptor/web/ContextHandler.java |   4 +
 .../util/descriptor/web/ContextLocalEjb.java   |   4 +
 .../util/descriptor/web/ContextResource.java   |   4 +
 .../util/descriptor/web/ContextResourceEnvRef.java |   4 +
 .../util/descriptor/web/ContextResourceLink.java   |   4 +
 .../tomcat/util/descriptor/web/ContextService.java |   4 +
 .../util/descriptor/web/MessageDestination.java|   4 +
 .../util/descriptor/web/MessageDestinationRef.java |   4 +
 .../tomcat/util/descriptor/web/ResourceBase.java   |  10 ++
 .../tomcat/util/digester/CallMethodRule.java   |  14 +++
 java/org/apache/tomcat/util/digester/Digester.java |  27 
 .../tomcat/util/digester/ObjectCreateRule.java |  10 ++
 .../apache/tomcat/util/digester/SetNextRule.java   |   6 +
 .../tomcat/util/digester/SetPropertiesRule.java|  48 +++-
 28 files changed, 355 insertions(+), 144 deletions(-)

diff --git a/java/org/apache/catalina/startup/AddPortOffsetRule.java 
b/java/org/apache/catalina/startup/AddPortOffsetRule.java
index 9b961cb..50f3fc0 100644
--- a/java/org/apache/catalina/startup/AddPortOffsetRule.java
+++ b/java/org/apache/catalina/startup/AddPortOffsetRule.java
@@ -32,5 +32,12 @@ public class AddPortOffsetRule extends Rule {
 
 int portOffset = server.getPortOffset();
 conn.setPortOffset(portOffset);
+
+StringBuilder code = digester.getGeneratedCode();
+if (code != null) {
+
code.append(digester.toVariableName(conn)).append(".setPortOffset(");
+
code.append(digester.toVariableName(server)).append(".getPortOffset());");
+code.append(System.lineSeparator());
+}
 }
 }
\ No newline at end of file
diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index 4761571..0b23219 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -19,6 +19,7 @@ package org.apache.catalina.startup;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -29,6 +30,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 impor

[tomcat] branch 9.0.x updated: Update to OWB 2.0.17

2020-06-15 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new b2ceefd  Update to OWB 2.0.17
b2ceefd is described below

commit b2ceefd9f2676081051a6112ab388ee613dd53d0
Author: remm 
AuthorDate: Mon Jun 15 15:18:58 2020 +0200

Update to OWB 2.0.17

Use the new shade plugin version, it seems to work properly now. Simply
some items ... But add new stuff due to new warnings.
---
 modules/owb/pom.xml| 31 ---
 webapps/docs/changelog.xml |  3 +++
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/modules/owb/pom.xml b/modules/owb/pom.xml
index ee2869a..7fe93e5 100644
--- a/modules/owb/pom.xml
+++ b/modules/owb/pom.xml
@@ -29,14 +29,14 @@
 Apache Tomcat CDI 2 support
 Apache Tomcat CDI 2 support using Apache 
OpenWebBeans
 
-2.0.16
+2.0.17
 jar
 
 
 1.0
 1.0
 1.0.1
-9.0.33
+9.0.36
 
 
 
@@ -80,7 +80,6 @@
 
 
 
-
 
 
 
@@ -95,7 +94,7 @@
 
 org.apache.maven.plugins
 maven-shade-plugin
-3.2.1
+3.2.4
 
 
 package
@@ -105,21 +104,23 @@
 
 
false
 
-
-
-${mainClass}
-
+
+
+
+
 
+
+
+*:*
+
+
META-INF/DEPENDENCIES
+META-INF/MANIFEST.MF
+
+
+
 
 
 
-
-
-org.apache.openwebbeans
-openwebbeans-maven
-${project.version}
-
-
 
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 888f540..316b7b7 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -97,6 +97,9 @@
 64515: Bnd files don't need to be filtered (save some work).
 Pull request provided by Raymond Augé. (markt)
   
+  
+Update the OWB module to Apache OpenWebBeans 2.0.17. (remm)
+  
 
   
 


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



[tomcat] branch master updated: Update to OWB 2.0.17

2020-06-15 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new eeafcd7  Update to OWB 2.0.17
eeafcd7 is described below

commit eeafcd76feaae0558e0e6c60ac4d9ad00b3d221b
Author: remm 
AuthorDate: Mon Jun 15 15:18:58 2020 +0200

Update to OWB 2.0.17

Use the new shade plugin version, it seems to work properly now. Simply
some items ... But add new stuff due to new warnings.
---
 modules/owb/pom.xml| 34 --
 webapps/docs/changelog.xml |  3 +++
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/modules/owb/pom.xml b/modules/owb/pom.xml
index 1a58c67..2fd627b 100644
--- a/modules/owb/pom.xml
+++ b/modules/owb/pom.xml
@@ -29,14 +29,14 @@
 Apache Tomcat CDI 2 support
 Apache Tomcat CDI 2 support using Apache 
OpenWebBeans
 
-2.0.16
+2.0.17
 jar
 
 
 1.0
 1.0
 1.0.1
-10.0.0-M3
+10.0.0-M6
 
 
 
@@ -80,7 +80,6 @@
 
 
 
-
 
 
 
@@ -95,8 +94,7 @@
 
 org.apache.maven.plugins
 maven-shade-plugin
-3.2.1
-
+3.2.4
 
 
 package
@@ -106,23 +104,23 @@
 
 
false
 
-
-
-
-${mainClass}
-
+
+
+
+
 
+
+
+*:*
+
+
META-INF/DEPENDENCIES
+META-INF/MANIFEST.MF
+
+
+
 
 
 
-
-
-
-org.apache.openwebbeans
-openwebbeans-maven
-${project.version}
-
-
 
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 61c628c..de814bc 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -103,6 +103,9 @@
 64515: Bnd files don't need to be filtered (save some work).
 Pull request provided by Raymond Augé. (markt)
   
+  
+Update the OWB module to Apache OpenWebBeans 2.0.17. (remm)
+  
 
   
 


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



[tomcat] branch 8.5.x updated: Add and use constants

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 5b794bb  Add and use constants
5b794bb is described below

commit 5b794bb68f720ec0cc37465a49fc9431f90136b7
Author: remm 
AuthorDate: Thu Jun 11 17:22:06 2020 +0200

Add and use constants
---
 java/org/apache/tomcat/util/net/jsse/PEMFile.java | 27 +++
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index cccf8f4..ee62c25 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -62,11 +62,11 @@ public class PEMFile {
 
 public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
 StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
+result.append(Part.BEGIN_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 result.append(System.lineSeparator());
 Base64 b64 = new Base64(64);
 result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
+result.append(Part.END_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 return result.toString();
 }
 
@@ -103,7 +103,8 @@ public class PEMFile {
 while ((line = reader.readLine()) != null) {
 if (line.startsWith(Part.BEGIN_BOUNDARY)) {
 part = new Part();
-part.type = line.substring(Part.BEGIN_BOUNDARY.length(), 
line.length() - 5).trim();
+part.type = line.substring(Part.BEGIN_BOUNDARY.length(),
+line.length() - 
Part.FINISH_BOUNDARY.length()).trim();
 } else if (line.startsWith(Part.END_BOUNDARY)) {
 parts.add(part);
 part = null;
@@ -115,20 +116,20 @@ public class PEMFile {
 
 for (Part part : parts) {
 switch (part.type) {
-case "PRIVATE KEY":
+case Part.PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS8);
 break;
-case "EC PRIVATE KEY":
+case Part.EC_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, "EC", Format.RFC5915);
 break;
-case "ENCRYPTED PRIVATE KEY":
+case Part.ENCRYPTED_PRIVATE_KEY:
 privateKey = part.toPrivateKey(password, keyAlgorithm, 
Format.PKCS8);
 break;
-case "RSA PRIVATE KEY":
+case Part.RSA_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS1);
 break;
-case "CERTIFICATE":
-case "X509 CERTIFICATE":
+case Part.CERTIFICATE:
+case Part.X509_CERTIFICATE:
 certificates.add(part.toCertificate());
 break;
 }
@@ -138,6 +139,14 @@ public class PEMFile {
 private class Part {
 public static final String BEGIN_BOUNDARY = "-BEGIN ";
 public static final String END_BOUNDARY   = "-END ";
+public static final String FINISH_BOUNDARY = "-";
+
+public static final String PRIVATE_KEY = "PRIVATE KEY";
+public static final String EC_PRIVATE_KEY = "EC PRIVATE KEY";
+public static final String ENCRYPTED_PRIVATE_KEY = "ENCRYPTED PRIVATE 
KEY";
+public static final String RSA_PRIVATE_KEY = "RSA PRIVATE KEY";
+public static final String CERTIFICATE = "CERTIFICATE";
+public static final String X509_CERTIFICATE = "X509 CERTIFICATE";
 
 public String type;
 public String content = "";


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



[tomcat] branch 8.5.x updated: Add and use constants

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 5b794bb  Add and use constants
5b794bb is described below

commit 5b794bb68f720ec0cc37465a49fc9431f90136b7
Author: remm 
AuthorDate: Thu Jun 11 17:22:06 2020 +0200

Add and use constants
---
 java/org/apache/tomcat/util/net/jsse/PEMFile.java | 27 +++
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index cccf8f4..ee62c25 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -62,11 +62,11 @@ public class PEMFile {
 
 public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
 StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
+result.append(Part.BEGIN_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 result.append(System.lineSeparator());
 Base64 b64 = new Base64(64);
 result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
+result.append(Part.END_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 return result.toString();
 }
 
@@ -103,7 +103,8 @@ public class PEMFile {
 while ((line = reader.readLine()) != null) {
 if (line.startsWith(Part.BEGIN_BOUNDARY)) {
 part = new Part();
-part.type = line.substring(Part.BEGIN_BOUNDARY.length(), 
line.length() - 5).trim();
+part.type = line.substring(Part.BEGIN_BOUNDARY.length(),
+line.length() - 
Part.FINISH_BOUNDARY.length()).trim();
 } else if (line.startsWith(Part.END_BOUNDARY)) {
 parts.add(part);
 part = null;
@@ -115,20 +116,20 @@ public class PEMFile {
 
 for (Part part : parts) {
 switch (part.type) {
-case "PRIVATE KEY":
+case Part.PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS8);
 break;
-case "EC PRIVATE KEY":
+case Part.EC_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, "EC", Format.RFC5915);
 break;
-case "ENCRYPTED PRIVATE KEY":
+case Part.ENCRYPTED_PRIVATE_KEY:
 privateKey = part.toPrivateKey(password, keyAlgorithm, 
Format.PKCS8);
 break;
-case "RSA PRIVATE KEY":
+case Part.RSA_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS1);
 break;
-case "CERTIFICATE":
-case "X509 CERTIFICATE":
+case Part.CERTIFICATE:
+case Part.X509_CERTIFICATE:
 certificates.add(part.toCertificate());
 break;
 }
@@ -138,6 +139,14 @@ public class PEMFile {
 private class Part {
 public static final String BEGIN_BOUNDARY = "-BEGIN ";
 public static final String END_BOUNDARY   = "-END ";
+public static final String FINISH_BOUNDARY = "-";
+
+public static final String PRIVATE_KEY = "PRIVATE KEY";
+public static final String EC_PRIVATE_KEY = "EC PRIVATE KEY";
+public static final String ENCRYPTED_PRIVATE_KEY = "ENCRYPTED PRIVATE 
KEY";
+public static final String RSA_PRIVATE_KEY = "RSA PRIVATE KEY";
+public static final String CERTIFICATE = "CERTIFICATE";
+public static final String X509_CERTIFICATE = "X509 CERTIFICATE";
 
 public String type;
 public String content = "";


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



[tomcat] branch 8.5.x updated: Add and use constants

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 5b794bb  Add and use constants
5b794bb is described below

commit 5b794bb68f720ec0cc37465a49fc9431f90136b7
Author: remm 
AuthorDate: Thu Jun 11 17:22:06 2020 +0200

Add and use constants
---
 java/org/apache/tomcat/util/net/jsse/PEMFile.java | 27 +++
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index cccf8f4..ee62c25 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -62,11 +62,11 @@ public class PEMFile {
 
 public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
 StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
+result.append(Part.BEGIN_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 result.append(System.lineSeparator());
 Base64 b64 = new Base64(64);
 result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
+result.append(Part.END_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 return result.toString();
 }
 
@@ -103,7 +103,8 @@ public class PEMFile {
 while ((line = reader.readLine()) != null) {
 if (line.startsWith(Part.BEGIN_BOUNDARY)) {
 part = new Part();
-part.type = line.substring(Part.BEGIN_BOUNDARY.length(), 
line.length() - 5).trim();
+part.type = line.substring(Part.BEGIN_BOUNDARY.length(),
+line.length() - 
Part.FINISH_BOUNDARY.length()).trim();
 } else if (line.startsWith(Part.END_BOUNDARY)) {
 parts.add(part);
 part = null;
@@ -115,20 +116,20 @@ public class PEMFile {
 
 for (Part part : parts) {
 switch (part.type) {
-case "PRIVATE KEY":
+case Part.PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS8);
 break;
-case "EC PRIVATE KEY":
+case Part.EC_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, "EC", Format.RFC5915);
 break;
-case "ENCRYPTED PRIVATE KEY":
+case Part.ENCRYPTED_PRIVATE_KEY:
 privateKey = part.toPrivateKey(password, keyAlgorithm, 
Format.PKCS8);
 break;
-case "RSA PRIVATE KEY":
+case Part.RSA_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS1);
 break;
-case "CERTIFICATE":
-case "X509 CERTIFICATE":
+case Part.CERTIFICATE:
+case Part.X509_CERTIFICATE:
 certificates.add(part.toCertificate());
 break;
 }
@@ -138,6 +139,14 @@ public class PEMFile {
 private class Part {
 public static final String BEGIN_BOUNDARY = "-BEGIN ";
 public static final String END_BOUNDARY   = "-END ";
+public static final String FINISH_BOUNDARY = "-";
+
+public static final String PRIVATE_KEY = "PRIVATE KEY";
+public static final String EC_PRIVATE_KEY = "EC PRIVATE KEY";
+public static final String ENCRYPTED_PRIVATE_KEY = "ENCRYPTED PRIVATE 
KEY";
+public static final String RSA_PRIVATE_KEY = "RSA PRIVATE KEY";
+public static final String CERTIFICATE = "CERTIFICATE";
+public static final String X509_CERTIFICATE = "X509 CERTIFICATE";
 
 public String type;
 public String content = "";


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



[tomcat] branch 8.5.x updated: Add and use constants

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 5b794bb  Add and use constants
5b794bb is described below

commit 5b794bb68f720ec0cc37465a49fc9431f90136b7
Author: remm 
AuthorDate: Thu Jun 11 17:22:06 2020 +0200

Add and use constants
---
 java/org/apache/tomcat/util/net/jsse/PEMFile.java | 27 +++
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index cccf8f4..ee62c25 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -62,11 +62,11 @@ public class PEMFile {
 
 public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
 StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
+result.append(Part.BEGIN_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 result.append(System.lineSeparator());
 Base64 b64 = new Base64(64);
 result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
+result.append(Part.END_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 return result.toString();
 }
 
@@ -103,7 +103,8 @@ public class PEMFile {
 while ((line = reader.readLine()) != null) {
 if (line.startsWith(Part.BEGIN_BOUNDARY)) {
 part = new Part();
-part.type = line.substring(Part.BEGIN_BOUNDARY.length(), 
line.length() - 5).trim();
+part.type = line.substring(Part.BEGIN_BOUNDARY.length(),
+line.length() - 
Part.FINISH_BOUNDARY.length()).trim();
 } else if (line.startsWith(Part.END_BOUNDARY)) {
 parts.add(part);
 part = null;
@@ -115,20 +116,20 @@ public class PEMFile {
 
 for (Part part : parts) {
 switch (part.type) {
-case "PRIVATE KEY":
+case Part.PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS8);
 break;
-case "EC PRIVATE KEY":
+case Part.EC_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, "EC", Format.RFC5915);
 break;
-case "ENCRYPTED PRIVATE KEY":
+case Part.ENCRYPTED_PRIVATE_KEY:
 privateKey = part.toPrivateKey(password, keyAlgorithm, 
Format.PKCS8);
 break;
-case "RSA PRIVATE KEY":
+case Part.RSA_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS1);
 break;
-case "CERTIFICATE":
-case "X509 CERTIFICATE":
+case Part.CERTIFICATE:
+case Part.X509_CERTIFICATE:
 certificates.add(part.toCertificate());
 break;
 }
@@ -138,6 +139,14 @@ public class PEMFile {
 private class Part {
 public static final String BEGIN_BOUNDARY = "-BEGIN ";
 public static final String END_BOUNDARY   = "-END ";
+public static final String FINISH_BOUNDARY = "-";
+
+public static final String PRIVATE_KEY = "PRIVATE KEY";
+public static final String EC_PRIVATE_KEY = "EC PRIVATE KEY";
+public static final String ENCRYPTED_PRIVATE_KEY = "ENCRYPTED PRIVATE 
KEY";
+public static final String RSA_PRIVATE_KEY = "RSA PRIVATE KEY";
+public static final String CERTIFICATE = "CERTIFICATE";
+public static final String X509_CERTIFICATE = "X509 CERTIFICATE";
 
 public String type;
 public String content = "";


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



[tomcat] branch 9.0.x updated: Add and use constants

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new a2410bb  Add and use constants
a2410bb is described below

commit a2410bb2076ac657f5afa4e924e60182129e5990
Author: remm 
AuthorDate: Thu Jun 11 17:22:06 2020 +0200

Add and use constants
---
 java/org/apache/tomcat/util/net/jsse/PEMFile.java | 27 +++
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index 02f54ca..900bb91 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -62,11 +62,11 @@ public class PEMFile {
 
 public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
 StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
+result.append(Part.BEGIN_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 result.append(System.lineSeparator());
 Base64 b64 = new Base64(64);
 result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
+result.append(Part.END_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 return result.toString();
 }
 
@@ -103,7 +103,8 @@ public class PEMFile {
 while ((line = reader.readLine()) != null) {
 if (line.startsWith(Part.BEGIN_BOUNDARY)) {
 part = new Part();
-part.type = line.substring(Part.BEGIN_BOUNDARY.length(), 
line.length() - 5).trim();
+part.type = line.substring(Part.BEGIN_BOUNDARY.length(),
+line.length() - 
Part.FINISH_BOUNDARY.length()).trim();
 } else if (line.startsWith(Part.END_BOUNDARY)) {
 parts.add(part);
 part = null;
@@ -115,20 +116,20 @@ public class PEMFile {
 
 for (Part part : parts) {
 switch (part.type) {
-case "PRIVATE KEY":
+case Part.PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS8);
 break;
-case "EC PRIVATE KEY":
+case Part.EC_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, "EC", Format.RFC5915);
 break;
-case "ENCRYPTED PRIVATE KEY":
+case Part.ENCRYPTED_PRIVATE_KEY:
 privateKey = part.toPrivateKey(password, keyAlgorithm, 
Format.PKCS8);
 break;
-case "RSA PRIVATE KEY":
+case Part.RSA_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS1);
 break;
-case "CERTIFICATE":
-case "X509 CERTIFICATE":
+case Part.CERTIFICATE:
+case Part.X509_CERTIFICATE:
 certificates.add(part.toCertificate());
 break;
 }
@@ -138,6 +139,14 @@ public class PEMFile {
 private class Part {
 public static final String BEGIN_BOUNDARY = "-BEGIN ";
 public static final String END_BOUNDARY   = "-END ";
+public static final String FINISH_BOUNDARY = "-";
+
+public static final String PRIVATE_KEY = "PRIVATE KEY";
+public static final String EC_PRIVATE_KEY = "EC PRIVATE KEY";
+public static final String ENCRYPTED_PRIVATE_KEY = "ENCRYPTED PRIVATE 
KEY";
+public static final String RSA_PRIVATE_KEY = "RSA PRIVATE KEY";
+public static final String CERTIFICATE = "CERTIFICATE";
+public static final String X509_CERTIFICATE = "X509 CERTIFICATE";
 
 public String type;
 public String content = "";


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



[tomcat] branch master updated: Add and use constants

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new dd558b6  Add and use constants
dd558b6 is described below

commit dd558b67e5830244fca87675389a182a6acfab2c
Author: remm 
AuthorDate: Thu Jun 11 17:22:06 2020 +0200

Add and use constants
---
 java/org/apache/tomcat/util/net/jsse/PEMFile.java | 27 +++
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index 02f54ca..900bb91 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -62,11 +62,11 @@ public class PEMFile {
 
 public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
 StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
+result.append(Part.BEGIN_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 result.append(System.lineSeparator());
 Base64 b64 = new Base64(64);
 result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
+result.append(Part.END_BOUNDARY + Part.CERTIFICATE + 
Part.FINISH_BOUNDARY);
 return result.toString();
 }
 
@@ -103,7 +103,8 @@ public class PEMFile {
 while ((line = reader.readLine()) != null) {
 if (line.startsWith(Part.BEGIN_BOUNDARY)) {
 part = new Part();
-part.type = line.substring(Part.BEGIN_BOUNDARY.length(), 
line.length() - 5).trim();
+part.type = line.substring(Part.BEGIN_BOUNDARY.length(),
+line.length() - 
Part.FINISH_BOUNDARY.length()).trim();
 } else if (line.startsWith(Part.END_BOUNDARY)) {
 parts.add(part);
 part = null;
@@ -115,20 +116,20 @@ public class PEMFile {
 
 for (Part part : parts) {
 switch (part.type) {
-case "PRIVATE KEY":
+case Part.PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS8);
 break;
-case "EC PRIVATE KEY":
+case Part.EC_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, "EC", Format.RFC5915);
 break;
-case "ENCRYPTED PRIVATE KEY":
+case Part.ENCRYPTED_PRIVATE_KEY:
 privateKey = part.toPrivateKey(password, keyAlgorithm, 
Format.PKCS8);
 break;
-case "RSA PRIVATE KEY":
+case Part.RSA_PRIVATE_KEY:
 privateKey = part.toPrivateKey(null, keyAlgorithm, 
Format.PKCS1);
 break;
-case "CERTIFICATE":
-case "X509 CERTIFICATE":
+case Part.CERTIFICATE:
+case Part.X509_CERTIFICATE:
 certificates.add(part.toCertificate());
 break;
 }
@@ -138,6 +139,14 @@ public class PEMFile {
 private class Part {
 public static final String BEGIN_BOUNDARY = "-BEGIN ";
 public static final String END_BOUNDARY   = "-END ";
+public static final String FINISH_BOUNDARY = "-";
+
+public static final String PRIVATE_KEY = "PRIVATE KEY";
+public static final String EC_PRIVATE_KEY = "EC PRIVATE KEY";
+public static final String ENCRYPTED_PRIVATE_KEY = "ENCRYPTED PRIVATE 
KEY";
+public static final String RSA_PRIVATE_KEY = "RSA PRIVATE KEY";
+public static final String CERTIFICATE = "CERTIFICATE";
+public static final String X509_CERTIFICATE = "X509 CERTIFICATE";
 
 public String type;
 public String content = "";


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



[tomcat] branch 8.5.x updated: Move toPEM to PEMFile

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 375f588  Move toPEM to PEMFile
375f588 is described below

commit 375f5887029759cb88ee44c4600835f6035e3573
Author: remm 
AuthorDate: Thu Jun 11 14:40:34 2020 +0200

Move toPEM to PEMFile

Also remove obsolete class comment since it now supports more formats.
---
 .../org/apache/catalina/valves/rewrite/ResolverImpl.java | 16 +++-
 java/org/apache/tomcat/util/net/jsse/PEMFile.java| 15 ---
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index 3b443c7..f4c38e1 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -33,9 +33,9 @@ import java.util.concurrent.TimeUnit;
 import org.apache.catalina.WebResource;
 import org.apache.catalina.WebResourceRoot;
 import org.apache.catalina.connector.Request;
-import org.apache.tomcat.util.codec.binary.Base64;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.net.SSLSupport;
+import org.apache.tomcat.util.net.jsse.PEMFile;
 import org.apache.tomcat.util.net.openssl.ciphers.Cipher;
 import org.apache.tomcat.util.net.openssl.ciphers.EncryptionLevel;
 import 
org.apache.tomcat.util.net.openssl.ciphers.OpenSSLCipherConfigurationParser;
@@ -256,13 +256,13 @@ public class ResolverImpl extends Resolver {
 return certificates[0].getPublicKey().getAlgorithm();
 } else if (key.equals("CERT")) {
 try {
-return toPEM(certificates[0]);
+return PEMFile.toPEM(certificates[0]);
 } catch (CertificateEncodingException e) {
 }
 } else if (key.startsWith("CERT_CHAIN_")) {
 key = key.substring("CERT_CHAIN_".length());
 try {
-return toPEM(certificates[Integer.parseInt(key)]);
+return PEMFile.toPEM(certificates[Integer.parseInt(key)]);
 } catch (NumberFormatException | ArrayIndexOutOfBoundsException
 | CertificateEncodingException e) {
 // Ignore
@@ -306,16 +306,6 @@ public class ResolverImpl extends Resolver {
 return null;
 }
 
-private String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
-StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
-result.append(System.lineSeparator());
-Base64 b64 = new Base64(64);
-result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
-return result.toString();
-}
-
 @Override
 public String resolveHttp(String key) {
 String header = request.getHeader(key);
diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index a6d1164..cccf8f4 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -27,6 +27,7 @@ import java.security.GeneralSecurityException;
 import java.security.InvalidKeyException;
 import java.security.KeyFactory;
 import java.security.PrivateKey;
+import java.security.cert.CertificateEncodingException;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
@@ -50,9 +51,7 @@ import org.apache.tomcat.util.file.ConfigFileLoader;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * RFC 1421 PEM file containing X509 certificates or private keys (PKCS#8 only,
- * i.e. with boundaries containing "BEGIN PRIVATE KEY" or "BEGIN ENCRYPTED 
PRIVATE KEY",
- * not "BEGIN RSA PRIVATE KEY" or other variations).
+ * RFC 1421 PEM file containing X509 certificates or private keys.
  */
 public class PEMFile {
 
@@ -61,6 +60,16 @@ public class PEMFile {
 private static final byte[] OID_EC_PUBLIC_KEY =
 new byte[] { 0x06, 0x07, 0x2A, (byte) 0x86, 0x48, (byte) 0xCE, 
0x3D, 0x02, 0x01 };
 
+public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
+StringBuilder result = new StringBuilder();
+result.append("-BEGIN CERTIFICATE-");
+result.append(System.lineSeparator());
+Base64 b64 = new Base64(64);
+result.append(b64.encodeAsString(certificate.getEncoded()));
+result.append("-END CERTIFICATE-");
+return result.toString();
+}
+
 private Str

[tomcat] branch 9.0.x updated: Move toPEM to PEMFile

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 886f96d  Move toPEM to PEMFile
886f96d is described below

commit 886f96de122b5692e949f76047d37d70f175ae64
Author: remm 
AuthorDate: Thu Jun 11 14:40:34 2020 +0200

Move toPEM to PEMFile

Also remove obsolete class comment since it now supports more formats.
---
 .../org/apache/catalina/valves/rewrite/ResolverImpl.java | 16 +++-
 java/org/apache/tomcat/util/net/jsse/PEMFile.java| 15 ---
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index 7b30227..01afcff 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -33,9 +33,9 @@ import java.util.concurrent.TimeUnit;
 import org.apache.catalina.WebResource;
 import org.apache.catalina.WebResourceRoot;
 import org.apache.catalina.connector.Request;
-import org.apache.tomcat.util.codec.binary.Base64;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.net.SSLSupport;
+import org.apache.tomcat.util.net.jsse.PEMFile;
 import org.apache.tomcat.util.net.openssl.ciphers.Cipher;
 import org.apache.tomcat.util.net.openssl.ciphers.EncryptionLevel;
 import 
org.apache.tomcat.util.net.openssl.ciphers.OpenSSLCipherConfigurationParser;
@@ -267,13 +267,13 @@ public class ResolverImpl extends Resolver {
 return certificates[0].getPublicKey().getAlgorithm();
 } else if (key.equals("CERT")) {
 try {
-return toPEM(certificates[0]);
+return PEMFile.toPEM(certificates[0]);
 } catch (CertificateEncodingException e) {
 }
 } else if (key.startsWith("CERT_CHAIN_")) {
 key = key.substring("CERT_CHAIN_".length());
 try {
-return toPEM(certificates[Integer.parseInt(key)]);
+return PEMFile.toPEM(certificates[Integer.parseInt(key)]);
 } catch (NumberFormatException | ArrayIndexOutOfBoundsException
 | CertificateEncodingException e) {
 // Ignore
@@ -317,16 +317,6 @@ public class ResolverImpl extends Resolver {
 return null;
 }
 
-private String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
-StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
-result.append(System.lineSeparator());
-Base64 b64 = new Base64(64);
-result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
-return result.toString();
-}
-
 @Override
 public String resolveHttp(String key) {
 String header = request.getHeader(key);
diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index 0dd4aef..02f54ca 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -27,6 +27,7 @@ import java.security.GeneralSecurityException;
 import java.security.InvalidKeyException;
 import java.security.KeyFactory;
 import java.security.PrivateKey;
+import java.security.cert.CertificateEncodingException;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
@@ -50,9 +51,7 @@ import org.apache.tomcat.util.file.ConfigFileLoader;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * RFC 1421 PEM file containing X509 certificates or private keys (PKCS#8 only,
- * i.e. with boundaries containing "BEGIN PRIVATE KEY" or "BEGIN ENCRYPTED 
PRIVATE KEY",
- * not "BEGIN RSA PRIVATE KEY" or other variations).
+ * RFC 1421 PEM file containing X509 certificates or private keys.
  */
 public class PEMFile {
 
@@ -61,6 +60,16 @@ public class PEMFile {
 private static final byte[] OID_EC_PUBLIC_KEY =
 new byte[] { 0x06, 0x07, 0x2A, (byte) 0x86, 0x48, (byte) 0xCE, 
0x3D, 0x02, 0x01 };
 
+public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
+StringBuilder result = new StringBuilder();
+result.append("-BEGIN CERTIFICATE-");
+result.append(System.lineSeparator());
+Base64 b64 = new Base64(64);
+result.append(b64.encodeAsString(certificate.getEncoded()));
+result.append("-END CERTIFICATE-");
+return result.toString();
+}
+
 private Str

[tomcat] branch master updated: Move toPEM to PEMFile

2020-06-11 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 3075a2b  Move toPEM to PEMFile
3075a2b is described below

commit 3075a2b8bf061acf6dbaa35519814994f71778ba
Author: remm 
AuthorDate: Thu Jun 11 14:40:34 2020 +0200

Move toPEM to PEMFile

Also remove obsolete class comment since it now supports more formats.
---
 .../org/apache/catalina/valves/rewrite/ResolverImpl.java | 16 +++-
 java/org/apache/tomcat/util/net/jsse/PEMFile.java| 15 ---
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index 7b30227..01afcff 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -33,9 +33,9 @@ import java.util.concurrent.TimeUnit;
 import org.apache.catalina.WebResource;
 import org.apache.catalina.WebResourceRoot;
 import org.apache.catalina.connector.Request;
-import org.apache.tomcat.util.codec.binary.Base64;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.net.SSLSupport;
+import org.apache.tomcat.util.net.jsse.PEMFile;
 import org.apache.tomcat.util.net.openssl.ciphers.Cipher;
 import org.apache.tomcat.util.net.openssl.ciphers.EncryptionLevel;
 import 
org.apache.tomcat.util.net.openssl.ciphers.OpenSSLCipherConfigurationParser;
@@ -267,13 +267,13 @@ public class ResolverImpl extends Resolver {
 return certificates[0].getPublicKey().getAlgorithm();
 } else if (key.equals("CERT")) {
 try {
-return toPEM(certificates[0]);
+return PEMFile.toPEM(certificates[0]);
 } catch (CertificateEncodingException e) {
 }
 } else if (key.startsWith("CERT_CHAIN_")) {
 key = key.substring("CERT_CHAIN_".length());
 try {
-return toPEM(certificates[Integer.parseInt(key)]);
+return PEMFile.toPEM(certificates[Integer.parseInt(key)]);
 } catch (NumberFormatException | ArrayIndexOutOfBoundsException
 | CertificateEncodingException e) {
 // Ignore
@@ -317,16 +317,6 @@ public class ResolverImpl extends Resolver {
 return null;
 }
 
-private String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
-StringBuilder result = new StringBuilder();
-result.append("-BEGIN CERTIFICATE-");
-result.append(System.lineSeparator());
-Base64 b64 = new Base64(64);
-result.append(b64.encodeAsString(certificate.getEncoded()));
-result.append("-END CERTIFICATE-");
-return result.toString();
-}
-
 @Override
 public String resolveHttp(String key) {
 String header = request.getHeader(key);
diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java 
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index 0dd4aef..02f54ca 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -27,6 +27,7 @@ import java.security.GeneralSecurityException;
 import java.security.InvalidKeyException;
 import java.security.KeyFactory;
 import java.security.PrivateKey;
+import java.security.cert.CertificateEncodingException;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
@@ -50,9 +51,7 @@ import org.apache.tomcat.util.file.ConfigFileLoader;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * RFC 1421 PEM file containing X509 certificates or private keys (PKCS#8 only,
- * i.e. with boundaries containing "BEGIN PRIVATE KEY" or "BEGIN ENCRYPTED 
PRIVATE KEY",
- * not "BEGIN RSA PRIVATE KEY" or other variations).
+ * RFC 1421 PEM file containing X509 certificates or private keys.
  */
 public class PEMFile {
 
@@ -61,6 +60,16 @@ public class PEMFile {
 private static final byte[] OID_EC_PUBLIC_KEY =
 new byte[] { 0x06, 0x07, 0x2A, (byte) 0x86, 0x48, (byte) 0xCE, 
0x3D, 0x02, 0x01 };
 
+public static String toPEM(X509Certificate certificate) throws 
CertificateEncodingException {
+StringBuilder result = new StringBuilder();
+result.append("-BEGIN CERTIFICATE-");
+result.append(System.lineSeparator());
+Base64 b64 = new Base64(64);
+result.append(b64.encodeAsString(certificate.getEncoded()));
+result.append("-END CERTIFICATE-");
+return result.toString();
+}
+
 private Str

[tomcat] branch 8.5.x updated: Ignore exception getting content length

2020-06-05 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new caa925b  Ignore exception getting content length
caa925b is described below

commit caa925b0b918530d758699e0503df3ea3d37cd95
Author: remm 
AuthorDate: Fri Jun 5 14:21:39 2020 +0200

Ignore exception getting content length

If the value is invalid, there will be another attempt to convert the
number with no really easy way out. Ignore the exception which already
happened in prepareRequest.
---
 java/org/apache/coyote/http11/Http11Processor.java | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 409cd8c..0ba6597 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -770,8 +770,16 @@ public class Http11Processor extends AbstractProcessor {
 
 
 private void checkMaxSwallowSize() {
-if (request.getContentLengthLong() > 0 &&
-(request.getContentLengthLong() - request.getBytesRead() > 
protocol.getMaxSwallowSize())) {
+// Parse content-length header
+long contentLength = -1;
+try {
+contentLength = request.getContentLengthLong();
+} catch (Exception e) {
+// Ignore, an error here is already processed in prepareRequest
+// but is done again since the content length is still -1
+}
+if (contentLength > 0 &&
+(contentLength - request.getBytesRead() > 
protocol.getMaxSwallowSize())) {
 // There is more data to swallow than Tomcat will accept so the
 // connection is going to be closed. Disable keep-alive which will
 // trigger adding the "Connection: close" header if not already


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



[tomcat] branch 9.0.x updated: Ignore exception getting content length

2020-06-05 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 16d3cbf  Ignore exception getting content length
16d3cbf is described below

commit 16d3cbff99d57045af93d6d95e3fec5050d897b6
Author: remm 
AuthorDate: Fri Jun 5 14:21:39 2020 +0200

Ignore exception getting content length

If the value is invalid, there will be another attempt to convert the
number with no really easy way out. Ignore the exception which already
happened in prepareRequest.
---
 java/org/apache/coyote/http11/Http11Processor.java | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 4d48d92..f467f15 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -528,8 +528,16 @@ public class Http11Processor extends AbstractProcessor {
 
 
 private void checkMaxSwallowSize() {
-if (request.getContentLengthLong() > 0 &&
-(request.getContentLengthLong() - request.getBytesRead() > 
protocol.getMaxSwallowSize())) {
+// Parse content-length header
+long contentLength = -1;
+try {
+contentLength = request.getContentLengthLong();
+} catch (Exception e) {
+// Ignore, an error here is already processed in prepareRequest
+// but is done again since the content length is still -1
+}
+if (contentLength > 0 &&
+(contentLength - request.getBytesRead() > 
protocol.getMaxSwallowSize())) {
 // There is more data to swallow than Tomcat will accept so the
 // connection is going to be closed. Disable keep-alive which will
 // trigger adding the "Connection: close" header if not already


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



[tomcat] branch master updated: Ignore exception getting content length

2020-06-05 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new e8bcbf1  Ignore exception getting content length
e8bcbf1 is described below

commit e8bcbf1a017e598498343ebd05f77f07934910bb
Author: remm 
AuthorDate: Fri Jun 5 14:21:39 2020 +0200

Ignore exception getting content length

If the value is invalid, there will be another attempt to convert the
number with no really easy way out. Ignore the exception which already
happened in prepareRequest.
---
 java/org/apache/coyote/http11/Http11Processor.java | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 897c2d9..00469e1 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -528,8 +528,16 @@ public class Http11Processor extends AbstractProcessor {
 
 
 private void checkMaxSwallowSize() {
-if (request.getContentLengthLong() > 0 &&
-(request.getContentLengthLong() - request.getBytesRead() > 
protocol.getMaxSwallowSize())) {
+// Parse content-length header
+long contentLength = -1;
+try {
+contentLength = request.getContentLengthLong();
+} catch (Exception e) {
+// Ignore, an error here is already processed in prepareRequest
+// but is done again since the content length is still -1
+}
+if (contentLength > 0 &&
+(contentLength - request.getBytesRead() > 
protocol.getMaxSwallowSize())) {
 // There is more data to swallow than Tomcat will accept so the
 // connection is going to be closed. Disable keep-alive which will
 // trigger adding the "Connection: close" header if not already


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



[tomcat] 02/02: No server certificate in 8.5

2020-06-05 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit b0a52eef7a9e46789a22d552342670a1b6d9453e
Author: remm 
AuthorDate: Fri Jun 5 11:12:47 2020 +0200

No server certificate in 8.5
---
 webapps/docs/rewrite.xml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/webapps/docs/rewrite.xml b/webapps/docs/rewrite.xml
index 7c0a7a3..40c0f99 100644
--- a/webapps/docs/rewrite.xml
+++ b/webapps/docs/rewrite.xml
@@ -250,9 +250,8 @@
 SSL_SRP_USER, SSL_SRP_USERINFO,
 SSL_CLIENT_VERIFY,
 SSL_CLIENT_SAN_OTHER_msUPN_n,
-SSL_CLIENT_CERT_RFC4523_CEA,
-SSL_SERVER_SAN_OTHER_dnsSRV_n.
-When OpenSSL is used, the variables related to the server
+SSL_CLIENT_CERT_RFC4523_CEA.
+Also, the variables related to the server
 certificate, prefixed by SSL_SERVER_ are not available.
 Example:
 %{SSL:SSL_CIPHER_USEKEYSIZE} may expand to


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



[tomcat] 01/02: Document TLS environment update

2020-06-05 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 9032bfeb1e0abbd73973740aaa2b1252c1244d27
Author: remm 
AuthorDate: Fri Jun 5 11:09:42 2020 +0200

Document TLS environment update
---
 webapps/docs/changelog.xml |  4 
 webapps/docs/rewrite.xml   | 13 ++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1394312..f4a7644 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -53,6 +53,10 @@
 the sole feature that depends on it (anti-resource locking) is
 configured and can't be used. (markt)
   
+  
+Implement a significant portion of the TLS environment variables for
+the rewrite valve. (remm)
+  
 
   
   
diff --git a/webapps/docs/rewrite.xml b/webapps/docs/rewrite.xml
index 8ab57f4..7c0a7a3 100644
--- a/webapps/docs/rewrite.xml
+++ b/webapps/docs/rewrite.xml
@@ -244,9 +244,16 @@
 
 %{SSL:variable}, where variable is the
 name of an SSL environment
-variable, are not implemented, except
-SSL_PROTOCOL, SSL_SESSION_ID,
-SSL_CIPHER and SSL_CIPHER_USEKEYSIZE.
+variable, are implemented, except
+SSL_SESSION_RESUMED, SSL_SECURE_RENEG,
+SSL_COMPRESS_METHOD, SSL_TLS_SNI,
+SSL_SRP_USER, SSL_SRP_USERINFO,
+SSL_CLIENT_VERIFY,
+SSL_CLIENT_SAN_OTHER_msUPN_n,
+SSL_CLIENT_CERT_RFC4523_CEA,
+SSL_SERVER_SAN_OTHER_dnsSRV_n.
+When OpenSSL is used, the variables related to the server
+certificate, prefixed by SSL_SERVER_ are not available.
 Example:
 %{SSL:SSL_CIPHER_USEKEYSIZE} may expand to
 128.


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



[tomcat] branch 8.5.x updated (11bd3b5 -> b0a52ee)

2020-06-05 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 11bd3b5  Improve handling of aborted uploads
 new 9032bfe  Document TLS environment update
 new b0a52ee  No server certificate in 8.5

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 webapps/docs/changelog.xml |  4 
 webapps/docs/rewrite.xml   | 12 +---
 2 files changed, 13 insertions(+), 3 deletions(-)


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



[tomcat] branch 9.0.x updated: Document TLS environment update

2020-06-05 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 4689a26  Document TLS environment update
4689a26 is described below

commit 4689a266effcfa6960a8c79d25f5dc03e679a9e2
Author: remm 
AuthorDate: Fri Jun 5 11:09:42 2020 +0200

Document TLS environment update
---
 webapps/docs/changelog.xml |  4 
 webapps/docs/rewrite.xml   | 13 ++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1d18452..facde6e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -53,6 +53,10 @@
 the sole feature that depends on it (anti-resource locking) is
 configured and can't be used. (markt)
   
+  
+Implement a significant portion of the TLS environment variables for
+the rewrite valve. (remm)
+  
 
   
   
diff --git a/webapps/docs/rewrite.xml b/webapps/docs/rewrite.xml
index be1befa..ea98d42 100644
--- a/webapps/docs/rewrite.xml
+++ b/webapps/docs/rewrite.xml
@@ -245,9 +245,16 @@
 
 %{SSL:variable}, where variable is the
 name of an SSL environment
-variable, are not implemented, except
-SSL_PROTOCOL, SSL_SESSION_ID,
-SSL_CIPHER and SSL_CIPHER_USEKEYSIZE.
+variable, are implemented, except
+SSL_SESSION_RESUMED, SSL_SECURE_RENEG,
+SSL_COMPRESS_METHOD, SSL_TLS_SNI,
+SSL_SRP_USER, SSL_SRP_USERINFO,
+SSL_CLIENT_VERIFY,
+SSL_CLIENT_SAN_OTHER_msUPN_n,
+SSL_CLIENT_CERT_RFC4523_CEA,
+SSL_SERVER_SAN_OTHER_dnsSRV_n.
+When OpenSSL is used, the variables related to the server
+certificate, prefixed by SSL_SERVER_ are not available.
 Example:
 %{SSL:SSL_CIPHER_USEKEYSIZE} may expand to
 128.


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



[tomcat] branch master updated: Document TLS environment update

2020-06-05 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new ad3f003  Document TLS environment update
ad3f003 is described below

commit ad3f0032c0a845d441139641bff51285dc650a31
Author: remm 
AuthorDate: Fri Jun 5 11:09:42 2020 +0200

Document TLS environment update
---
 webapps/docs/changelog.xml |  4 
 webapps/docs/rewrite.xml   | 13 ++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5eed2b7..09cc8e2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -53,6 +53,10 @@
 the sole feature that depends on it (anti-resource locking) is
 configured and can't be used. (markt)
   
+  
+Implement a significant portion of the TLS environment variables for
+the rewrite valve. (remm)
+  
 
   
   
diff --git a/webapps/docs/rewrite.xml b/webapps/docs/rewrite.xml
index be1befa..ea98d42 100644
--- a/webapps/docs/rewrite.xml
+++ b/webapps/docs/rewrite.xml
@@ -245,9 +245,16 @@
 
 %{SSL:variable}, where variable is the
 name of an SSL environment
-variable, are not implemented, except
-SSL_PROTOCOL, SSL_SESSION_ID,
-SSL_CIPHER and SSL_CIPHER_USEKEYSIZE.
+variable, are implemented, except
+SSL_SESSION_RESUMED, SSL_SECURE_RENEG,
+SSL_COMPRESS_METHOD, SSL_TLS_SNI,
+SSL_SRP_USER, SSL_SRP_USERINFO,
+SSL_CLIENT_VERIFY,
+SSL_CLIENT_SAN_OTHER_msUPN_n,
+SSL_CLIENT_CERT_RFC4523_CEA,
+SSL_SERVER_SAN_OTHER_dnsSRV_n.
+When OpenSSL is used, the variables related to the server
+certificate, prefixed by SSL_SERVER_ are not available.
 Example:
 %{SSL:SSL_CIPHER_USEKEYSIZE} may expand to
 128.


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



[tomcat] branch 8.5.x updated: Avoid IOOB

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 4d7dde1  Avoid IOOB
4d7dde1 is described below

commit 4d7dde1d15fda7257a18c39b45cf095dd0a71810
Author: remm 
AuthorDate: Fri Jun 5 00:34:04 2020 +0200

Avoid IOOB
---
 java/org/apache/catalina/valves/rewrite/ResolverImpl.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index cf4d154..3b443c7 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -295,7 +295,9 @@ public class ResolverImpl extends Resolver {
 elements.add(String.valueOf(alternateName.get(1)));
 }
 }
-return elements.get(n);
+if (elements.size() > n) {
+return elements.get(n);
+}
 }
 } catch (NumberFormatException | ArrayIndexOutOfBoundsException
 | CertificateParsingException e) {


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



[tomcat] branch 9.0.x updated: Avoid IOOB

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 1e649d5  Avoid IOOB
1e649d5 is described below

commit 1e649d5d794f4276541158d00c9a944e5ea0166e
Author: remm 
AuthorDate: Fri Jun 5 00:34:04 2020 +0200

Avoid IOOB
---
 java/org/apache/catalina/valves/rewrite/ResolverImpl.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index dfa0ebd..7b30227 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -306,7 +306,9 @@ public class ResolverImpl extends Resolver {
 elements.add(String.valueOf(alternateName.get(1)));
 }
 }
-return elements.get(n);
+if (elements.size() > n) {
+return elements.get(n);
+}
 }
 } catch (NumberFormatException | ArrayIndexOutOfBoundsException
 | CertificateParsingException e) {


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



[tomcat] branch master updated: Avoid IOOB

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new efdc5cd  Avoid IOOB
efdc5cd is described below

commit efdc5cd01563983d627bc00af0196c7295289c2f
Author: remm 
AuthorDate: Fri Jun 5 00:34:04 2020 +0200

Avoid IOOB
---
 java/org/apache/catalina/valves/rewrite/ResolverImpl.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index dfa0ebd..7b30227 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -306,7 +306,9 @@ public class ResolverImpl extends Resolver {
 elements.add(String.valueOf(alternateName.get(1)));
 }
 }
-return elements.get(n);
+if (elements.size() > n) {
+return elements.get(n);
+}
 }
 } catch (NumberFormatException | ArrayIndexOutOfBoundsException
 | CertificateParsingException e) {


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



[tomcat] branch 8.5.x updated: Implement more of the TLS env in rewrite resolver

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 105eb94  Implement more of the TLS env in rewrite resolver
105eb94 is described below

commit 105eb948dcd88cfe1cad89694fa077f603d57a9d
Author: remm 
AuthorDate: Thu Jun 4 23:13:36 2020 +0200

Implement more of the TLS env in rewrite resolver
---
 .../catalina/valves/rewrite/ResolverImpl.java  | 75 ++
 .../catalina/valves/rewrite/TestResolverSSL.java   | 20 +++---
 2 files changed, 73 insertions(+), 22 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index 1211d4b..cf4d154 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -19,9 +19,15 @@ package org.apache.catalina.valves.rewrite;
 import java.io.IOException;
 import java.nio.charset.Charset;
 import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateParsingException;
 import java.security.cert.X509Certificate;
+import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Set;
+import java.util.StringTokenizer;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.catalina.WebResource;
@@ -145,18 +151,22 @@ public class ResolverImpl extends Resolver {
 public String resolveSsl(String key) {
 SSLSupport sslSupport = (SSLSupport) 
request.getAttribute(SSLSupport.SESSION_MGR);
 try {
-// FIXME SSL_SESSION_RESUMED in SSLHostConfig
-// FIXME SSL_SECURE_RENEG in SSLHostConfig
-// FIXME SSL_COMPRESS_METHOD in SSLHostConfig
-// FIXME SSL_TLS_SNI from handshake
-// FIXME SSL_SRP_USER
-// FIXME SSL_SRP_USERINFO
+// SSL_SRP_USER: no planned support for SRP
+// SSL_SRP_USERINFO: no planned support for SRP
 if (key.equals("HTTPS")) {
 return String.valueOf(sslSupport != null);
 } else if (key.equals("SSL_PROTOCOL")) {
 return sslSupport.getProtocol();
 } else if (key.equals("SSL_SESSION_ID")) {
 return sslSupport.getSessionId();
+} else if (key.equals("SSL_SESSION_RESUMED")) {
+// FIXME session resumption state, not available anywhere
+} else if (key.equals("SSL_SECURE_RENEG")) {
+// FIXME available from SSLHostConfig
+} else if (key.equals("SSL_COMPRESS_METHOD")) {
+// FIXME available from SSLHostConfig
+} else if (key.equals("SSL_TLS_SNI")) {
+// FIXME from handshake SNI processing
 } else if (key.equals("SSL_CIPHER")) {
 return sslSupport.getCipherSuite();
 } else if (key.equals("SSL_CIPHER_EXPORT")) {
@@ -188,12 +198,13 @@ public class ResolverImpl extends Resolver {
 if (result != null) {
 return result;
 } else if (key.startsWith("SAN_OTHER_msUPN_")) {
+// Type otherName, which is 0
 key = key.substring("SAN_OTHER_msUPN_".length());
-// FIXME return 
certificates[0].getSubjectAlternativeNames()
+// FIXME OID from resolveAlternateName
 } else if (key.equals("CERT_RFC4523_CEA")) {
-// FIXME return certificates[0]
+// FIXME return certificate[0] format 
CertificateExactAssertion in RFC4523
 } else if (key.equals("VERIFY")) {
-// FIXME return verification state
+// FIXME return verification state, not available 
anywhere
 }
 }
 } else if (key.startsWith("SSL_SERVER_")) {
@@ -214,18 +225,20 @@ public class ResolverImpl extends Resolver {
 return certificates[0].getSubjectDN().getName();
 } else if (key.startsWith("S_DN_")) {
 key = key.substring("S_DN_".length());
-// FIXME would need access to X500Name from X500Principal
+return 
resolveComponent(certificates[0].getSubjectX500Principal().getName(), key);
 } else if (key.startsWith("SAN_Email_")) {
+// Type rfc822Name, which is 1
 key = key.substring("SAN_Email_".length());
-// FIXME return certificates[0].getSubjectAlternativeNames()
+return resolveAlternateNam

[tomcat] branch 9.0.x updated: Implement more of the TLS env in rewrite resolver

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 55443d3  Implement more of the TLS env in rewrite resolver
55443d3 is described below

commit 55443d317da37d6c6bc1ee1f81078e1d9dea91c7
Author: remm 
AuthorDate: Thu Jun 4 23:13:36 2020 +0200

Implement more of the TLS env in rewrite resolver
---
 .../catalina/valves/rewrite/ResolverImpl.java  | 78 +-
 .../catalina/valves/rewrite/TestResolverSSL.java   | 20 +++---
 2 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index 51566f0..dfa0ebd 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -19,9 +19,15 @@ package org.apache.catalina.valves.rewrite;
 import java.io.IOException;
 import java.nio.charset.Charset;
 import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateParsingException;
 import java.security.cert.X509Certificate;
+import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Set;
+import java.util.StringTokenizer;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.catalina.WebResource;
@@ -145,18 +151,22 @@ public class ResolverImpl extends Resolver {
 public String resolveSsl(String key) {
 SSLSupport sslSupport = (SSLSupport) 
request.getAttribute(SSLSupport.SESSION_MGR);
 try {
-// FIXME SSL_SESSION_RESUMED in SSLHostConfig
-// FIXME SSL_SECURE_RENEG in SSLHostConfig
-// FIXME SSL_COMPRESS_METHOD in SSLHostConfig
-// FIXME SSL_TLS_SNI from handshake
-// FIXME SSL_SRP_USER
-// FIXME SSL_SRP_USERINFO
+// SSL_SRP_USER: no planned support for SRP
+// SSL_SRP_USERINFO: no planned support for SRP
 if (key.equals("HTTPS")) {
 return String.valueOf(sslSupport != null);
 } else if (key.equals("SSL_PROTOCOL")) {
 return sslSupport.getProtocol();
 } else if (key.equals("SSL_SESSION_ID")) {
 return sslSupport.getSessionId();
+} else if (key.equals("SSL_SESSION_RESUMED")) {
+// FIXME session resumption state, not available anywhere
+} else if (key.equals("SSL_SECURE_RENEG")) {
+// FIXME available from SSLHostConfig
+} else if (key.equals("SSL_COMPRESS_METHOD")) {
+// FIXME available from SSLHostConfig
+} else if (key.equals("SSL_TLS_SNI")) {
+// FIXME from handshake SNI processing
 } else if (key.equals("SSL_CIPHER")) {
 return sslSupport.getCipherSuite();
 } else if (key.equals("SSL_CIPHER_EXPORT")) {
@@ -188,12 +198,13 @@ public class ResolverImpl extends Resolver {
 if (result != null) {
 return result;
 } else if (key.startsWith("SAN_OTHER_msUPN_")) {
+// Type otherName, which is 0
 key = key.substring("SAN_OTHER_msUPN_".length());
-// FIXME return 
certificates[0].getSubjectAlternativeNames()
+// FIXME OID from resolveAlternateName
 } else if (key.equals("CERT_RFC4523_CEA")) {
-// FIXME return certificates[0]
+// FIXME return certificate[0] format 
CertificateExactAssertion in RFC4523
 } else if (key.equals("VERIFY")) {
-// FIXME return verification state
+// FIXME return verification state, not available 
anywhere
 }
 }
 } else if (key.startsWith("SSL_SERVER_")) {
@@ -204,8 +215,9 @@ public class ResolverImpl extends Resolver {
 if (result != null) {
 return result;
 } else if (key.startsWith("SAN_OTHER_dnsSRV_")) {
+// Type otherName, which is 0
 key = key.substring("SAN_OTHER_dnsSRV_".length());
-// FIXME return 
certificates[0].getSubjectAlternativeNames()
+// FIXME OID from resolveAlternateName
 }
 }
 }
@@ -224,18 +236,20 @@ public class ResolverImpl extends Resolver {
 return certificates[0].getSubjectDN().getNam

[tomcat] branch master updated: Implement more of the TLS env in rewrite resolver

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 43aa504  Implement more of the TLS env in rewrite resolver
43aa504 is described below

commit 43aa504fb292618d63767839dda9f57f19d3b3a7
Author: remm 
AuthorDate: Thu Jun 4 23:13:36 2020 +0200

Implement more of the TLS env in rewrite resolver
---
 .../catalina/valves/rewrite/ResolverImpl.java  | 78 +-
 .../catalina/valves/rewrite/TestResolverSSL.java   | 20 +++---
 2 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java 
b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
index 51566f0..dfa0ebd 100644
--- a/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
+++ b/java/org/apache/catalina/valves/rewrite/ResolverImpl.java
@@ -19,9 +19,15 @@ package org.apache.catalina.valves.rewrite;
 import java.io.IOException;
 import java.nio.charset.Charset;
 import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateParsingException;
 import java.security.cert.X509Certificate;
+import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Set;
+import java.util.StringTokenizer;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.catalina.WebResource;
@@ -145,18 +151,22 @@ public class ResolverImpl extends Resolver {
 public String resolveSsl(String key) {
 SSLSupport sslSupport = (SSLSupport) 
request.getAttribute(SSLSupport.SESSION_MGR);
 try {
-// FIXME SSL_SESSION_RESUMED in SSLHostConfig
-// FIXME SSL_SECURE_RENEG in SSLHostConfig
-// FIXME SSL_COMPRESS_METHOD in SSLHostConfig
-// FIXME SSL_TLS_SNI from handshake
-// FIXME SSL_SRP_USER
-// FIXME SSL_SRP_USERINFO
+// SSL_SRP_USER: no planned support for SRP
+// SSL_SRP_USERINFO: no planned support for SRP
 if (key.equals("HTTPS")) {
 return String.valueOf(sslSupport != null);
 } else if (key.equals("SSL_PROTOCOL")) {
 return sslSupport.getProtocol();
 } else if (key.equals("SSL_SESSION_ID")) {
 return sslSupport.getSessionId();
+} else if (key.equals("SSL_SESSION_RESUMED")) {
+// FIXME session resumption state, not available anywhere
+} else if (key.equals("SSL_SECURE_RENEG")) {
+// FIXME available from SSLHostConfig
+} else if (key.equals("SSL_COMPRESS_METHOD")) {
+// FIXME available from SSLHostConfig
+} else if (key.equals("SSL_TLS_SNI")) {
+// FIXME from handshake SNI processing
 } else if (key.equals("SSL_CIPHER")) {
 return sslSupport.getCipherSuite();
 } else if (key.equals("SSL_CIPHER_EXPORT")) {
@@ -188,12 +198,13 @@ public class ResolverImpl extends Resolver {
 if (result != null) {
 return result;
 } else if (key.startsWith("SAN_OTHER_msUPN_")) {
+// Type otherName, which is 0
 key = key.substring("SAN_OTHER_msUPN_".length());
-// FIXME return 
certificates[0].getSubjectAlternativeNames()
+// FIXME OID from resolveAlternateName
 } else if (key.equals("CERT_RFC4523_CEA")) {
-// FIXME return certificates[0]
+// FIXME return certificate[0] format 
CertificateExactAssertion in RFC4523
 } else if (key.equals("VERIFY")) {
-// FIXME return verification state
+// FIXME return verification state, not available 
anywhere
 }
 }
 } else if (key.startsWith("SSL_SERVER_")) {
@@ -204,8 +215,9 @@ public class ResolverImpl extends Resolver {
 if (result != null) {
 return result;
 } else if (key.startsWith("SAN_OTHER_dnsSRV_")) {
+// Type otherName, which is 0
 key = key.substring("SAN_OTHER_dnsSRV_".length());
-// FIXME return 
certificates[0].getSubjectAlternativeNames()
+// FIXME OID from resolveAlternateName
 }
 }
 }
@@ -224,18 +236,20 @@ public class ResolverImpl extends Resolver {
 return certificates[0].getSubjectDN().getNam

[tomcat] branch 8.5.x updated: Fix Tomcat 8.5 issue

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 8ca1377  Fix Tomcat 8.5 issue
8ca1377 is described below

commit 8ca1377197245e1352e4d011cdd0404ba5672551
Author: remm 
AuthorDate: Thu Jun 4 17:05:22 2020 +0200

Fix Tomcat 8.5 issue
---
 test/org/apache/tomcat/util/net/TesterSupport.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/tomcat/util/net/TesterSupport.java 
b/test/org/apache/tomcat/util/net/TesterSupport.java
index e144406..bc7aca9 100644
--- a/test/org/apache/tomcat/util/net/TesterSupport.java
+++ b/test/org/apache/tomcat/util/net/TesterSupport.java
@@ -222,7 +222,7 @@ public final class TesterSupport {
 return 
System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("mac os 
x");
 }
 
-protected static boolean isRenegotiationSupported(Tomcat tomcat) {
+public static boolean isRenegotiationSupported(Tomcat tomcat) {
 String protocol = tomcat.getConnector().getProtocolHandlerClassName();
 if (protocol.contains("Apr")) {
 // Disabled by default in 1.1.20 windows binary (2010-07-27)


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



[tomcat] branch 9.0.x updated: Fix Tomcat 8.5 issue

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 34341e4  Fix Tomcat 8.5 issue
34341e4 is described below

commit 34341e447e872add752c2aa0605ddef4e622b839
Author: remm 
AuthorDate: Thu Jun 4 17:05:22 2020 +0200

Fix Tomcat 8.5 issue
---
 test/org/apache/tomcat/util/net/TesterSupport.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/tomcat/util/net/TesterSupport.java 
b/test/org/apache/tomcat/util/net/TesterSupport.java
index 89caf47..5cda3aa 100644
--- a/test/org/apache/tomcat/util/net/TesterSupport.java
+++ b/test/org/apache/tomcat/util/net/TesterSupport.java
@@ -220,7 +220,7 @@ public final class TesterSupport {
 return ks;
 }
 
-protected static boolean isRenegotiationSupported(Tomcat tomcat) {
+public static boolean isRenegotiationSupported(Tomcat tomcat) {
 String protocol = tomcat.getConnector().getProtocolHandlerClassName();
 if (protocol.contains("Apr")) {
 // Disabled by default in 1.1.20 windows binary (2010-07-27)


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



[tomcat] branch master updated (8d20346 -> 5a5f07f)

2020-06-04 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 8d20346  Add a comment about SRP
 add 5a5f07f  Fix Tomcat 8.5 issue

No new revisions were added by this update.

Summary of changes:
 test/org/apache/tomcat/util/net/TesterSupport.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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



  1   2   3   4   5   6   7   8   9   10   >