merge from master

This commit is contained in:
Jesse McConnell 2012-02-01 17:25:08 -06:00
commit 6b079ae3d8
49 changed files with 941 additions and 586 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
# maven
target/
*/src/main/java/META-INF/
*.versionsBackup
# common junk
*.log

View File

@ -8,10 +8,6 @@
<artifactId>example-jetty-embedded</artifactId>
<name>Example :: Jetty Embedded</name>
<description>Jetty Embedded Examples</description>
<build>
<plugins>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>

View File

@ -25,8 +25,9 @@
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includes>META-INF/**,org/eclipse/**,org/apache/jasper/compiler/**</includes>
<excludes>**/MANIFEST.MF,javax/**</excludes>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
@ -43,6 +44,8 @@
<includes>**/*</includes>
<excludes>META-INF/**</excludes>
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
@ -117,16 +120,6 @@
<artifactId>jetty-deploy</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@ -135,9 +128,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<version>${servlet.spec.version}</version>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@ -150,24 +143,6 @@
<artifactId>jetty-plus</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@ -180,28 +155,12 @@
<artifactId>jetty-annotations</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.0_spec</artifactId>
</exclusion>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm-commons</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaspi</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaspic_1.0_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@ -228,37 +187,24 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.security.auth.message</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.activation</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaspic_1.0_spec</artifactId>
<version>1.0</version>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.annotation</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.0_spec</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-commons</artifactId>
<scope>compile</scope>
<version>3.1</version>
</dependency>
</dependencies>
</project>

View File

@ -20,8 +20,9 @@
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includes>META-INF/**,org/eclipse/**,org/apache/jasper/compiler/*</includes>
<excludes>**/MANIFEST.MF,javax/**</excludes>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
@ -38,6 +39,8 @@
<includes>**/*</includes>
<excludes>META-INF/**</excludes>
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
@ -103,8 +106,12 @@
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
@ -115,8 +122,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
@ -132,8 +139,8 @@
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
@ -160,28 +167,12 @@
<artifactId>jetty-annotations</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.0_spec</artifactId>
</exclusion>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm-commons</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaspi</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaspic_1.0_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@ -212,38 +203,5 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaspic_1.0_spec</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.0_spec</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-commons</artifactId>
<scope>compile</scope>
<version>3.1</version>
</dependency>
</dependencies>
</project>

View File

@ -21,8 +21,9 @@
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includes>META-INF/**,org/eclipse/**</includes>
<excludes>**/MANIFEST.MF,javax/**</excludes>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
@ -39,6 +40,8 @@
<includes>**/*</includes>
<excludes>META-INF/**</excludes>
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
@ -85,8 +88,8 @@
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
@ -103,10 +106,9 @@
</exclusions>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<version>${servlet.spec.version}</version>
<scope>compile</scope>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>

View File

@ -85,20 +85,25 @@
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -85,15 +85,20 @@
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>

View File

@ -85,15 +85,15 @@
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -92,14 +92,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.0_spec</artifactId>
<version>1.1.1</version>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.annotation</artifactId>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-commons</artifactId>
<version>3.1</version>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.objectweb.asm</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -68,7 +68,7 @@
<artifactItem>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-policy</artifactId>
<version>${jetty.test.policy}</version>
<version>${jetty-test-policy-version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<includes>**/*.keystore,**/*.pem</includes>

View File

@ -810,8 +810,8 @@ public class HttpExchange
void associate(AbstractHttpConnection connection)
{
if (connection.getEndPoint().getLocalHost() != null)
_localAddress = new Address(connection.getEndPoint().getLocalHost(),connection.getEndPoint().getLocalPort());
if (connection.getEndPoint().getLocalAddr() != null)
_localAddress = new Address(connection.getEndPoint().getLocalAddr(),connection.getEndPoint().getLocalPort());
_connection = connection;
if (getStatus() == STATUS_CANCELLING)

View File

@ -64,11 +64,11 @@
</build>
<dependencies>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<version>${servlet.spec.version}</version>
<scope>provided</scope>
</dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0.20100224</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>

View File

@ -9,21 +9,20 @@
<name>Jetty :: Distribution Assemblies</name>
<packaging>pom</packaging>
<properties>
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit</jetty-orbit-url>
<assembly-directory>target/distribution</assembly-directory>
<eclipse-ecj-version>3.6</eclipse-ecj-version>
<orbit-javax-activation-version>${javax-activation-version}.0.v201005080500</orbit-javax-activation-version>
<orbit-javax-annotation-version>1.1.0.v201105051105</orbit-javax-annotation-version>
<orbit-javax-el-version>2.2.0.v201105051105</orbit-javax-el-version>
<orbit-javax-annotation-version>1.0.0.v20100513-0750</orbit-javax-annotation-version>
<orbit-javax-el-version>2.1.0.v201004190952</orbit-javax-el-version>
<orbit-javax-mail-glassfish-version>${javax-mail-version}.v201005082020</orbit-javax-mail-glassfish-version>
<orbit-javax-servlet-version>3.0.0.v201112011016</orbit-javax-servlet-version>
<orbit-javax-servlet-jsp-version>2.2.0.v201112011158</orbit-javax-servlet-jsp-version>
<orbit-javax-servlet-version>2.5.0.v200910301333</orbit-javax-servlet-version>
<orbit-javax-servlet-jsp-version>2.1.0.v201004190952</orbit-javax-servlet-jsp-version>
<orbit-javax-servlet-jsp-jstl-version>1.2.0.v201004190952</orbit-javax-servlet-jsp-jstl-version>
<orbit-com-sun-el-version>2.2.0.v201105051105</orbit-com-sun-el-version>
<orbit-com-sun-el-version>1.0.0.v201004190952</orbit-com-sun-el-version>
<orbit-org-apache-jasper-version>2.1.0.v201110031002</orbit-org-apache-jasper-version>
<orbit-org-apache-taglibs-standard-version>1.2.0.v201004190952</orbit-org-apache-taglibs-standard-version>
<orbit-org-objectweb-asm-version>3.3.1.v201101071600</orbit-org-objectweb-asm-version>
<orbit-org-objectweb-asm-version>3.1.0.v200803061910</orbit-org-objectweb-asm-version>
<orbit-javax-transaction-version>1.1.1.v201004190952</orbit-javax-transaction-version>
<orbit-org-apache-jasper-version>2.2.2.v201112011158</orbit-org-apache-jasper-version>
</properties>
<build>
<plugins>
@ -87,9 +86,8 @@
<!-- ${jetty.home}/lib/ -->
<mkdir dir="${assembly-directory}/lib" />
<copy file="${orbit-cache}/javax.servlet_${orbit-javax-servlet-version}.jar" tofile="${assembly-directory}/lib/servlet-api-3.0.jar" />
<copy file="${orbit-cache}/javax.servlet_${orbit-javax-servlet-version}.jar" tofile="${assembly-directory}/lib/servlet-api-2.5.jar" />
<!-- ${jetty.home}/lib/annotations/ -->
<mkdir dir="${assembly-directory}/lib/annotations" />
<copy todir="${assembly-directory}/lib/annotations">
@ -124,11 +122,12 @@
<include name="javax.servlet.jsp_${orbit-javax-servlet-jsp-version}.jar" />
<include name="javax.servlet.jsp.jstl_${orbit-javax-servlet-jsp-jstl-version}.jar" />
<include name="com.sun.el_${orbit-com-sun-el-version}.jar" />
<include name="org.apache.jasper.glassfish_${orbit-org-apache-jasper-version}.jar" />
<include name="org.apache.jasper.glassfish_${orbit-org-apache-jasper-version}.jar" />
<include name="org.apache.taglibs.standard.glassfish_${orbit-org-apache-taglibs-standard-version}.jar" />
<include name="ecj-${eclipse-ecj-version}.jar" />
</fileset>
</copy>
<chmod dir="${assembly-directory}/bin" perm="755" includes="**/*.sh" />
</tasks>
</configuration>
@ -206,11 +205,83 @@
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
<excludeArtifactIds>jetty-start,jetty-monitor</excludeArtifactIds>
<excludeGroupIds>org.eclipse.jetty.orbit</excludeGroupIds>
<excludeArtifactIds>jetty-start,jetty-monitor,jetty-jsp</excludeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-orbit-servlet-api-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<version>${orbit-servlet-api-version}</version>
<overWrite>true</overWrite>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
<destFileName>servlet-api-2.5.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-orbit-lib-annotations-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty.orbit</includeGroupIds>
<includeArtifactIds>javax.annotation,org.objectweb.asm</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/annotations</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-orbit-lib-jta-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty.orbit</includeGroupIds>
<includeArtifactIds>javax.transaction</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/jta</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-orbit-lib-jndi-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty.orbit</includeGroupIds>
<includeArtifactIds>javax.mail.glassfish,javax.activation</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/jndi</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-orbit-lib-jsp-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty.orbit</includeGroupIds>
<includeArtifactIds>com.sun.el,javax.el,javax.servlet.jsp,javax.servlet.jsp.jstl,org.apache.jasper.glassfish,org.apache.taglibs.standard.glassfish,org.eclipse.jdt.core</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/jsp</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-lib-monitor-deps</id>
<phase>generate-resources</phase>
@ -293,6 +364,39 @@
</plugins>
</build>
<dependencies>
<!-- Orbit Deps -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.annotation</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.objectweb.asm</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.activation</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.transaction</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.security.auth.message</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Standard Jetty Deps -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>

View File

@ -17,9 +17,8 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<version>${servlet.spec.version}</version>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -48,7 +48,7 @@ public class IOTest
IO.copyThread(in,out);
Thread.sleep(1500);
System.err.println(out);
// System.err.println(out);
assertEquals( "copyThread",
out.toString(),
@ -157,7 +157,7 @@ public class IOTest
// Write from server to client with oshut
server.getOutputStream().write(1);
System.err.println("OSHUT "+server);
// System.err.println("OSHUT "+server);
server.shutdownOutput();
// Client reads response
@ -168,19 +168,19 @@ public class IOTest
// Client reads -1 and does ishut
assertEquals(-1,client.getInputStream().read());
assertFalse(client.isInputShutdown());
System.err.println("ISHUT "+client);
//System.err.println("ISHUT "+client);
client.shutdownInput();
// Client ???
System.err.println("OSHUT "+client);
//System.err.println("OSHUT "+client);
client.shutdownOutput();
System.err.println("CLOSE "+client);
//System.err.println("CLOSE "+client);
client.close();
// Server reads -1, does ishut and then close
assertEquals(-1,server.getInputStream().read());
assertFalse(server.isInputShutdown());
System.err.println("ISHUT "+server);
//System.err.println("ISHUT "+server);
try
{
@ -188,9 +188,9 @@ public class IOTest
}
catch(SocketException e)
{
System.err.println(e);
// System.err.println(e);
}
System.err.println("CLOSE "+server);
//System.err.println("CLOSE "+server);
server.close();
}
@ -222,7 +222,7 @@ public class IOTest
// Write from server to client with oshut
server.getOutputStream().write(1);
System.err.println("OSHUT "+server);
//System.err.println("OSHUT "+server);
server.shutdownOutput();
try
@ -255,8 +255,6 @@ public class IOTest
// Client can still write data even though server is closed???
client.getOutputStream().write(1);
Thread.sleep(100);
client.getOutputStream().write(1);
// Client eventually sees Broken Pipe
int i=0;

View File

@ -52,21 +52,6 @@
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repository.apache.org</id>
<name>Apache Snapshot Repository</name>
<layout>default</layout>
<url>http://repository.apache.org/content/groups/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@ -79,9 +64,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaspic_1.0_spec</artifactId>
<version>1.0</version>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.security.auth.message</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -64,14 +64,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<exclusions>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
</dependency>
</dependencies>
<profiles>
@ -82,9 +76,8 @@
</activation>
<dependencies>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.activation</artifactId>
</dependency>
</dependencies>
</profile>

58
jetty-jsp/pom.xml Normal file
View File

@ -0,0 +1,58 @@
<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>7.6.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-jsp</artifactId>
<name>Jetty :: JSP dependencies</name>
<packaging>jar</packaging>
<build>
</build>
<dependencies>
<!-- JSP Api -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet.jsp</artifactId>
<version>2.1.0.v201105211820</version>
</dependency>
<!-- JSP Impl -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.apache.jasper.glassfish</artifactId>
<version>2.1.0.v201110031002</version>
</dependency>
<!-- JSTL Api -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.0.v201105211821</version>
</dependency>
<!-- JSTL Impl -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.apache.taglibs.standard.glassfish</artifactId>
<version>1.2.0.v201112081803</version>
</dependency>
<!-- EL Api -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.el</artifactId>
<version>2.1.0.v201105211819</version>
</dependency>
<!-- EL Impl -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>com.sun.el</artifactId>
<version>1.0.0.v201105211818</version>
</dependency>
<!-- Eclipse Java Compiler (for JSP Compilation) -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.7.1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,4 @@
This 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

@ -8,8 +8,6 @@
<artifactId>jetty-nosql</artifactId>
<name>Jetty :: NoSQL Session Managers</name>
<properties>
<jetty-version>${project.version}</jetty-version>
<junit4-version>${junit-version}</junit4-version>
<bundle-symbolic-name>${project.groupId}.nosql</bundle-symbolic-name>
</properties>
<build>

View File

@ -28,8 +28,6 @@ import org.eclipse.jetty.nosql.NoSqlSessionManager;
import org.eclipse.jetty.server.SessionIdManager;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.Logger;
import org.omg.CORBA._IDLTypeStub;
import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;
@ -421,7 +419,7 @@ public class MongoSessionManager extends NoSqlSessionManager
o = null;
break;
}
o.append(encodeName(entry.getKey().toString()),encodeName(out,bout,value));
o.append(encodeName(entry.getKey().toString()),encodeName(out,bout,entry.getValue()));
}
if (o != null)

View File

@ -24,48 +24,25 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<!-- switch to 2.2 once it works in OSGi for us
<!-- Orbit Servlet Deps -->
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jsp-impl</artifactId>
<version>2.2</version>
</dependency> -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1-glassfish</artifactId>
<version>2.1.v20100127</version>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</dependency>
<!--dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency-->
<!-- Orbit JSP Deps -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<!-- can't find the jsp-2.2 jars on maven central.
adding glassifish maven repo for now. -->
<repositories>
<repository>
<id>sun</id>
<url>http://download.java.net/maven/2/</url>
</repository>
</repositories>
<build>
<plugins>
@ -117,6 +94,4 @@
</plugin>
</plugins>
</build>
</project>

View File

@ -30,8 +30,8 @@
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</dependency>
</dependencies>

View File

@ -15,8 +15,7 @@
<osgi-services-version>3.2.100.v20100503</osgi-services-version>
<equinox-http-servlet-version>1.0.0-v20070606</equinox-http-servlet-version>
<!--equinox-servletbridge-version>1.0.0-v20070523</equinox-servletbridge-version-->
<jsp-api-2.2-tomcat-version>7.0.8</jsp-api-2.2-tomcat-version>
<el-api-2.2-tomcat-version>7.0.8</el-api-2.2-tomcat-version>
<jsp-2.1-glassfish-version>2.1.v20100127</jsp-2.1-glassfish-version>
<logback-version>0.9.18</logback-version>
<slf4j-version>1.5.11</slf4j-version>
</properties>
@ -148,14 +147,14 @@
<version>${jsp-impl-2.2-glassfish-version}</version>
</dependency-->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jsp-api</artifactId>
<version>${jsp-api-2.2-tomcat-version}</version>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1-glassfish</artifactId>
<version>${jsp-2.1-glassfish-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-el-api</artifactId>
<version>${el-api-2.2-tomcat-version}</version>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1-glassfish</artifactId>
<version>${jsp-2.1-glassfish-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>

View File

@ -11,23 +11,25 @@
<description>Jetty OSGi Integration test</description>
<properties>
<bundle-symbolic-name>${project.groupId}.boot.test</bundle-symbolic-name>
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit</jetty-orbit-url>
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit/</jetty-orbit-url>
<assembly-directory>target/distribution</assembly-directory>
<eclipse-ecj-version>3.6</eclipse-ecj-version>
<orbit-javax-activation-version>${javax-activation-version}.0.v201005080500</orbit-javax-activation-version>
<orbit-javax-annotation-version>1.1.0.v201105051105</orbit-javax-annotation-version>
<orbit-javax-el-version>2.2.0.v201105051105</orbit-javax-el-version>
<orbit-javax-mail-glassfish-version>${javax-mail-version}.v201005082020</orbit-javax-mail-glassfish-version>
<orbit-javax-servlet-version>3.0.0.v201112011016</orbit-javax-servlet-version>
<orbit-javax-servlet-jsp-version>2.2.0.v201112011158</orbit-javax-servlet-jsp-version>
<orbit-javax-servlet-jsp-jstl-version>1.2.0.v201105211821</orbit-javax-servlet-jsp-jstl-version>
<orbit-com-sun-el-version>2.2.0.v201108011116</orbit-com-sun-el-version>
<orbit-org-apache-jasper-version>2.2.2.v201112011158</orbit-org-apache-jasper-version>
<orbit-org-apache-taglibs-standard-version>1.2.0.v201004190952</orbit-org-apache-taglibs-standard-version>
<orbit-org-objectweb-asm-version>3.3.1.v201101071600</orbit-org-objectweb-asm-version>
<orbit-javax-transaction-version>1.1.1.v201004190952</orbit-javax-transaction-version>
<paxexam-version>1.2.0</paxexam-version>
</properties>
<dependencies>
<!-- Orbit Servlet Deps -->
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</dependency>
<!-- Orbit JSP Deps -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>${project.version}</version>
</dependency>
<!-- OSGi Deps -->
<dependency>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-boot</artifactId>
@ -46,6 +48,8 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- Jetty Deps -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
@ -67,6 +71,11 @@
<artifactId>jetty-servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-xml</artifactId>
@ -94,23 +103,16 @@
<artifactId>jetty-websocket</artifactId>
<scope>runtime</scope>
</dependency>
<!-- can't use javax.servlet:servlet-api:2.5 it is not a bundle.
the mortbay one is a bundle -->
<!-- Eclipse OSGi Deps -->
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<version>${servlet.spec.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
@ -118,11 +120,6 @@
<artifactId>servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@ -135,19 +132,19 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
<version>1.2.0</version>
<scope>test</scope>
<version>${paxexam-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit</artifactId>
<version>1.2.0</version>
<version>${paxexam-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default</artifactId>
<version>1.2.0</version>
<version>${paxexam-version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -160,93 +157,77 @@
<build>
<plugins>
<plugin>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>maven-paxexam-plugin</artifactId>
<version>1.2.0</version>
<executions>
<execution>
<id>generate-config</id>
<goals>
<goal>generate-depends-file</goal>
<goal>generate-config</goal>
</goals>
</execution>
</executions>
<configuration>
<options>
<workingDirectory>${project.build.directory}/paxexam</workingDirectory>
</options>
</configuration>
</plugin>
<!-- prepare the orbit jars in the target/distribution folder copied from jetty-distribution/pom.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>maven-paxexam-plugin</artifactId>
<version>${paxexam-version}</version>
<executions>
<execution>
<id>generate-config</id>
<goals>
<goal>generate-depends-file</goal>
<goal>generate-config</goal>
</goals>
</execution>
</executions>
<configuration>
<options>
<workingDirectory>${project.build.directory}/paxexam</workingDirectory>
</options>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-orbit-servlet-api-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
<goal>copy</goal>
</goals>
<configuration>
<tasks>
<!-- This is the Orbit Downloads Process -->
<!-- Step 1: download orbit artifact into orbit-cache (if not present) -->
<property name="orbit-cache" value="${user.home}/.m2/eclipse-orbit" />
<mkdir dir="${orbit-cache}" />
<get dest="${orbit-cache}" verbose="true" skipexisting="true">
<url url="${jetty-orbit-url}/javax.servlet_${orbit-javax-servlet-version}.jar" />
<url url="${jetty-orbit-url}/javax.activation_${orbit-javax-activation-version}.jar" />
<url url="${jetty-orbit-url}/javax.mail.glassfish_${orbit-javax-mail-glassfish-version}.jar" />
<url url="${jetty-orbit-url}/javax.el_${orbit-javax-el-version}.jar" />
<url url="${jetty-orbit-url}/javax.servlet.jsp_${orbit-javax-servlet-jsp-version}.jar" />
<url url="${jetty-orbit-url}/javax.servlet.jsp.jstl_${orbit-javax-servlet-jsp-jstl-version}.jar" />
<url url="${jetty-orbit-url}/com.sun.el_${orbit-com-sun-el-version}.jar" />
<url url="${jetty-orbit-url}/org.apache.jasper.glassfish_${orbit-org-apache-jasper-version}.jar" />
<url url="${jetty-orbit-url}/org.apache.taglibs.standard.glassfish_${orbit-org-apache-taglibs-standard-version}.jar" />
<url url="${jetty-orbit-url}/ecj-${eclipse-ecj-version}.jar" />
</get>
<!-- Step 2: copy the orbit artifact from orbit-cache to the appropriate lib directory -->
<!-- ${jetty.home}/lib/ -->
<mkdir dir="${assembly-directory}/lib" />
<copy file="${orbit-cache}/javax.servlet_${orbit-javax-servlet-version}.jar" tofile="${assembly-directory}/lib/servlet-api-3.0.jar" />
<!-- ${jetty.home}/lib/jndi/ -->
<mkdir dir="${assembly-directory}/lib/jndi" />
<copy todir="${assembly-directory}/lib/jndi">
<fileset dir="${orbit-cache}">
<include name="javax.activation_${orbit-javax-activation-version}.jar" />
<include name="javax.mail.glassfish_${orbit-javax-mail-glassfish-version}.jar" />
</fileset>
</copy>
<!-- ${jetty.home}/lib/jsp/ -->
<mkdir dir="${assembly-directory}/lib/jsp" />
<copy todir="${assembly-directory}/lib/jsp">
<fileset dir="${orbit-cache}">
<include name="javax.el_${orbit-javax-el-version}.jar" />
<include name="javax.servlet.jsp_${orbit-javax-servlet-jsp-version}.jar" />
<include name="javax.servlet.jsp.jstl_${orbit-javax-servlet-jsp-jstl-version}.jar" />
<include name="com.sun.el_${orbit-com-sun-el-version}.jar" />
<include name="org.apache.jasper.glassfish_${orbit-org-apache-jasper-version}.jar" />
<include name="org.apache.taglibs.standard.glassfish_${orbit-org-apache-taglibs-standard-version}.jar" />
<include name="ecj-${eclipse-ecj-version}.jar" />
</fileset>
<!--fileset dir="${orbit-cache}/${eclipse-drop}">
<include name="ecj-${eclipse-ecj-version}.jar" />
</fileset-->
</copy>
</tasks>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<version>${orbit-servlet-api-version}</version>
<overWrite>true</overWrite>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
<destFileName>servlet-api-2.5.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-orbit-lib-jndi-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty.orbit</includeGroupIds>
<includeArtifactIds>javax.mail.glassfish,javax.activation</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/jndi</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-orbit-lib-jsp-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty.orbit</includeGroupIds>
<includeArtifactIds>com.sun.el,javax.el,javax.servlet.jsp,javax.servlet.jsp.jstl,org.apache.jasper.glassfish,org.apache.taglibs.standard.glassfish,org.eclipse.jdt.core</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/jsp</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
@ -260,7 +241,6 @@
</sourceExcludes>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -14,8 +14,7 @@
// ========================================================================
package org.eclipse.jetty.osgi.boot;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.*;
import java.io.IOException;
import java.util.ArrayList;
@ -61,17 +60,18 @@ public class TestJettyOSGiBootCore
* Jetty-osgi including webapp support and also jetty-client.
* Sets the system property jetty.home.bunde=org.eclipse.jetty.osgi.boot
* to use the jetty server configuration embedded in
* @return
*
* @return list of options
*/
public static List<Option> provisionCoreJetty()
{
return Arrays.asList(options(
//get the jetty home config from the osgi boot bundle.
// get the jetty home config from the osgi boot bundle.
PaxRunnerOptions.vmOptions("-Djetty.port=9876 -D" + DefaultJettyAtJettyHomeHelper.SYS_PROP_JETTY_HOME_BUNDLE + "=org.eclipse.jetty.osgi.boot"),
// CoreOptions.equinox(),
// CoreOptions.equinox(),
mavenBundle().groupId( "org.mortbay.jetty" ).artifactId( "servlet-api" ).versionAsInProject().noStart(),
mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "javax.servlet" ).versionAsInProject().noStart(),
mavenBundle().groupId( "org.eclipse.osgi" ).artifactId( "org.eclipse.osgi" ).versionAsInProject().noStart(),
mavenBundle().groupId( "org.eclipse.osgi" ).artifactId( "org.eclipse.osgi.services" ).versionAsInProject().noStart(),
@ -85,10 +85,11 @@ public class TestJettyOSGiBootCore
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-io" ).versionAsInProject().noStart(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-continuation" ).versionAsInProject().noStart(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-security" ).versionAsInProject().noStart(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-websocket" ).versionAsInProject().noStart(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-servlets" ).versionAsInProject().noStart(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-client" ).versionAsInProject().noStart()
));
}
@Inject
@ -154,6 +155,7 @@ public class TestJettyOSGiBootCore
HttpService http = (HttpService)bundleContext.getService(sr);
http.registerServlet("/greetings", new HttpServlet() {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req,
HttpServletResponse resp) throws ServletException,
IOException {

View File

@ -14,10 +14,7 @@
// ========================================================================
package org.eclipse.jetty.osgi.boot;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.*;
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.*;
import java.io.File;
import java.util.ArrayList;
@ -32,9 +29,9 @@ import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpExchange;
import org.eclipse.jetty.http.HttpMethods;
import org.eclipse.jetty.http.HttpStatus;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.Inject;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.container.def.PaxRunnerOptions;
@ -50,10 +47,12 @@ import org.osgi.framework.BundleContext;
@RunWith( JUnit4TestRunner.class )
public class TestJettyOSGiBootWithJsp
{
private static final boolean LOGGING_ENABLED = false;
private static final boolean REMOTE_DEBUGGING = false;
@Inject
BundleContext bundleContext = null;
@Configuration
public static Option[] configure()
{
@ -61,33 +60,48 @@ public class TestJettyOSGiBootWithJsp
ArrayList<Option> options = new ArrayList<Option>();
options.addAll(TestJettyOSGiBootCore.provisionCoreJetty());
// Enable Logging
if(LOGGING_ENABLED) {
options.addAll(Arrays.asList(options(
// install log service using pax runners profile abstraction (there are more profiles, like DS)
// logProfile(),
// this is how you set the default log level when using pax logging (logProfile)
systemProperty( "org.ops4j.pax.logging.DefaultServiceLog.level" ).value( "INFO" )
)));
}
// Remote JDWP Debugging
if(REMOTE_DEBUGGING) {
options.addAll(Arrays.asList(options(
// this just adds all what you write here to java vm argumenents of the (new) osgi process.
PaxRunnerOptions.vmOption( "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006" )
)));
}
// Standard Options
options.addAll(Arrays.asList(options(
//workaround: for some reason, despite the fact that everyone of those packages is imported by the jsp fragment
//felix complains that it cannot find them
bootDelegationPackages("org.xml.sax", "org.xml.sax.helpers", "javax.xml.parsers", "org.w3c.dom", "javax.xml.transform", "org.w3c.dom.ls"),
PaxRunnerOptions.vmOption("-Djetty.port=9876 -D" + OSGiServerConstants.MANAGED_JETTY_XML_CONFIG_URLS +
"=etc/jetty.xml;" + testrealm.getAbsolutePath()),
// install log service using pax runners profile abstraction (there are more profiles, like DS)
//logProfile(),
// this is how you set the default log level when using pax logging (logProfile)
//systemProperty( "org.ops4j.pax.logging.DefaultServiceLog.level" ).value( "INFO" ),
// this just adds all what you write here to java vm argumenents of the (new) osgi process.
//PaxRunnerOptions.vmOption( "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006" ),
PaxRunnerOptions.vmOption("-Djetty.port=9876 -D" + OSGiServerConstants.MANAGED_JETTY_XML_CONFIG_URLS +
"=etc/jetty.xml;" + testrealm.getAbsolutePath()),
mavenBundle().groupId( "org.eclipse.jetty.osgi" ).artifactId( "jetty-osgi-boot" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty.osgi" ).artifactId( "jetty-osgi-boot-jsp" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-websocket" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-servlets" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "test-jetty-webapp" ).classifier("webbundle").versionAsInProject(),
//the jsp bundles downloaded from eclipse orbit website and the ecj jar.
// CoreOptions.provision( PaxRunnerOptions.scanDir( "jasper" ) ),
CoreOptions.provision( PaxRunnerOptions.scanDir( "target/distribution/lib/jsp" ) )
/* orbit deps */
mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "javax.servlet.jsp" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "javax.servlet.jsp.jstl" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "javax.el" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "com.sun.el" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "org.apache.jasper.glassfish" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "org.apache.taglibs.standard.glassfish" ).versionAsInProject(),
mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "org.eclipse.jdt.core" ).versionAsInProject(),
/* jetty-osgi deps */
mavenBundle().groupId( "org.eclipse.jetty.osgi" ).artifactId( "jetty-osgi-boot" ).versionAsInProject().start(),
mavenBundle().groupId( "org.eclipse.jetty.osgi" ).artifactId( "jetty-osgi-boot-jsp" ).versionAsInProject().start(),
mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "test-jetty-webapp" ).classifier("webbundle").versionAsInProject()
// mavenBundle().groupId( "org.eclipse.equinox.http" ).artifactId( "servlet" ).versionAsInProject().start()
)));
return options.toArray(new Option[options.size()]);
}
@ -96,6 +110,7 @@ public class TestJettyOSGiBootWithJsp
* plus your testcase, wrapped into a bundle called pax-exam-probe
*/
@Test
@Ignore
public void listBundles() throws Exception
{
Map<String,Bundle> bundlesIndexedBySymbolicName = new HashMap<String, Bundle>();

View File

@ -48,9 +48,8 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.transaction</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -88,8 +88,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.transaction</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>

View File

@ -76,7 +76,7 @@
<artifactItem>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-policy</artifactId>
<version>${jetty.test.policy}</version>
<version>${jetty-test-policy-version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<includes>**/*.keystore</includes>
@ -96,7 +96,7 @@
<artifactItem>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-policy</artifactId>
<version>${jetty.test.policy}</version>
<version>${jetty-test-policy-version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<includes>**</includes>

View File

@ -84,6 +84,10 @@
<artifactId>jetty-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>test-jetty-servlet</artifactId>

View File

@ -23,10 +23,13 @@ import org.eclipse.jetty.server.Request;
/**
* Rewrite the URI by matching with a regular expression.
* The replacement string may use $n" to replace the nth capture group.
* If the replacement string contains ? character, then it is split into a path
* and query string component. The returned target contains only the path.
*/
public class RewriteRegexRule extends RegexRule implements Rule.ApplyURI
{
private String _replacement;
private String _query;
/* ------------------------------------------------------------ */
public RewriteRegexRule()
@ -43,7 +46,9 @@ public class RewriteRegexRule extends RegexRule implements Rule.ApplyURI
*/
public void setReplacement(String replacement)
{
_replacement = replacement;
String[] split=replacement.split("\\?",2);
_replacement = split[0];
_query=split.length==2?split[1]:null;
}
@ -54,32 +59,36 @@ public class RewriteRegexRule extends RegexRule implements Rule.ApplyURI
public String apply(String target, HttpServletRequest request, HttpServletResponse response, Matcher matcher) throws IOException
{
target=_replacement;
String query=_query;
for (int g=1;g<=matcher.groupCount();g++)
{
String group = Matcher.quoteReplacement(matcher.group(g));
String group=matcher.group(g);
if (group==null)
group="";
else
group = Matcher.quoteReplacement(group);
target=target.replaceAll("\\$"+g,group);
if (query!=null)
query=query.replaceAll("\\$"+g,group);
}
if (query!=null)
request.setAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q",query);
return target;
}
/* ------------------------------------------------------------ */
public void applyURI(Request request, String oldTarget, String newTarget) throws IOException
{
Matcher matcher=_regex.matcher(request.getRequestURI());
boolean matches = matcher.matches();
if (matches)
request.setRequestURI(newTarget);
if (_query!=null)
{
String uri=_replacement;
for (int g=1;g<=matcher.groupCount();g++)
{
String group = Matcher.quoteReplacement(matcher.group(g));
uri=uri.replaceAll("\\$"+g,group);
}
request.setRequestURI(uri);
String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
if (request.getQueryString()==null)
request.setQueryString(query);
else
request.setQueryString(request.getQueryString()+"&"+query);
}
else
request.setRequestURI(newTarget);
}
/* ------------------------------------------------------------ */

View File

@ -23,11 +23,13 @@ public class RewriteRegexRuleTest extends AbstractRuleTestCase
{
private String[][] _tests=
{
{"/foo/bar",".*","/replace","/replace"},
{"/foo/bar","/xxx.*","/replace",null},
{"/foo/bar","/(.*)/(.*)","/$2/$1/xxx","/bar/foo/xxx"},
{"/foo/$bar",".*","/$replace","/$replace"},
{"/foo/$bar","/foo/(.*)","/$1/replace","/$bar/replace"},
{"/foo/bar",".*","/replace","/replace",null},
{"/foo/bar","/xxx.*","/replace",null,null},
{"/foo/bar","/(.*)/(.*)","/$2/$1/xxx","/bar/foo/xxx",null},
{"/foo/bar","/(foo)/(.*)(bar)","/$3/$1/xxx$2","/bar/foo/xxx",null},
{"/foo/$bar",".*","/$replace","/$replace",null},
{"/foo/$bar","/foo/(.*)","/$1/replace","/$bar/replace",null},
{"/foo/bar/info","/foo/(NotHere)?([^/]*)/(.*)","/$3/other?p1=$2","/info/other","p1=bar"},
};
private RewriteRegexRule _rule;
@ -47,6 +49,13 @@ public class RewriteRegexRuleTest extends AbstractRuleTestCase
_rule.setReplacement(test[2]);
String result = _rule.matchAndApply(test[0], _request, _response);
assertEquals(test[1], test[3], result);
_request.setRequestURI(test[0]);
_request.setQueryString(null);
_rule.applyURI(_request,test[0],result);
assertEquals(test[3], _request.getRequestURI());
assertEquals(test[4], _request.getQueryString());
}
}
}

View File

@ -8,7 +8,6 @@
<artifactId>jetty-server</artifactId>
<name>Jetty :: Server Core</name>
<description>The core jetty server artifact.</description>
<url>${jetty.url}</url>
<properties>
<bundle-symbolic-name>${project.groupId}.server</bundle-symbolic-name>
</properties>
@ -88,14 +87,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-continuation</artifactId>
@ -113,9 +107,9 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -84,11 +84,11 @@
<artifactId>jetty-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>test-jetty-servlet</artifactId>

View File

@ -170,6 +170,7 @@ public abstract class AbstractDoSFilterTest
{
Thread other = new Thread()
{
@Override
public void run()
{
try
@ -205,6 +206,7 @@ public abstract class AbstractDoSFilterTest
{
Thread other = new Thread()
{
@Override
public void run()
{
try
@ -283,11 +285,11 @@ public abstract class AbstractDoSFilterTest
assertEquals(0,count(responses,"DoSFilter: delayed"));
// alternate between sessions
responses = doRequests(request1+request2+request1+request2+request1,2,550,550,last);
responses = doRequests(request1+request2+request1+request2+request1,2,350,550,last);
assertEquals(11,count(responses,"HTTP/1.1 200 OK"));
int delayedRequests = count(responses,"DoSFilter: delayed");
assertTrue(delayedRequests >= 2 && delayedRequests <= 3);
assertTrue("delayedRequests: " + delayedRequests + " is not between 2 and 3",delayedRequests >= 2 && delayedRequests <= 3);
}
@Test
@ -305,6 +307,7 @@ public abstract class AbstractDoSFilterTest
public static class TestServlet extends HttpServlet implements Servlet
{
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
if (request.getParameter("session")!=null)

View File

@ -14,12 +14,17 @@
package org.eclipse.jetty.servlets;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.servlets.DoSFilter.RateTracker;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.BeforeClass;
import org.junit.Test;
public class DoSFilterTest extends AbstractDoSFilterTest
{
@ -33,6 +38,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest
public static class DoSFilter2 extends DoSFilter
{
@Override
public void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread)
{
try
@ -46,4 +52,31 @@ public class DoSFilterTest extends AbstractDoSFilterTest
}
}
}
@Test
public void isRateExceededTest() throws InterruptedException
{
DoSFilter doSFilter = new DoSFilter();
boolean exceeded = hitRateTracker(doSFilter,0);
assertTrue("Last hit should have exceeded",exceeded);
int sleep = 250;
exceeded = hitRateTracker(doSFilter,sleep);
assertFalse("Should not exceed as we sleep 300s for each hit and thus do less than 4 hits/s",exceeded);
}
private boolean hitRateTracker(DoSFilter doSFilter, int sleep) throws InterruptedException
{
boolean exceeded = false;
RateTracker rateTracker = doSFilter.new RateTracker("test2",0,4);
for (int i = 0; i < 5; i++)
{
Thread.sleep(sleep);
if (rateTracker.isRateExceeded(System.currentTimeMillis()))
exceeded = true;
}
return exceeded;
}
}

View File

@ -0,0 +1,124 @@
package org.eclipse.jetty.start;
import java.util.ArrayList;
import java.util.List;
public class CommandLineBuilder
{
private List<String> args;
public CommandLineBuilder(String bin)
{
args = new ArrayList<String>();
args.add(bin);
}
/**
* Add a simple argument to the command line.
* <p>
* Will quote arguments that have a space in them.
*
* @param arg
* the simple argument to add
*/
public void addArg(String arg)
{
args.add(quote(arg));
}
/**
* Similar to {@link #addArg(String)} but concats both name + value with an "=" sign, quoting were needed, and excluding the "=" portion if the value is
* undefined or empty.
* <p>
*
* <pre>
* addEqualsArg("-Dname", "value") = "-Dname=value"
* addEqualsArg("-Djetty.home", "/opt/company inc/jetty (7)/") = "-Djetty.home=/opt/company\ inc/jetty\ (7)/"
* addEqualsArg("-Djenkins.workspace", "/opt/workspaces/jetty jdk7/") = "-Djenkins.workspace=/opt/workspaces/jetty\ jdk7/"
* addEqualsArg("-Dstress", null) = "-Dstress"
* addEqualsArg("-Dstress", "") = "-Dstress"
* </pre>
*
* @param name
* the name
* @param value
* the value
*/
public void addEqualsArg(String name, String value)
{
if (value != null && value.length() > 0)
{
args.add(quote(name + "=" + value));
}
else
{
args.add(quote(name));
}
}
/**
* Add a simple argument to the command line.
* <p>
* Will <b>NOT</b> quote/escape arguments that have a space in them.
*
* @param arg
* the simple argument to add
*/
public void addRawArg(String arg)
{
args.add(arg);
}
public List<String> getArgs()
{
return args;
}
/**
* Perform an optional quoting of the argument, being intelligent with spaces and quotes as needed.
*
* @param arg
* @return
*/
public static String quote(String arg)
{
boolean needsQuoting = arg.indexOf(' ') >= 0 || arg.indexOf('"') >= 0;
if (!needsQuoting)
{
return arg;
}
StringBuilder buf = new StringBuilder();
// buf.append('"');
boolean escaped = false;
for (char c : arg.toCharArray())
{
if (!escaped && ((c == '"') || (c == ' ')))
{
buf.append("\\");
}
escaped = (c == '\\');
buf.append(c);
}
// buf.append('"');
return buf.toString();
}
@Override
public String toString()
{
StringBuilder buf = new StringBuilder();
boolean delim = false;
for (String arg : args)
{
if (delim)
{
buf.append(' ');
}
buf.append(arg);
delim = true;
}
return buf.toString();
}
}

View File

@ -24,10 +24,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.security.Policy;
import java.text.CollationKey;
import java.text.Collator;
import java.util.ArrayList;
@ -148,13 +145,23 @@ public class Config
public static final String DEFAULT_SECTION = "";
static
{
Package pkg = Config.class.getPackage();
if (pkg != null &&
"Eclipse.org - Jetty".equals(pkg.getImplementationVendor()) &&
(pkg.getImplementationVersion() != null))
_version = pkg.getImplementationVersion();
else
_version = System.getProperty("jetty.version","Unknown");
String ver = System.getProperty("jetty.version", null);
if(ver == null) {
Package pkg = Config.class.getPackage();
if (pkg != null &&
"Eclipse.org - Jetty".equals(pkg.getImplementationVendor()) &&
(pkg.getImplementationVersion() != null))
{
ver = pkg.getImplementationVersion();
}
}
if (ver == null)
{
ver = "Unknown";
}
_version = ver;
}
/**
@ -177,7 +184,6 @@ public class Config
private static final Map<String, String> __properties = new HashMap<String, String>();
private final Map<String, Classpath> _classpaths = new HashMap<String, Classpath>();
private final List<String> _xml = new ArrayList<String>();
private String _policyDirectory = null;
private String _classname = null;
private int argCount = 0;

View File

@ -541,29 +541,31 @@ public class Main
// Show Command Line to execute Jetty
if (_dryRun)
{
System.out.println(buildCommandLine(classpath,configuredXmls));
CommandLineBuilder cmd = buildCommandLine(classpath,configuredXmls);
System.out.println(cmd.toString());
return;
}
// execute Jetty in another JVM
if (_exec)
{
String cmd = buildCommandLine(classpath,configuredXmls);
final Process process = Runtime.getRuntime().exec(cmd);
Runtime.getRuntime().addShutdownHook(new Thread()
CommandLineBuilder cmd = buildCommandLine(classpath,configuredXmls);
ProcessBuilder pbuilder = new ProcessBuilder(cmd.getArgs());
final Process process = pbuilder.start();
try
{
@Override
public void run()
{
Config.debug("Destroying " + process);
process.destroy();
}
});
copyInThread(process.getErrorStream(),System.err);
copyInThread(process.getInputStream(),System.out);
copyInThread(System.in,process.getOutputStream());
monitor.setProcess(process);
process.waitFor();
copyInThread(process.getErrorStream(),System.err);
copyInThread(process.getInputStream(),System.out);
copyInThread(System.in,process.getOutputStream());
monitor.setProcess(process);
process.waitFor();
}
finally
{
Config.debug("Destroying " + process);
process.destroy();
}
return;
}
@ -659,23 +661,23 @@ public class Main
throw new FileNotFoundException("Unable to find XML Config: " + xmlFilename);
}
private String buildCommandLine(Classpath classpath, List<String> xmls) throws IOException
CommandLineBuilder buildCommandLine(Classpath classpath, List<String> xmls) throws IOException
{
StringBuilder cmd = new StringBuilder();
cmd.append(findJavaBin());
for (String x : _jvmArgs) {
cmd.append(x);
CommandLineBuilder cmd = new CommandLineBuilder(findJavaBin());
for (String x : _jvmArgs)
{
cmd.addArg(x);
}
cmd.append(" -Djetty.home=").append(escapeSpaces(_jettyHome));
cmd.addRawArg("-Djetty.home=" + _jettyHome);
for (String p : _sysProps)
{
cmd.append(" -D").append(p);
String v = System.getProperty(p);
if (v != null && v.length() > 0)
cmd.append("=").append(escapeSpaces(v));
cmd.addEqualsArg("-D" + p,v);
}
cmd.append(" -cp ").append(classpath.toString());
cmd.append(" ").append(_config.getMainClassname());
cmd.addArg("-cp");
cmd.addRawArg(classpath.toString());
cmd.addRawArg(_config.getMainClassname());
// Check if we need to pass properties as a file
Properties properties = Config.getProperties();
@ -685,18 +687,14 @@ public class Main
if (!_dryRun)
prop_file.deleteOnExit();
properties.store(new FileOutputStream(prop_file),"start.jar properties");
cmd.append(" ").append(escapeSpaces(prop_file.getAbsolutePath()));
cmd.addArg(prop_file.getAbsolutePath());
}
for (String xml : xmls)
cmd.append(" ").append(escapeSpaces(xml));
return cmd.toString();
}
private static String escapeSpaces(String s)
{
return s.replace(" ","\\ ");
{
cmd.addRawArg(xml);
}
return cmd;
}
private String findJavaBin()
@ -1094,4 +1092,9 @@ public class Main
return args;
}
void addJvmArgs(List<String> jvmArgs)
{
_jvmArgs.addAll(jvmArgs);
}
}

View File

@ -0,0 +1,42 @@
package org.eclipse.jetty.start;
import static org.hamcrest.Matchers.*;
import org.junit.Assert;
import org.junit.Test;
public class CommandLineBuilderTest
{
@Test
public void testSimpleCommandline()
{
CommandLineBuilder cmd = new CommandLineBuilder("java");
cmd.addEqualsArg("-Djava.io.tmpdir","/home/java/temp dir/");
cmd.addArg("--version");
Assert.assertThat(cmd.toString(), is("java -Djava.io.tmpdir=/home/java/temp\\ dir/ --version"));
}
@Test
public void testQuotingSimple()
{
assertQuoting("/opt/jetty","/opt/jetty");
}
@Test
public void testQuotingSpaceInPath()
{
assertQuoting("/opt/jetty 7/home","/opt/jetty\\ 7/home");
}
@Test
public void testQuotingSpaceAndQuotesInPath()
{
assertQuoting("/opt/jetty 7 \"special\"/home","/opt/jetty\\ 7\\ \\\"special\\\"/home");
}
private void assertQuoting(String raw, String expected)
{
String actual = CommandLineBuilder.quote(raw);
Assert.assertThat("Quoted version of [" + raw + "]",actual,is(expected));
}
}

View File

@ -13,13 +13,19 @@
package org.eclipse.jetty.start;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -53,18 +59,18 @@ public class MainTest
public void testExpandCommandLine() throws Exception
{
Main main = new Main();
List<String> args = main.expandCommandLine(new String[]{});
List<String> args = main.expandCommandLine(new String[] {});
assertEquals("start.ini OPTIONS","OPTIONS=Server,jsp,resources,websocket,ext",args.get(0));
assertEquals("start.d/jmx OPTIONS","OPTIONS=jmx",args.get(5));
assertEquals("start.d/jmx XML","--pre=etc/jetty-jmx.xml",args.get(6));
assertEquals("start.d/websocket OPTIONS","OPTIONS=websocket",args.get(7));
}
@Test
public void testProcessCommandLine() throws Exception
{
Main main = new Main();
List<String> args = main.expandCommandLine(new String[]{});
List<String> args = main.expandCommandLine(new String[] {});
List<String> xmls = main.processCommandLine(args);
assertEquals("jmx --pre","etc/jetty-jmx.xml",xmls.get(0));
@ -72,4 +78,46 @@ public class MainTest
assertEquals("start.d","etc/jetty-testrealm.xml",xmls.get(5));
}
@Test
public void testBuildCommandLine() throws IOException, NoSuchFieldException, IllegalAccessException
{
List<String> jvmArgs = new ArrayList<String>();
jvmArgs.add("--exec");
jvmArgs.add("-Xms1024m");
jvmArgs.add("-Xmx1024m");
List<String> xmls = new ArrayList<String>();
xmls.add("jetty.xml");
xmls.add("jetty-jmx.xml");
xmls.add("jetty-logging.xml");
Main main = new Main();
main.addJvmArgs(jvmArgs);
Classpath classpath = nastyWayToCreateAClasspathObject("/jetty/home with spaces/");
CommandLineBuilder cmd = main.buildCommandLine(classpath,xmls);
Assert.assertThat("CommandLineBuilder shouldn't be null",cmd,notNullValue());
String commandLine = cmd.toString();
Assert.assertThat("CommandLine shouldn't be null",commandLine,notNullValue());
Assert.assertThat("Classpath should be correctly quoted and match expected value",commandLine,
containsString("-cp /jetty/home with spaces/somejar.jar:/jetty/home with spaces/someotherjar.jar"));
Assert.assertThat("CommandLine should contain jvmArgs",commandLine,containsString("--exec -Xms1024m -Xmx1024m"));
Assert.assertThat("CommandLine should contain xmls",commandLine,containsString("jetty.xml jetty-jmx.xml jetty-logging.xml"));
}
private Classpath nastyWayToCreateAClasspathObject(String jettyHome) throws NoSuchFieldException, IllegalAccessException
{
Classpath classpath = new Classpath();
Field classpathElements = Classpath.class.getDeclaredField("_elements");
classpathElements.setAccessible(true);
File file = new File(jettyHome + "somejar.jar");
File file2 = new File(jettyHome + "someotherjar.jar");
Vector<File> elements = new Vector<File>();
elements.add(file);
elements.add(file2);
classpathElements.set(classpath,elements);
return classpath;
}
}

View File

@ -74,16 +74,6 @@
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>

View File

@ -16,8 +16,8 @@
<dependencies>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>provided</scope>
</dependency>
<dependency>

133
pom.xml
View File

@ -11,19 +11,12 @@
<url>${jetty.url}</url>
<packaging>pom</packaging>
<properties>
<javax-activation-version>1.1</javax-activation-version>
<javax-mail-version>1.4.1</javax-mail-version>
<javax-transaction-version>1.1.1</javax-transaction-version>
<jetty.url>http://www.eclipse.org/jetty</jetty.url>
<junit-version>4.8.1</junit-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j-version>1.6.1</slf4j-version>
<servlet.spec.groupId>org.mortbay.jetty</servlet.spec.groupId>
<servlet.spec.artifactId>servlet-api</servlet.spec.artifactId>
<servlet.spec.version>3.0.20100224</servlet.spec.version>
<jetty.url>http://www.eclipse.org/jetty</jetty.url>
<orbit-servlet-api-version>2.5.0.v201103041518</orbit-servlet-api-version>
<build-support-version>1.1</build-support-version>
<jetty.test.helper>1.6</jetty.test.helper>
<jetty.test.policy>1.2</jetty.test.policy>
<slf4j-version>1.6.1</slf4j-version>
<jetty-test-policy-version>1.2</jetty-test-policy-version>
</properties>
<scm>
<connection>scm:git:http://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project.git</connection>
@ -140,7 +133,29 @@
<versionOsgiRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireOsgiCompatibleVersionRule" />
<versionRedhatRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireRedhatCompatibleVersionRule" />
<versionDebianRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireDebianCompatibleVersionRule" />
</rules>
</configuration>
</execution>
<execution>
<id>enforce-orbit-deps</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<!-- Banned Dependencies (should use Orbit based versions now) -->
<bannedDependencies>
<includes>
<include>javax.servlet</include>
<include>org.apache.geronimo.specs</include>
<include>javax.mail</include>
<include>javax.activation</include>
</includes>
<searchTransitive>true</searchTransitive>
<message>This dependency is banned, use the ORBIT provided dependency instead.</message>
</bannedDependencies>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
@ -354,6 +369,7 @@
<module>jetty-osgi</module>
<module>jetty-nosql</module>
<module>jetty-http-spi</module>
<module>jetty-jsp</module>
<module>jetty-distribution</module>
<module>test-continuation</module>
<!--module>test-continuation-jetty6</module-->
@ -366,11 +382,81 @@
</modules>
<dependencyManagement>
<dependencies>
<!-- Orbit Deps -->
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<version>${servlet.spec.version}</version>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.annotation</artifactId>
<version>1.1.0.v201108011116</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.objectweb.asm</artifactId>
<version>3.1.0.v200803061910</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.activation</artifactId>
<version>1.1.0.v201105071233</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
<version>1.4.1.v201005082020</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.transaction</artifactId>
<version>1.1.1.v201105210645</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.security.auth.message</artifactId>
<version>1.0.0.v201108011116</version>
</dependency>
<!--
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet.jsp</artifactId>
<version>2.1.0.v201105211820</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.0.v201105211821</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.el</artifactId>
<version>2.1.0.v201105211819</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>com.sun.el</artifactId>
<version>1.0.0.v201105211818</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.apache.jasper.glassfish</artifactId>
<version>2.1.0.v201110031002</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.apache.taglibs.standard.glassfish</artifactId>
<version>1.2.0.v201112081803</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.7.1</version>
</dependency>
-->
<!-- Old Deps -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-tools-api</artifactId>
@ -379,7 +465,7 @@
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<version>${jetty.test.helper}</version>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@ -396,25 +482,10 @@
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<version>${javax-transaction-version}</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>${javax-mail-version}</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>${javax-activation-version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<version>4.8.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>

View File

@ -9,10 +9,6 @@
<artifactId>test-jetty-nested</artifactId>
<name>Jetty :: Nested Test</name>
<packaging>war</packaging>
<build>
<plugins>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>

View File

@ -42,9 +42,9 @@
<descriptors>
<descriptor>src/main/assembly/web-bundle.xml</descriptor>
</descriptors>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</execution>
</executions>
@ -63,10 +63,10 @@
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
</configuration>
<supportedProjectTypes>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
@ -77,7 +77,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.test-jetty-webapp</Bundle-SymbolicName>
<Import-Package>javax.servlet.jsp.*;version="2.2.0",javax.servlet.*;version="2.6.0",org.eclipse.jetty.servlets,*</Import-Package>
<Import-Package>javax.servlet,org.eclipse.jetty.servlets,*</Import-Package>
<Export-Package>!com.acme*</Export-Package>
<!-- the test webapp is configured via a jetty xml file
in order to add the security handler. -->
@ -162,11 +162,11 @@
<artifactId>jetty-servlets</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>

View File

@ -13,11 +13,15 @@
package org.eclipse.jetty.test.monitor;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import javax.management.MBeanServerConnection;
import org.eclipse.jetty.client.ContentExchange;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.http.HttpMethods;
@ -31,6 +35,7 @@ import org.eclipse.jetty.monitor.jmx.MonitorAction;
import org.eclipse.jetty.monitor.triggers.GreaterThanAttrEventTrigger;
import org.eclipse.jetty.monitor.triggers.LessThanOrEqualToAttrEventTrigger;
import org.eclipse.jetty.monitor.triggers.OrEventTrigger;
import org.eclipse.jetty.toolchain.jmx.JmxServiceConnection;
import org.eclipse.jetty.toolchain.test.JettyDistro;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -93,7 +98,7 @@ public class ProgramConfigTest
@Override
public void execute(EventTrigger trigger, EventState<?> state, long timestamp)
{
counter.incrementAndGet();
System.out.println(counter.incrementAndGet());
}
};
JMXMonitor.addMonitorActions(action);
@ -116,6 +121,7 @@ public class ProgramConfigTest
}
gate.await();
JMXMonitor.removeMonitorActions(action);
assertTrue(true);
}
protected static void runTest(String requestUrl, long count)

View File

@ -40,13 +40,13 @@
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${project.version}</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${servlet.spec.groupId}</groupId>
<artifactId>${servlet.spec.artifactId}</artifactId>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>