Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358934

Summary: Improve jetty-jsp-2.1 for embedded use
Product: [RT] Jetty Reporter: Eirik Bjørsnøs <eirbjo>
Component: serverAssignee: Jan Bartel <janb>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: janb, jetty-inbox
Version: 7.5.1   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Eirik Bjørsnøs CLA 2011-09-26 13:17:19 EDT
Build Identifier: 

org.eclipse.jetty:jetty-jsp-2.1:7.5.2-SNAPSHOT doesn't really work very smooth
for embedded use.

Issue #1:
org.glassfish.web:jsp-impl is in provided scope, hence I need to add it to my
<dependencies> in my consuming project.

Issue #2:
Additionally, org.glassfish.web:jsp-impl pulls in a version of the JSP API jar
that doesn't include the DTDs for TLDs, hence parsing of taglibs fails.

So I need to specify javax.servlet.jsp:jsp-api:2.1 as well to override
jsp-impl's version.

So my complete Jetty dependency list for use with JSP in a unit test ends up
being:

        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>7.5.2-SNAPSHOT</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp-2.1</artifactId>
            <version>7.5.2-SNAPSHOT</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>jsp-impl</artifactId>
            <version>2.1.3-b10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>test</scope>
        </dependency>

which is rather long and needs to be checked/updated between Jetty versions.
The last two of these could be fixed by making jsp-impl non-provided and by
explicitly choosing the 2.1 version of the JSP API. (Which is what
jetty-distribution ends up using anyhow..)

As a side effect, this would make jsp-impl a transitive dependency inside Jetty
as well, so adding it to the aggregate modules would no longer be needed.

Reproducible: Always
Comment 1 Eirik Bjørsnøs CLA 2011-09-26 13:31:20 EDT
While we're at it:

Might be useful to add one or both of the 1.5 compilers as optional dependencies in jetty-jsp-2.1's pom with comments to add them for JSP to work on Java 5.

Alternatively, we could consider adding org.eclipse.jdt.core.compiler:ecj:3.7 as a dependency. People can always exclude it. And this would make jetty-jsp-2.1 more aligned with jetty-distribution. But people also forget to exclude, so this would make Jetty a lot fatter than needed on Java 6 for many embedded use cases.

Jan, WDYT?

See also:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=358784
Comment 2 Jan Bartel CLA 2011-09-27 00:15:19 EDT
(In reply to comment #1)

If we go ahead and make an aggregate for the jsp stuff, or alternatively make the deps for jetty-jsp-2.1 compile rather than provided, then  I think we'd go the whole hog and put in the ecj compiler and the jstl jars as well so it would be just like the jetty distro.

Having said all of that, we recommend that people move off jdk1.5 to jdk 1.7 because its now a) so old  and b) with ssl having being hacked its important to upgrade to 1.7 to get the new TLS libs.

Jan


> While we're at it:
> 
> Might be useful to add one or both of the 1.5 compilers as optional
> dependencies in jetty-jsp-2.1's pom with comments to add them for JSP to work
> on Java 5.
> 
> Alternatively, we could consider adding org.eclipse.jdt.core.compiler:ecj:3.7
> as a dependency. People can always exclude it. And this would make
> jetty-jsp-2.1 more aligned with jetty-distribution. But people also forget to
> exclude, so this would make Jetty a lot fatter than needed on Java 6 for many
> embedded use cases.
> 
> Jan, WDYT?
> 
> See also:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=358784
Comment 3 Jan Bartel CLA 2012-02-03 00:00:40 EST
Eirik,

In jetty-7.6.1 we have a new module called jetty-jsp, which encapsulates all of the dependencies needed to run jsp. You should just be able to include it into your pom to run jsp embedded - although be sure to read the page http://wiki.eclipse.org/Jetty/Howto/Configure_JSP, particularly the section about JSTL if you're planning on using it.

Jan
Comment 4 Eirik Bjørsnøs CLA 2012-02-05 17:07:28 EST
Thanks Jan,  this was exactly what I was looking for! Now I don't need to maintain my own for JettyConsole's JSP plugin and a couple of other use cases anymore:

http://simplericity.org/svn/simplericity/trunk/jetty-console/jetty-console-plugins/jetty-console-jsp-plugin/pom.xml


(Note that for JettyConsole, where all libraries are actually unpacked inside the META-INF/jettyconsole/lib inside the WAR, I had to do the TLD scanning myself. Nasty, but it works :-)

http://simplericity.org/svn/simplericity/trunk/jetty-console/jetty-console-plugins/jetty-console-jsp-plugin/src/main/java/org/simplericity/jettyconsole/jsp/JasperInUnpackedWarUglyHackConfiguration.java
Comment 5 Eirik Bjørsnøs CLA 2012-02-05 17:13:00 EST
Jan,

Shouldn't "src/main/resource" be in plural form "src/main/resources" at

http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-jsp/src/main/resource

?

Eirik.

(In reply to comment #3)
> Eirik,
> 
> In jetty-7.6.1 we have a new module called jetty-jsp, which encapsulates all of
> the dependencies needed to run jsp. You should just be able to include it into
> your pom to run jsp embedded - although be sure to read the page
> http://wiki.eclipse.org/Jetty/Howto/Configure_JSP, particularly the section
> about JSTL if you're planning on using it.
> 
> Jan
Comment 6 Jan Bartel CLA 2012-02-08 16:19:43 EST
Yup, you're right. Changed it in git.

(In reply to comment #5)
> Jan,
> 
> Shouldn't "src/main/resource" be in plural form "src/main/resources" at
> 
> http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-jsp/src/main/resource
> 
> ?
> 
> Eirik.
> 
> (In reply to comment #3)
> > Eirik,
> > 
> > In jetty-7.6.1 we have a new module called jetty-jsp, which encapsulates all of
> > the dependencies needed to run jsp. You should just be able to include it into
> > your pom to run jsp embedded - although be sure to read the page
> > http://wiki.eclipse.org/Jetty/Howto/Configure_JSP, particularly the section
> > about JSTL if you're planning on using it.
> > 
> > Jan