Skip to content

Commit

Permalink
Issue #5941 Use Glassfish JSTL impl (#5942)
Browse files Browse the repository at this point in the history
* Issue #5941 Use Glassfish JSTL impl

Signed-off-by: Jan Bartel <janb@webtide.com>
  • Loading branch information
janbartel committed Feb 10, 2021
1 parent e4baac7 commit d6d6483
Show file tree
Hide file tree
Showing 29 changed files with 66 additions and 122 deletions.
Expand Up @@ -700,32 +700,9 @@ For the JSTL library, we recommend the use of the implementation from Glassfish,
|Jar |Bundle Symbolic Name
|The link:#osgi-jsp[jsp jars]|

|org.eclipse.jetty.orbit:jakarta.servlet.jsp.jstl-1.2.0.v201105211821.jar| jakarta.servlet.jsp.jstl
|jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api-2.0.0.jar| jakarta.servlet.jsp.jstl-api

|org.glassfish.web:jakarta.servlet.jsp.jstl-1.2.2.jar|org.glassfish.web.jakarta.servlet.jsp.jstl
|=======================================================================

However, if you wish, you may use the JSTL implementation from Apache instead, although you will need to source some dependency jars with suitable OSGi manifests:

.Jars Required for Apache JSTL
[cols=",,",options="header",]
|=======================================================================
|Jar |Bundle Symbolic Name |Location
|The link:#osgi-jsp[jsp jars] | |

|org.apache.taglibs:taglibs-standard-spec:jar:1.2.1
|org.apache.taglibs.taglibs-standard-spec |Distribution lib/apache-jstl

|org.apache.taglibs:taglibs-standard-spec:jar:1.2.1
|org.apache.taglibs.standard-impl |Distribution lib/apache-jstl

|org.apache.xalan 2.7.1 | |Try
http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/plugins/org.apache.xalan_2.7.1.v201005080400.jar[Eclipse
Orbit]

|org.apache.xml.serializer 2.7.1 | |Try
http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/plugins/org.apache.xml.serializer_2.7.1.v201005080400.jar[Eclipse
Orbit]
|org.glassfish.web:jakarta.servlet.jsp.jstl-2.0.0.jar|org.glassfish.web.jakarta.servlet.jsp.jstl
|=======================================================================

===== The jetty-osgi-boot-jsp jar
Expand Down
Expand Up @@ -279,9 +279,9 @@ It is also automatically on the classpath for the Jetty Maven plugin, which uses
If you are using Jetty in an embedded scenario, and you need to use JSTL, then you must ensure that the JSTL jars are included on the _container's_ classpath - that is the classpath that is the _parent_ of the webapp's classpath.
This is a restriction that arises from the JavaEE specification.

====== Apache JSP
====== Glassfish JSTL

You will need to put the jars that are present in the `{$jetty.home}/lib/apache-jstl` directory onto the _container's_ classpath.
You will need to put the jars that are present in the `{$jetty.home}/lib/glassfish-jstl` directory onto the _container's_ classpath.
The Apache JSP engine will find the JSTL tag definitions inside these jars during startup.

As an efficiency enhancement, you can have jetty examine the JSTL jars to find the tags, and pre-feed them into the Apache JSP engine.
Expand Down
Expand Up @@ -46,10 +46,10 @@ Modules for tag '*':
LIB: lib/apache-jsp/*.jar
Enabled: transitive provider of apache-jsp for jsp
Module: apache-jstl
: Enables the apache version of JSTL
LIB: lib/apache-jstl/*.jar
Enabled: transitive provider of apache-jstl for jstl
Module: glassfish-jstl
: Enables the Glassfish version of JSTL
LIB: lib/glassfish-jstl/*.jar
Enabled: transitive provider of glassfish-jstl for jstl
Module: cdi2
: Jetty setup to support Weld/CDI2 with WELD inside the webapp
Expand Down Expand Up @@ -145,7 +145,7 @@ Modules for tag '*':
Module: jstl
: Enables JSTL for all webapplications deployed on the server
Depend: jsp, apache-jstl
Depend: jsp, glassfish-jstl
Enabled: ${jetty.base}\start.d\jstl.ini
Module: jvm
Expand Down
13 changes: 6 additions & 7 deletions apache-jstl/pom.xml → glassfish-jstl/pom.xml
Expand Up @@ -5,12 +5,12 @@
<version>11.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apache-jstl</artifactId>
<name>Apache :: JSTL module</name>
<url>http://tomcat.apache.org/taglibs/standard/</url>
<artifactId>glassfish-jstl</artifactId>
<name>Glassfish :: JSTL module</name>
<url>https://projects.eclipse.org/projects/ee4j.glassfish</url>
<packaging>jar</packaging>
<properties>
<bundle-symbolic-name>${project.groupId}.apache.jstl</bundle-symbolic-name>
<bundle-symbolic-name>${project.groupId}.glassfish.jstl</bundle-symbolic-name>
</properties>

<build>
Expand Down Expand Up @@ -49,10 +49,9 @@
</exclusions>
</dependency>


<dependency>
<groupId>org.mortbay.jasper</groupId>
<artifactId>taglibs-standard</artifactId>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
</dependency>

<dependency>
Expand Down
@@ -1,7 +1,7 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html

[description]
Enables the apache version of JSTL for all webapps.
Enables the glassfish version of JSTL for all webapps.

[lib]
lib/apache-jstl/*.jar
lib/glassfish-jstl/*.jar
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion jetty-deploy/src/main/config/etc/jetty-deploy.xml
Expand Up @@ -18,7 +18,7 @@
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jetty-jakarta-servlet-api-[^/]*\.jar$|.*/jakarta.servlet.jsp.jstl-.*\.jar$|.*/.*taglibs-standard-.*\.jar$</Arg>
<Arg>.*/jetty-jakarta-servlet-api-[^/]*\.jar$|.*/.*jakarta.servlet.jsp.jstl-.*\.jar$</Arg>
</Call>

<!-- Add a customize step to the deployment lifecycle -->
Expand Down
20 changes: 9 additions & 11 deletions jetty-home/pom.xml
Expand Up @@ -127,7 +127,7 @@
org.eclipse.jetty.orbit,org.eclipse.jetty.http2,org.eclipse.jetty.websocket,org.eclipse.jetty.fcgi,org.eclipse.jetty.toolchain,org.apache.taglibs
</excludeGroupIds>
<excludeArtifactIds>
apache-jsp,apache-jstl,jetty-start,jetty-slf4j-impl
apache-jsp,glassfish-jstl,jetty-start,jetty-slf4j-impl
</excludeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
Expand All @@ -145,7 +145,7 @@
org.eclipse.jetty.orbit,org.eclipse.jetty.http2,org.eclipse.jetty.websocket,org.eclipse.jetty.fcgi,org.eclipse.jetty.toolchain,org.apache.taglibs
</excludeGroupIds>
<excludeArtifactIds>
apache-jsp,apache-jstl,jetty-start
apache-jsp,glassfish-jstl,jetty-start
</excludeArtifactIds>
<includeTypes>jar</includeTypes>
<classifier>sources</classifier>
Expand Down Expand Up @@ -376,32 +376,30 @@
</configuration>
</execution>
<execution>
<id>copy-apache-jstl-deps</id>
<id>copy-glassfish-jstl-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeGroupIds>org.glassfish.web</excludeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,taglibs-standard</includeArtifactIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl</includeArtifactIds>
<prependGroupId>true</prependGroupId>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/apache-jstl</outputDirectory>
<outputDirectory>${assembly-directory}/lib/glassfish-jstl</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-apache-jstl-src-deps</id>
<id>copy-glassfish-jstl-src-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeGroupIds>org.glassfish.web</excludeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,taglibs-standard</includeArtifactIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl</includeArtifactIds>
<prependGroupId>true</prependGroupId>
<includeTypes>jar</includeTypes>
<classifier>sources</classifier>
<outputDirectory>${source-assembly-directory}/lib/apache-jstl</outputDirectory>
<outputDirectory>${source-assembly-directory}/lib/glassfish-jstl</outputDirectory>
</configuration>
</execution>
<execution>
Expand Down Expand Up @@ -630,7 +628,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jstl</artifactId>
<artifactId>glassfish-jstl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion jetty-home/src/main/resources/modules/jstl.mod
Expand Up @@ -5,5 +5,5 @@ Enables JSTL for all web applications deployed on the server.

[depend]
jsp
apache-jstl
glassfish-jstl

46 changes: 23 additions & 23 deletions jetty-osgi/jetty-osgi-boot-jsp/pom.xml
Expand Up @@ -107,29 +107,29 @@
org.apache.jasper.tagplugins.jstl;version="[$(version;==;${jspImpl.osgiVersion}),$(version;+;${jspImpl.osgiVersion}))";resolution:=optional,
org.apache.jasper.util;version="[$(version;===;${jspImpl.osgiVersion}),$(version;+;${jspImpl.osgiVersion}))";resolution:=optional,
org.apache.jasper.xmlparser;version="[$(version;==;${jspImpl.osgiVersion}),$(version;+;${jspImpl.osgiVersion}))";resolution:=optional,
org.apache.taglibs.standard;version="1.2";resolution:=optional,
org.apache.taglibs.standard.extra.spath;version="1.2";resolution:=optional,
org.apache.taglibs.standard.functions;version="1.2";resolution:=optional,
org.apache.taglibs.standard.lang.jstl;version="1.2";resolution:=optional,
org.apache.taglibs.standard.lang.jstl.parser;version="1.2";resolution:=optional,
org.apache.taglibs.standard.lang.jstl.test;version="1.2";resolution:=optional,
org.apache.taglibs.standard.lang.jstl.test.beans;version="1.2";resolution:=optional,
org.apache.taglibs.standard.lang.support;version="1.2";resolution:=optional,
org.apache.taglibs.standard.resources;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.common.core;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.common.fmt;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.common.sql;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.common.xml;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.el.core;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.el.fmt;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.el.sql;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.el.xml;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.rt.core;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.rt.fmt;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.rt.sql;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tag.rt.xml;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tei;version="1.2";resolution:=optional,
org.apache.taglibs.standard.tlv;version="1.2";resolution:=optional,
org.apache.taglibs.standard;version="2.0";resolution:=optional,
org.apache.taglibs.standard.extra.spath;version="2.0";resolution:=optional,
org.apache.taglibs.standard.functions;version="2.0";resolution:=optional,
org.apache.taglibs.standard.lang.jstl;version="2.0";resolution:=optional,
org.apache.taglibs.standard.lang.jstl.parser;version="2.0";resolution:=optional,
org.apache.taglibs.standard.lang.jstl.test;version="2.0";resolution:=optional,
org.apache.taglibs.standard.lang.jstl.test.beans;version="2.0";resolution:=optional,
org.apache.taglibs.standard.lang.support;version="2.0";resolution:=optional,
org.apache.taglibs.standard.resources;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.common.core;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.common.fmt;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.common.sql;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.common.xml;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.el.core;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.el.fmt;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.el.sql;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.el.xml;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.rt.core;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.rt.fmt;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.rt.sql;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tag.rt.xml;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tei;version="2.0";resolution:=optional,
org.apache.taglibs.standard.tlv;version="2.0";resolution:=optional,
org.apache.tomcat;version="[10,11)";resolution:=optional,
org.eclipse.jetty.jsp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:=optional,
org.slf4j.*,
Expand Down
30 changes: 2 additions & 28 deletions jetty-osgi/test-jetty-osgi/pom.xml
Expand Up @@ -238,35 +238,9 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.mortbay.jasper</groupId>
<artifactId>taglibs-standard</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xalan</artifactId>
<version>2.7.2_3</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xalan-serializer</artifactId>
<version>2.7.2_1</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.bcel</artifactId>
<version>5.2_4</version>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xmlresolver</artifactId>
<version>1.2_5</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xerces</artifactId>
<version>2.12.0_1</version>
</dependency>

<!-- Jetty Deps -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
Expand Down
Expand Up @@ -211,12 +211,7 @@ public static List<Option> jspDependencies()
res.add(mavenBundle().groupId("org.mortbay.jasper").artifactId("apache-jsp").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("apache-jsp").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.servlet.jsp.jstl").artifactId("jakarta.servlet.jsp.jstl-api").versionAsInProject());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.xmlresolver").version("1.2_5").start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.xerces").version("2.12.0_1").start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.xalan-serializer").version("2.7.2_1").start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.bcel").version("5.2_4").start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.xalan").version("2.7.2_3").start());
res.add(mavenBundle().groupId("org.mortbay.jasper").artifactId("taglibs-standard").versionAsInProject().start());
res.add(mavenBundle().groupId("org.glassfish.web").artifactId("jakarta.servlet.jsp.jstl").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jdt").artifactId("ecj").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jetty.osgi").artifactId("jetty-osgi-boot-jsp").versionAsInProject().noStart());
return res;
Expand Down
2 changes: 1 addition & 1 deletion jetty-runner/pom.xml
Expand Up @@ -137,7 +137,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jstl</artifactId>
<artifactId>glassfish-jstl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
11 changes: 6 additions & 5 deletions pom.xml
Expand Up @@ -26,7 +26,8 @@
<servlet.api.version>5.0.2</servlet.api.version>
<!-- change version in jetty-websocket/websocket-jakarta-server/src/main/config/modules/websocket-jakarta.mod -->
<websocket.api.version>2.0.0</websocket.api.version>
<jsp.version>10.0.0-M10</jsp.version>
<jsp.version>10.0.0-SNAPSHOT</jsp.version>
<jstl.version>2.0.0</jstl.version>
<jsp.api.version>3.0</jsp.api.version>
<annotation-api.version>2.0.0</annotation-api.version>
<transaction-api.version>2.0.0</transaction-api.version>
Expand Down Expand Up @@ -120,7 +121,7 @@
<module>jetty-servlets</module>
<module>jetty-util-ajax</module>
<module>apache-jsp</module>
<module>apache-jstl</module>
<module>glassfish-jstl</module>
<module>jetty-maven-plugin</module>
<module>jetty-jspc-maven-plugin</module>
<module>jetty-deploy</module>
Expand Down Expand Up @@ -1066,9 +1067,9 @@
<version>${jsp.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jasper</groupId>
<artifactId>taglibs-standard</artifactId>
<version>${jsp.version}</version>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jasper</groupId>
Expand Down
Expand Up @@ -142,7 +142,7 @@ public void testQuickStartGenerationAndRun() throws Exception
}

@Test
public void testSimpleWebAppWithJSP() throws Exception
public void testSimpleWebAppWithJSPandJSTL() throws Exception
{
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
Expand All @@ -155,7 +155,7 @@ public void testSimpleWebAppWithJSP() throws Exception
String[] args1 = {
"--create-start-ini",
"--approve-all-licenses",
"--add-modules=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets"
"--add-modules=resources,server,http,webapp,deploy,jsp,jstl,jmx,servlet,servlets"
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
Expand All @@ -174,9 +174,9 @@ public void testSimpleWebAppWithJSP() throws Exception
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));

startHttpClient();
ContentResponse response = client.GET("http://localhost:" + port + "/test/index.jsp");
ContentResponse response = client.GET("http://localhost:" + port + "/test/jstl.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("JSP Examples"));
assertThat(response.getContentAsString(), containsString("JSTL Example"));
assertThat(response.getContentAsString(), not(containsString("<%")));
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test-quickstart/pom.xml
Expand Up @@ -103,7 +103,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jstl</artifactId>
<artifactId>glassfish-jstl</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
Expand Down

0 comments on commit d6d6483

Please sign in to comment.