430341 - add apache jsp and jstl optional modules

This commit is contained in:
Greg Wilkins 2014-03-14 16:54:03 +11:00
parent b3be247423
commit acbe13a210
11 changed files with 543 additions and 8 deletions

95
apache-jsp/pom.xml Normal file
View File

@ -0,0 +1,95 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>9.1.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apache-jsp</artifactId>
<name>Jetty :: Apache JSP</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>jar</packaging>
<properties>
<bundle-symbolic-name>${project.groupId}.${project.artifactId}</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>generate-manifest</id>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<instructions>
<Export-Package>org.eclipse.jetty.apache.jsp.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"</Export-Package>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"</Require-Capability>
<Provide-Capability>osgi.serviceloader; osgi.serviceloader=javax.servlet.ServletContainerInitializer</Provide-Capability>
<_nouses>true</_nouses>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>config</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Schemas -->
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-schemas</artifactId>
</dependency>
<!-- servlet api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<!-- JSP Api -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
</dependency>
<!-- JSP Impl -->
<dependency>
<groupId>org.mortbay.jasper</groupId>
<artifactId>apache-jsp</artifactId>
</dependency>
<!-- Eclipse Java Compiler (for JSP Compilation) -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,14 @@
#
# Apache JSP Module
#
[depend]
servlet
[lib]
lib/apache-jsp/*.jar
[ini-template]
# JSP Configuration
# To use an non-jdk compiler for JSP compilation uncomment next line
# -Dorg.apache.jasper.compiler.disablejsr199=true

View File

@ -0,0 +1,114 @@
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.apache.jsp;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.apache.jasper.servlet.JasperInitializer;
import org.apache.jasper.servlet.TldPreScanned;
import org.apache.jasper.servlet.TldScanner;
import org.xml.sax.SAXException;
/**
* JettyJasperInitializer
*
*/
public class JettyJasperInitializer extends JasperInitializer
{
/**
* NullTldScanner
*
* Does nothing. Used when we can tell that all jsps have been precompiled, in which case
* the tlds are not needed.
*/
private final class NullTldScanner extends TldScanner
{
/**
* @param context
* @param namespaceAware
* @param validation
* @param blockExternal
*/
private NullTldScanner(ServletContext context, boolean namespaceAware, boolean validation, boolean blockExternal)
{
super(context, namespaceAware, validation, blockExternal);
}
/**
* @see org.apache.jasper.servlet.TldScanner#scan()
*/
@Override
public void scan() throws IOException, SAXException
{
return; //do nothing
}
/**
* @see org.apache.jasper.servlet.TldScanner#getListeners()
*/
@Override
public List<String> getListeners()
{
return Collections.emptyList();
}
/**
* @see org.apache.jasper.servlet.TldScanner#scanJars()
*/
@Override
public void scanJars()
{
return; //do nothing
}
}
/**
* Make a TldScanner, and prefeed it the tlds that have already been discovered in jar files
* by the MetaInfConfiguration.
*
* @see org.apache.jasper.servlet.JasperInitializer#prepareScanner(javax.servlet.ServletContext, boolean, boolean, boolean)
*/
@Override
public TldScanner newTldScanner(ServletContext context, boolean namespaceAware, boolean validate, boolean blockExternal)
{
String tmp = context.getInitParameter("org.eclipse.jetty.jsp.precompiled");
if (tmp!=null && !tmp.equals("") && Boolean.valueOf(tmp))
{
return new NullTldScanner(context, namespaceAware, validate, blockExternal);
}
Collection<URL> tldUrls = (Collection<URL>)context.getAttribute("org.eclipse.jetty.tlds");
if (tldUrls != null && !tldUrls.isEmpty())
{
return new TldPreScanned(context,namespaceAware,validate,blockExternal,tldUrls);
}
return super.newTldScanner(context, namespaceAware, validate, blockExternal);
}
}

View File

@ -0,0 +1,188 @@
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.apache.jsp;
public class JuliLog implements org.apache.juli.logging.Log
{
public static org.apache.juli.logging.Log getInstance(String name)
{
return new JuliLog(name);
}
private final org.eclipse.jetty.util.log.Logger _logger;
private final org.eclipse.jetty.util.log.StdErrLog _stdErrLog;
public JuliLog()
{
_logger=org.eclipse.jetty.util.log.Log.getRootLogger();
_stdErrLog=(_logger instanceof org.eclipse.jetty.util.log.StdErrLog) ? (org.eclipse.jetty.util.log.StdErrLog)_logger:null;
}
public JuliLog(String name)
{
_logger=org.eclipse.jetty.util.log.Log.getLogger(name);
_stdErrLog=(_logger instanceof org.eclipse.jetty.util.log.StdErrLog) ? (org.eclipse.jetty.util.log.StdErrLog)_logger:null;
}
@Override
public boolean isDebugEnabled()
{
return _logger.isDebugEnabled();
}
@Override
public boolean isErrorEnabled()
{
return _stdErrLog==null?true:_stdErrLog.getLevel()<=org.eclipse.jetty.util.log.StdErrLog.LEVEL_WARN;
}
@Override
public boolean isFatalEnabled()
{
return _stdErrLog==null?true:_stdErrLog.getLevel()<=org.eclipse.jetty.util.log.StdErrLog.LEVEL_WARN;
}
@Override
public boolean isInfoEnabled()
{
return _stdErrLog==null?true:_stdErrLog.getLevel()<=org.eclipse.jetty.util.log.StdErrLog.LEVEL_INFO;
}
@Override
public boolean isTraceEnabled()
{
return _stdErrLog==null?true:_stdErrLog.getLevel()<=org.eclipse.jetty.util.log.StdErrLog.LEVEL_DEBUG;
}
@Override
public boolean isWarnEnabled()
{
return _stdErrLog==null?true:_stdErrLog.getLevel()<=org.eclipse.jetty.util.log.StdErrLog.LEVEL_WARN;
}
@Override
public void trace(Object message)
{
if (message instanceof String)
_logger.debug((String)message);
else
_logger.debug("{}",message);
}
@Override
public void trace(Object message, Throwable t)
{
if (message instanceof String)
_logger.debug((String)message,t);
else
_logger.debug("{}",message,t);
}
@Override
public void debug(Object message)
{
if (message instanceof String)
_logger.debug((String)message);
else
_logger.debug("{}",message);
}
@Override
public void debug(Object message, Throwable t)
{
if (message instanceof String)
_logger.debug((String)message,t);
else
_logger.debug("{}",message,t);
}
@Override
public void info(Object message)
{
if (message instanceof String)
_logger.info((String)message);
else
_logger.info("{}",message);
}
@Override
public void info(Object message, Throwable t)
{
if (message instanceof String)
_logger.info((String)message,t);
else
_logger.info("{}",message,t);
}
@Override
public void warn(Object message)
{
if (message instanceof String)
_logger.warn((String)message);
else
_logger.warn("{}",message);
}
@Override
public void warn(Object message, Throwable t)
{
if (message instanceof String)
_logger.warn((String)message,t);
else
_logger.warn("{}",message,t);
}
@Override
public void error(Object message)
{
if (message instanceof String)
_logger.warn((String)message);
else
_logger.warn("{}",message);
}
@Override
public void error(Object message, Throwable t)
{
if (message instanceof String)
_logger.warn((String)message,t);
else
_logger.warn("{}",message,t);
}
@Override
public void fatal(Object message)
{
if (message instanceof String)
_logger.warn((String)message);
else
_logger.warn("{}",message);
}
@Override
public void fatal(Object message, Throwable t)
{
if (message instanceof String)
_logger.warn((String)message,t);
else
_logger.warn("{}",message,t);
}
}

View File

@ -0,0 +1 @@
org.eclipse.jetty.apache.jsp.JettyJasperInitializer

View File

@ -0,0 +1 @@
org.eclipse.jetty.apache.jsp.JuliLog

49
apache-jstl/pom.xml Normal file
View File

@ -0,0 +1,49 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>9.1.4-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>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>config</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- JSTL Api -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
</dependency>
<!-- JSTL Impl -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,11 @@
#
# Apache JSTL
#
[lib]
lib/apache-jstl/*.jar
[ini-template]
# This module adds the Apache JSTL implementation to the server classpath
# This module is not needed if the glassfish JSP impl (module == jsp) is used, as it includes the glassfish version of jstl
# This module is needed if JSTL will be used by the apache JSP impl (module == apache-jsp) and there is no JSTL impl in the WEB-INF/lib of the webapp

View File

@ -0,0 +1,4 @@
This empty jar file is purely to work around a problem with the Maven Dependency plugin.
Several modules in jetty use the Dependency plugin to copy or unpack the dependencies of other modules.
However, the Dependency plugin is not capable of unpacking or copying a dependency of type 'pom', which
this module is, as it consists purely of external dependencies needed to run jsp.

View File

@ -301,8 +301,8 @@
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
<excludeGroupIds>org.eclipse.jetty.orbit,org.eclipse.jetty.spdy,org.eclipse.jetty.websocket,org.eclipse.jetty.toolchain</excludeGroupIds>
<excludeArtifactIds>jetty-all,jetty-jsp,jetty-start,jetty-monitor</excludeArtifactIds>
<excludeGroupIds>org.eclipse.jetty.orbit,org.eclipse.jetty.spdy,org.eclipse.jetty.websocket,org.eclipse.jetty.toolchain,org.apache.taglibs</excludeGroupIds>
<excludeArtifactIds>jetty-all,jetty-jsp,apache-jsp,jetty-start,jetty-monitor</excludeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
</configuration>
@ -433,7 +433,7 @@
</configuration>
</execution>
<execution>
<id>copy-jsp-deps</id>
<id>copy-glassfish-jsp-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
@ -445,6 +445,20 @@
<outputDirectory>${assembly-directory}/lib/jsp</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-apache-jsp-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty,org.eclipse.jetty.toolchain,javax.servlet.jsp,org.mortbay.jasper,org.mortbay.jasper,org.eclipse.jetty.orbit</includeGroupIds>
<includeArtifactIds>apache-jsp,jetty-schemas,javax.servlet.jsp-api,apache-el,org.eclipse.jdt.core</includeArtifactIds>
<includeTypes>jar</includeTypes>
<prependGroupId>true</prependGroupId>
<outputDirectory>${assembly-directory}/lib/apache-jsp</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-jstl-api</id>
<phase>generate-resources</phase>
@ -472,6 +486,20 @@
<outputDirectory>${assembly-directory}/lib/jsp</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-apache-jstl-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeGroupIds>org.glassfish.web</excludeGroupIds>
<includeArtifactIds>taglibs-standard-spec,taglibs-standard-impl</includeArtifactIds>
<prependGroupId>true</prependGroupId>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/apache-jstl</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-jaspi-deps</id>
<phase>generate-resources</phase>
@ -513,8 +541,8 @@
<arguments>
<argument>jetty.home=${assembly-directory}</argument>
<argument>jetty.base=${assembly-directory}</argument>
<argument>--add-to-start=server,deploy,websocket,jsp,ext,resources</argument>
<argument>--add-to-startd=http</argument>
<argument>--add-to-start=server,deploy,websocket,ext,resources</argument>
<argument>--add-to-startd=jsp,http</argument>
</arguments>
</configuration>
<goals>
@ -529,8 +557,8 @@
<arguments>
<argument>jetty.home=${assembly-directory}</argument>
<argument>jetty.base=${assembly-directory}/demo-base</argument>
<argument>--add-to-start=server,continuation,deploy,jsp,ext,resources,client,annotations,jndi,servlets</argument>
<argument>--add-to-startd-ini=http,https</argument>
<argument>--add-to-start=server,continuation,deploy,ext,resources,client,annotations,jndi,servlets</argument>
<argument>--add-to-startd-ini=jsp,http,https</argument>
</arguments>
</configuration>
<goals>
@ -685,6 +713,16 @@
<artifactId>jetty-jsp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jstl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>

22
pom.xml
View File

@ -418,6 +418,9 @@
<module>jetty-websocket</module>
<module>jetty-servlets</module>
<module>jetty-util-ajax</module>
<module>jetty-jsp</module>
<module>apache-jsp</module>
<module>apache-jstl</module>
<module>jetty-maven-plugin</module>
<module>jetty-jspc-maven-plugin</module>
<module>jetty-deploy</module>
@ -425,7 +428,6 @@
<module>jetty-plus</module>
<module>jetty-annotations</module>
<module>jetty-jndi</module>
<module>jetty-jsp</module>
<module>jetty-jaas</module>
<module>jetty-spring</module>
<module>jetty-client</module>
@ -518,6 +520,12 @@
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.mortbay.jasper</groupId>
<artifactId>apache-jsp</artifactId>
<version>8.0.3.v20140313</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
@ -555,6 +563,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.1</version>
</dependency>
<!-- JSTL API -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
@ -572,6 +586,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>