Merge remote-tracking branch 'origin/master' into servlet-3.1-api

Conflicts:
	jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannelState.java
	jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java
This commit is contained in:
Greg Wilkins 2013-06-17 16:29:39 +10:00
commit 4e4ffaa54c
140 changed files with 3570 additions and 1047 deletions

View File

@ -9,6 +9,7 @@
<groupId>org.eclipse.jetty.aggregate</groupId> <groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId> <artifactId>jetty-all</artifactId>
<name>Jetty :: Aggregate :: All core Jetty</name> <name>Jetty :: Aggregate :: All core Jetty</name>
<url>http://www.eclipse.org/jetty</url>
<build> <build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory> <sourceDirectory>${project.build.directory}/sources</sourceDirectory>
<plugins> <plugins>

View File

@ -9,6 +9,7 @@
<artifactId>example-async-rest-jar</artifactId> <artifactId>example-async-rest-jar</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Example Async Rest :: Jar</name> <name>Example Async Rest :: Jar</name>
<url>http://www.eclipse.org/jetty</url>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>

View File

@ -10,6 +10,7 @@
<artifactId>example-jetty-embedded</artifactId> <artifactId>example-jetty-embedded</artifactId>
<name>Example :: Jetty Embedded</name> <name>Example :: Jetty Embedded</name>
<description>Jetty Embedded Examples</description> <description>Jetty Embedded Examples</description>
<url>http://www.eclipse.org/jetty</url>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>

View File

@ -0,0 +1,212 @@
<?xml version="1.0"?>
<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.aggregate</groupId>
<artifactId>jetty-aggregate-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-all-server</artifactId>
<name>Jetty :: Aggregate :: All Server</name>
<url>http://www.eclipse.org/jetty</url>
<properties>
<bundle-symbolic-name>${project.groupId}.${project.artifactId}</bundle-symbolic-name>
</properties>
<build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<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>
</configuration>
</execution>
<execution>
<id>unpack-source</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<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>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Import-Package>
!org.eclipse.jetty*,
com.sun.org.apache.commons.logging;version="[2.1,3)";split="glassfish";resolution:=optional,
javax.annotation;version="1.0.0";resolution:=optional,
javax.servlet;version="2.5.0",
javax.servlet.http;version="2.5.0",
javax.mail;version="1.4.0";resolution:=optional,
javax.mail.event;version="1.4.0";resolution:=optional,
javax.mail.internet;version="1.4.0";resolution:=optional,
javax.mail.search;version="1.4.0";resolution:=optional,
javax.mail.util;version="1.4.0";resolution:=optional,
javax.transaction;version="1.1.0";resolution:=optional,
javax.transaction.xa;version="1.1.0";resolution:=optional,
org.slf4j;resolution:=optional,
org.slf4j.spi;resolution:=optional,
org.slf4j.helpers;resolution:=optional,
org.xml.sax,
org.xml.sax.helpers,
javax.security.cert,
javax.xml.parsers,
javax.net.ssl,
!org.mortbay.*,
org.objectweb.asm;version="3.1.0";resolution:=optional,
org.objectweb.asm.commons;version="3.1.0";resolution:=optional,
javax.security.auth.message*;resolution:=optional,
*
</Import-Package>
<Export-Package>org.eclipse.jetty*;version="${parsedVersion.osgiVersion}"</Export-Package>
<!-- disable the uses directive: jetty will accomodate pretty much any versions
of the packages it uses; no need to reflect some tight dependency determined at
compilation time. -->
<_nouses>true</_nouses>
<Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</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>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ajp</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaspi</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jndi</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-rewrite</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-nested</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.security.auth.message</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.activation</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.annotation</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,87 @@
<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.aggregate</groupId>
<artifactId>jetty-aggregate-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-client</artifactId>
<name>Jetty :: Aggregate :: HTTP Client</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includes>META-INF/**,org/eclipse/**</includes>
<excludes>**/MANIFEST.MF</excludes>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
<execution>
<id>unpack-source</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<includes>**/*</includes>
<excludes>META-INF/**</excludes>
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>http://eclipse.org/jetty</url>
<Built-By>${user.name}</Built-By>
<package>org.eclipse.jetty</package>
<Bundle-License>http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/NOTICE.txt</Bundle-License>
<Bundle-Name>Jetty HTTP Client</Bundle-Name>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,97 @@
<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.aggregate</groupId>
<artifactId>jetty-aggregate-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-server</artifactId>
<name>Jetty :: Aggregate :: HTTP Server</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<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>
</configuration>
</execution>
<execution>
<id>unpack-source</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<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>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins
</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>http://eclipse.org/jetty</url>
<Built-By>${user.name}</Built-By>
<package>org.eclipse.jetty</package>
<Bundle-License>http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/NOTICE.txt</Bundle-License>
<Bundle-Name>Jetty HTTP Server</Bundle-Name>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,96 @@
<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.aggregate</groupId>
<artifactId>jetty-aggregate-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-servlet</artifactId>
<name>Jetty :: Aggregate :: Servlet Server</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<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>
</configuration>
</execution>
<execution>
<id>unpack-source</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<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>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>http://eclipse.org/jetty</url>
<Built-By>${user.name}</Built-By>
<package>org.eclipse.jetty</package>
<Bundle-License>http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/NOTICE.txt</Bundle-License>
<Bundle-Name>Jetty HTTP Server</Bundle-Name>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,103 @@
<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.aggregate</groupId>
<artifactId>jetty-aggregate-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-webapp</artifactId>
<name>Jetty :: Aggregate :: WebApp Server</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<goals>
<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>
</configuration>
</execution>
<execution>
<id>unpack-source</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<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>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins
</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>http://eclipse.org/jetty</url>
<Built-By>${user.name}</Built-By>
<package>org.eclipse.jetty</package>
<Bundle-License>http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/NOTICE.txt</Bundle-License>
<Bundle-Name>Jetty HTTP Server</Bundle-Name>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,91 @@
<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.aggregate</groupId>
<artifactId>jetty-aggregate-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-websocket</artifactId>
<name>Jetty :: Aggregate :: Websocket</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludes>**/MANIFEST.MF,javax/**,about.html</excludes>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
<execution>
<id>unpack-source</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<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>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins
</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>http://eclipse.org/jetty</url>
<Built-By>${user.name}</Built-By>
<package>org.eclipse.jetty</package>
<Bundle-License>http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/NOTICE.txt</Bundle-License>
<Bundle-Name>Jetty HTTP Server</Bundle-Name>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

44
jetty-aggregate/pom.xml Normal file
View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-aggregate-project</artifactId>
<name>Jetty :: Aggregate Project</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<!-- No Point running PMD on aggregate projects -->
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<!-- No Point running Findbugs on aggregate projects -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>jetty-server</module>
<module>jetty-client</module>
<module>jetty-servlet</module>
<module>jetty-webapp</module>
<module>jetty-websocket</module>
<module>jetty-plus</module>
<module>jetty-all-server</module>
<module>jetty-all</module>
</modules>
</project>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-annotations</artifactId> <artifactId>jetty-annotations</artifactId>
<name>Jetty :: Servlet Annotations</name> <name>Jetty :: Servlet Annotations</name>
<description>Annotation support for deploying servlets in jetty.</description> <description>Annotation support for deploying servlets in jetty.</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.annotations</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.annotations</bundle-symbolic-name>
</properties> </properties>

View File

@ -30,6 +30,7 @@ import java.security.CodeSource;
import java.security.PermissionCollection; import java.security.PermissionCollection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.EventListener;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -50,9 +51,12 @@ import org.eclipse.jetty.ant.utils.TaskLog;
import org.eclipse.jetty.plus.webapp.EnvConfiguration; import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.plus.webapp.PlusConfiguration; import org.eclipse.jetty.plus.webapp.PlusConfiguration;
import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.FilterMapping;
import org.eclipse.jetty.servlet.Holder; import org.eclipse.jetty.servlet.Holder;
import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.ServletMapping;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.Resource;
@ -676,6 +680,13 @@ public class AntWebAppContext extends WebAppContext
TaskLog.logWithTimestamp("Stopping web application "+this); TaskLog.logWithTimestamp("Stopping web application "+this);
Thread.currentThread().sleep(500L); Thread.currentThread().sleep(500L);
super.doStop(); super.doStop();
//remove all filters, servlets and listeners. They will be recreated
//either via application of a context xml file or web.xml or annotation or servlet api
setEventListeners(new EventListener[0]);
getServletHandler().setFilters(new FilterHolder[0]);
getServletHandler().setFilterMappings(new FilterMapping[0]);
getServletHandler().setServlets(new ServletHolder[0]);
getServletHandler().setServletMappings(new ServletMapping[0]);
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {

View File

@ -8,13 +8,11 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-client</artifactId> <artifactId>jetty-client</artifactId>
<name>Jetty :: Asynchronous HTTP Client</name> <name>Jetty :: Asynchronous HTTP Client</name>
<url>{$jetty.url}</url> <url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.client</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.client</bundle-symbolic-name>
<jetty.test.policy.loc>target/test-policy</jetty.test.policy.loc> <jetty.test.policy.loc>target/test-policy</jetty.test.policy.loc>
</properties> </properties>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-continuation</artifactId> <artifactId>jetty-continuation</artifactId>
<name>Jetty :: Continuation</name> <name>Jetty :: Continuation</name>
<description>Asynchronous API</description> <description>Asynchronous API</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.continuation</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.continuation</bundle-symbolic-name>
</properties> </properties>

View File

@ -166,7 +166,17 @@ public class Servlet3Continuation implements Continuation
@Override @Override
public boolean isSuspended() public boolean isSuspended()
{ {
return _request.isAsyncStarted(); if (_request.isAsyncStarted())
return true;
try
{
return _request.getAsyncContext()!=null;
}
catch(IllegalStateException e)
{
// ignored
}
return false;
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -8,6 +8,7 @@
<artifactId>jetty-deploy</artifactId> <artifactId>jetty-deploy</artifactId>
<name>Jetty :: Deployers</name> <name>Jetty :: Deployers</name>
<description>Jetty deployers</description> <description>Jetty deployers</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.deploy</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.deploy</bundle-symbolic-name>
</properties> </properties>

View File

@ -7,6 +7,7 @@
</parent> </parent>
<artifactId>jetty-distribution</artifactId> <artifactId>jetty-distribution</artifactId>
<name>Jetty :: Distribution Assemblies</name> <name>Jetty :: Distribution Assemblies</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<assembly-directory>target/distribution</assembly-directory> <assembly-directory>target/distribution</assembly-directory>

View File

@ -371,7 +371,7 @@ fi
##################################################### #####################################################
if [ "$JETTY_PORT" ] if [ "$JETTY_PORT" ]
then then
JAVA_OPTIONS+=("-Djetty.port=$JETTY_PORT") JETTY_ARGS+=("jetty.port=$JETTY_PORT")
fi fi
##################################################### #####################################################

View File

@ -7,6 +7,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-http-spi</artifactId> <artifactId>jetty-http-spi</artifactId>
<name>Jetty :: Http Service Provider Interface</name> <name>Jetty :: Http Service Provider Interface</name>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.http.spi</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.http.spi</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,6 +8,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-http</artifactId> <artifactId>jetty-http</artifactId>
<name>Jetty :: Http Utility</name> <name>Jetty :: Http Utility</name>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.http</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.http</bundle-symbolic-name>
</properties> </properties>

View File

@ -7,6 +7,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-io</artifactId> <artifactId>jetty-io</artifactId>
<name>Jetty :: IO Utility</name> <name>Jetty :: IO Utility</name>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.io</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.io</bundle-symbolic-name>
</properties> </properties>

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.nio.channels.ClosedChannelException; import java.nio.channels.ClosedChannelException;
import java.nio.channels.ReadPendingException; import java.nio.channels.ReadPendingException;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Callback;
@ -34,8 +35,7 @@ import org.eclipse.jetty.util.Callback;
*/ */
public abstract class FillInterest public abstract class FillInterest
{ {
private final AtomicBoolean _interested = new AtomicBoolean(false); private final AtomicReference<Callback> _interested = new AtomicReference<>(null);
private volatile Callback _callback;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected FillInterest() protected FillInterest()
@ -52,9 +52,11 @@ public abstract class FillInterest
*/ */
public <C> void register(Callback callback) throws ReadPendingException public <C> void register(Callback callback) throws ReadPendingException
{ {
if (!_interested.compareAndSet(false,true)) if (callback==null)
throw new IllegalArgumentException();
if (!_interested.compareAndSet(null,callback))
throw new ReadPendingException(); throw new ReadPendingException();
_callback=callback;
try try
{ {
if (needsFill()) if (needsFill())
@ -71,13 +73,10 @@ public abstract class FillInterest
*/ */
public void fillable() public void fillable()
{ {
if (_interested.compareAndSet(true,false)) Callback callback=_interested.get();
{ if (callback!=null && _interested.compareAndSet(callback,null))
Callback callback=_callback;
_callback=null;
callback.succeeded(); callback.succeeded();
} }
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
@ -85,7 +84,7 @@ public abstract class FillInterest
*/ */
public boolean isInterested() public boolean isInterested()
{ {
return _interested.get(); return _interested.get()!=null;
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -93,30 +92,24 @@ public abstract class FillInterest
*/ */
public void onFail(Throwable cause) public void onFail(Throwable cause)
{ {
if (_interested.compareAndSet(true,false)) Callback callback=_interested.get();
{ if (callback!=null && _interested.compareAndSet(callback,null))
Callback callback=_callback;
_callback=null;
callback.failed(cause); callback.failed(cause);
} }
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public void onClose() public void onClose()
{ {
if (_interested.compareAndSet(true,false)) Callback callback=_interested.get();
{ if (callback!=null && _interested.compareAndSet(callback,null))
Callback callback=_callback;
_callback=null;
callback.failed(new ClosedChannelException()); callback.failed(new ClosedChannelException());
} }
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@Override @Override
public String toString() public String toString()
{ {
return String.format("FillInterest@%x{%b,%s}",hashCode(),_interested.get(),_callback); return String.format("FillInterest@%x{%b,%s}",hashCode(),_interested.get(),_interested.get());
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -8,6 +8,7 @@
<artifactId>jetty-jaspi</artifactId> <artifactId>jetty-jaspi</artifactId>
<name>Jetty :: JASPI Security</name> <name>Jetty :: JASPI Security</name>
<description>Jetty security infrastructure</description> <description>Jetty security infrastructure</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.jaspi</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.jaspi</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-jmx</artifactId> <artifactId>jetty-jmx</artifactId>
<name>Jetty :: JMX Management</name> <name>Jetty :: JMX Management</name>
<description>JMX management artifact for jetty.</description> <description>JMX management artifact for jetty.</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.jmx</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.jmx</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-jndi</artifactId> <artifactId>jetty-jndi</artifactId>
<name>Jetty :: JNDI Naming</name> <name>Jetty :: JNDI Naming</name>
<description>JNDI spi impl for java namespace.</description> <description>JNDI spi impl for java namespace.</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.jndi</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.jndi</bundle-symbolic-name>
</properties> </properties>

View File

@ -7,6 +7,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-jsp</artifactId> <artifactId>jetty-jsp</artifactId>
<name>Jetty :: JSP dependencies</name> <name>Jetty :: JSP dependencies</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>
</build> </build>

View File

@ -22,6 +22,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EventListener;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -29,6 +30,10 @@ import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import org.eclipse.jetty.plus.webapp.EnvConfiguration; import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.FilterMapping;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.ServletMapping;
import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
@ -296,6 +301,14 @@ public class JettyWebAppContext extends WebAppContext
//just wait a little while to ensure no requests are still being processed //just wait a little while to ensure no requests are still being processed
Thread.currentThread().sleep(500L); Thread.currentThread().sleep(500L);
super.doStop(); super.doStop();
//remove all listeners, servlets and filters. This is because we will re-apply
//any context xml file, which means they would potentially be added multiple times.
setEventListeners(new EventListener[0]);
getServletHandler().setFilters(new FilterHolder[0]);
getServletHandler().setFilterMappings(new FilterMapping[0]);
getServletHandler().setServlets(new ServletHolder[0]);
getServletHandler().setServletMappings(new ServletMapping[0]);
} }
@Override @Override

View File

@ -24,6 +24,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-monitor</artifactId> <artifactId>jetty-monitor</artifactId>
<name>Jetty :: Monitoring</name> <name>Jetty :: Monitoring</name>
<url>http://www.eclipse.org/jetty</url>
<description>Performance monitoring artifact for jetty.</description> <description>Performance monitoring artifact for jetty.</description>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.monitor</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.monitor</bundle-symbolic-name>

View File

@ -7,6 +7,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-nosql</artifactId> <artifactId>jetty-nosql</artifactId>
<name>Jetty :: NoSQL Session Managers</name> <name>Jetty :: NoSQL Session Managers</name>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.nosql</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.nosql</bundle-symbolic-name>
</properties> </properties>

View File

@ -40,6 +40,7 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme
private int _savePeriod=0; private int _savePeriod=0;
private int _idlePeriod=-1; private int _idlePeriod=-1;
private boolean _invalidateOnStop; private boolean _invalidateOnStop;
private boolean _preserveOnStop;
private boolean _saveAllAttributes; private boolean _saveAllAttributes;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -104,9 +105,12 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme
for (NoSqlSession session : sessions) for (NoSqlSession session : sessions)
{ {
session.save(false); session.save(false);
if (!_preserveOnStop) {
removeSession(session,false); removeSession(session,false);
} }
} }
}
else else
{ {
for (NoSqlSession session : sessions) for (NoSqlSession session : sessions)
@ -277,6 +281,16 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme
return _invalidateOnStop; return _invalidateOnStop;
} }
/* ------------------------------------------------------------ */
/**
* Preserve sessions when the session manager is stopped otherwise remove them from the DB.
* @return the removeOnStop
*/
public boolean isPreserveOnStop()
{
return _preserveOnStop;
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Invalidate sessions when the session manager is stopped otherwise save them to the DB. * Invalidate sessions when the session manager is stopped otherwise save them to the DB.
@ -287,6 +301,16 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme
_invalidateOnStop = invalidateOnStop; _invalidateOnStop = invalidateOnStop;
} }
/* ------------------------------------------------------------ */
/**
* Preserve sessions when the session manager is stopped otherwise remove them from the DB.
* @param removeOnStop the removeOnStop to set
*/
public void setPreserveOnStop(boolean preserveOnStop)
{
_preserveOnStop = preserveOnStop;
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Save all attributes of a session or only update the dirty attributes. * Save all attributes of a session or only update the dirty attributes.

View File

@ -137,6 +137,9 @@ public class MongoSessionManager extends NoSqlSessionManager
BasicDBObject sets = new BasicDBObject(); BasicDBObject sets = new BasicDBObject();
BasicDBObject unsets = new BasicDBObject(); BasicDBObject unsets = new BasicDBObject();
// handle valid or invalid
if (session.isValid())
{
// handle new or existing // handle new or existing
if (version == null) if (version == null)
{ {
@ -153,9 +156,6 @@ public class MongoSessionManager extends NoSqlSessionManager
update.put("$inc",__version_1); update.put("$inc",__version_1);
} }
// handle valid or invalid
if (session.isValid())
{
sets.put(__ACCESSED,session.getAccessed()); sets.put(__ACCESSED,session.getAccessed());
Set<String> names = session.takeDirty(); Set<String> names = session.takeDirty();
if (isSaveAllAttributes() || upsert) if (isSaveAllAttributes() || upsert)
@ -253,6 +253,7 @@ public class MongoSessionManager extends NoSqlSessionManager
DBObject attrs = (DBObject)getNestedValue(o,getContextKey()); DBObject attrs = (DBObject)getNestedValue(o,getContextKey());
if (attrs != null) if (attrs != null)
{ {
for (String name : attrs.keySet()) for (String name : attrs.keySet())
@ -286,6 +287,22 @@ public class MongoSessionManager extends NoSqlSessionManager
} }
} }
/*
* We are refreshing so we should update the last accessed time.
*/
BasicDBObject key = new BasicDBObject(__ID,session.getClusterId());
BasicDBObject sets = new BasicDBObject();
// Form updates
BasicDBObject update = new BasicDBObject();
sets.put(__ACCESSED,System.currentTimeMillis());
// Do the upsert
if (!sets.isEmpty())
{
update.put("$set",sets);
}
_sessions.update(key,update,false,false);
session.didActivate(); session.didActivate();
return version; return version;

View File

@ -8,6 +8,7 @@
<artifactId>jetty-osgi-boot-jsp</artifactId> <artifactId>jetty-osgi-boot-jsp</artifactId>
<name>Jetty :: OSGi :: Boot JSP</name> <name>Jetty :: OSGi :: Boot JSP</name>
<description>Jetty OSGi Boot JSP bundle</description> <description>Jetty OSGi Boot JSP bundle</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.boot.jsp</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.boot.jsp</bundle-symbolic-name>
</properties> </properties>

View File

@ -0,0 +1,127 @@
<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.osgi</groupId>
<artifactId>jetty-osgi-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-osgi-boot-logback</artifactId>
<name>Jetty :: OSGi :: Boot Logback</name>
<description>Jetty OSGi Boot Logback bundle</description>
<url>http://www.eclipse.org/jetty</url>
<properties>
<bundle-symbolic-name>${project.groupId}.boot.logback</bundle-symbolic-name>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-boot</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>artifact-jar</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.osgi.boot.logback;singleton:=true</Bundle-SymbolicName>
<Bundle-Name>Jetty-OSGi-Logback Integration</Bundle-Name>
<Fragment-Host>org.eclipse.jetty.osgi.boot</Fragment-Host>
<Import-Package>
ch.qos.logback.access.jetty;version="[0.9,1.1)";resolution:=optional,
ch.qos.logback.access.jetty.v7;version="[0.9,1.1)";resolution:=optional,
ch.qos.logback.*;version="[0.9,1.1)",
org.osgi.framework.*,
org.slf4j.*,
*;resolution:=optional
</Import-Package>
<Export-Package>
!org.eclipse.jetty.osgi.boot.logback.internal.*,
org.eclipse.jetty.osgi.boot.logback.*;version="${parsedVersion.osgiVersion}"
</Export-Package>
<_nouses>true</_nouses>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<onlyAnalyze>org.eclipse.jetty.osgi.boot.logback.*</onlyAnalyze>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -9,6 +9,7 @@
<artifactId>jetty-osgi-boot-warurl</artifactId> <artifactId>jetty-osgi-boot-warurl</artifactId>
<name>Jetty :: OSGi :: Boot :: Warurl</name> <name>Jetty :: OSGi :: Boot :: Warurl</name>
<description>Jetty OSGi Boot-Warurl bundle</description> <description>Jetty OSGi Boot-Warurl bundle</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.boot.warurl</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.boot.warurl</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-osgi-boot</artifactId> <artifactId>jetty-osgi-boot</artifactId>
<name>Jetty :: OSGi :: Boot</name> <name>Jetty :: OSGi :: Boot</name>
<description>Jetty OSGi Boot bundle</description> <description>Jetty OSGi Boot bundle</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.boot</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.boot</bundle-symbolic-name>
</properties> </properties>

View File

@ -272,8 +272,13 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
if (tmp != null) if (tmp != null)
{ {
File defaultWebXml = getFile (tmp, bundleInstallLocation); File defaultWebXml = getFile (tmp, bundleInstallLocation);
if (defaultWebXml != null && defaultWebXml.exists()) if (defaultWebXml != null)
{
if (defaultWebXml.exists())
_webApp.setDefaultsDescriptor(defaultWebXml.getAbsolutePath()); _webApp.setDefaultsDescriptor(defaultWebXml.getAbsolutePath());
else
LOG.warn(defaultWebXml.getAbsolutePath()+" does not exist");
}
} }
//Handle Require-TldBundle //Handle Require-TldBundle
@ -377,6 +382,7 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
HashMap properties = new HashMap(); HashMap properties = new HashMap();
properties.put("Server", getDeploymentManager().getServer()); properties.put("Server", getDeploymentManager().getServer());
properties.put(OSGiWebappConstants.JETTY_BUNDLE_ROOT, rootResource.toString()); properties.put(OSGiWebappConstants.JETTY_BUNDLE_ROOT, rootResource.toString());
properties.put(OSGiServerConstants.JETTY_HOME, getDeploymentManager().getServer().getAttribute(OSGiServerConstants.JETTY_HOME));
xmlConfiguration.getProperties().putAll(properties); xmlConfiguration.getProperties().putAll(properties);
xmlConfiguration.configure(_webApp); xmlConfiguration.configure(_webApp);
} }
@ -391,10 +397,20 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
if (file == null) if (file == null)
return null; return null;
if (file.startsWith("/") || file.startsWith("file:/")) if (file.startsWith("/") || file.startsWith("file:/")) //absolute location
return new File(file); return new File(file);
else else
return new File(bundleInstall, file); {
//relative location
//try inside the bundle first
File f = new File (bundleInstall, file);
if (f.exists()) return f;
String jettyHome = (String)getDeploymentManager().getServer().getAttribute(OSGiServerConstants.JETTY_HOME);
if (jettyHome != null)
return new File(jettyHome, file);
}
return null;
} }
} }

View File

@ -0,0 +1,121 @@
<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.osgi</groupId>
<artifactId>jetty-osgi-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-osgi-equinoxtools</artifactId>
<name>Jetty :: OSGi :: Example Equinox Tools</name>
<description>Jetty OSGi Example Equinox Tools</description>
<url>http://www.eclipse.org/jetty</url>
<properties>
<bundle-symbolic-name>${project.groupId}.equinoxtools</bundle-symbolic-name>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-continuation</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<copy todir="target/classes/equinoxconsole">
<fileset dir="equinoxconsole" />
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>artifact-jar</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.osgi.equinoxtools</Bundle-SymbolicName>
<Bundle-Name>Console</Bundle-Name>
<Bundle-Activator>org.eclipse.jetty.osgi.equinoxtools.WebEquinoxToolsActivator</Bundle-Activator>
<Export-Package>org.eclipse.jetty.osgi.equinoxtools;x-internal:=true;version="${parsedVersion.osgiVersion}",
org.eclipse.jetty.osgi.equinoxtools.console;x-internal:=true;version="${parsedVersion.osgiVersion}"
</Export-Package>
<_nouses>true</_nouses>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<onlyAnalyze>org.eclipse.jetty.osgi.equinoxtools.*</onlyAnalyze>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-httpservice</artifactId> <artifactId>jetty-httpservice</artifactId>
<name>Jetty :: OSGi :: HttpService</name> <name>Jetty :: OSGi :: HttpService</name>
<description>Jetty OSGi HttpService bundle</description> <description>Jetty OSGi HttpService bundle</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.httpservice</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.httpservice</bundle-symbolic-name>
</properties> </properties>

View File

@ -0,0 +1,54 @@
<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.osgi</groupId>
<artifactId>jetty-osgi-project</artifactId>
<version>7.6.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-servletbridge</artifactId>
<name>Jetty :: OSGi :: Servletbridge</name>
<description>Jetty OSGi Servletbridge webapp</description>
<url>http://www.eclipse.org/jetty</url>
<packaging>war</packaging>
<properties><eclipse.pde>false</eclipse.pde></properties>
<dependencies>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.servletbridge</artifactId>
<version>1.2.0.v20100503</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.6.0.v20100517</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<!-- can't find equinox servlet bridge jar on maven central.
uploaded it to intalio.org for now. -->
<repository>
<id>intalio-org</id>
<url>http://intalio.org/public/maven2</url>
</repository>
</repositories>
<build>
<plugins><plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<pde>false</pde>
</configuration>
</plugin></plugins>
</build>
</project>

View File

@ -8,6 +8,7 @@
<groupId>org.eclipse.jetty.osgi</groupId> <groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-project</artifactId> <artifactId>jetty-osgi-project</artifactId>
<name>Jetty :: OSGi</name> <name>Jetty :: OSGi</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<osgi-version>3.6.0.v20100517</osgi-version> <osgi-version>3.6.0.v20100517</osgi-version>

View File

@ -8,6 +8,7 @@
<artifactId>test-jetty-osgi-context</artifactId> <artifactId>test-jetty-osgi-context</artifactId>
<name>Jetty :: OSGi :: Context</name> <name>Jetty :: OSGi :: Context</name>
<description>Test Jetty OSGi bundle with a ContextHandler</description> <description>Test Jetty OSGi bundle with a ContextHandler</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.testcontext</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.testcontext</bundle-symbolic-name>
</properties> </properties>

View File

@ -9,6 +9,7 @@
<artifactId>test-jetty-osgi-webapp</artifactId> <artifactId>test-jetty-osgi-webapp</artifactId>
<name>Jetty :: OSGi :: WebApp</name> <name>Jetty :: OSGi :: WebApp</name>
<description>Test Jetty OSGi Webapp bundle</description> <description>Test Jetty OSGi Webapp bundle</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.webapp</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.webapp</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,7 +8,8 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>test-jetty-osgi</artifactId> <artifactId>test-jetty-osgi</artifactId>
<name>Jetty :: OSGi :: Test</name> <name>Jetty :: OSGi :: Test</name>
<description>Jetty OSGi Integration tests</description> <description>Jetty OSGi Integration test</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.boot.test.spdy</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.boot.test.spdy</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>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-overlay-deployer</artifactId> <artifactId>jetty-overlay-deployer</artifactId>
<name>Jetty :: Overlay Deployer</name> <name>Jetty :: Overlay Deployer</name>
<description>Overlayed deployer</description> <description>Overlayed deployer</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
</properties> </properties>
<build> <build>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-plus</artifactId> <artifactId>jetty-plus</artifactId>
<name>Jetty :: Plus</name> <name>Jetty :: Plus</name>
<description>Jetty JavaEE style services</description> <description>Jetty JavaEE style services</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.plus</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.plus</bundle-symbolic-name>
</properties> </properties>

139
jetty-policy/pom.xml Normal file
View File

@ -0,0 +1,139 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<artifactId>jetty-policy</artifactId>
<name>Jetty :: Policy Tool</name>
<packaging>jar</packaging>
<url>http://www.eclipse.org/jetty</url>
<properties>
<jetty.test.policy.loc>target/test-policy</jetty.test.policy.loc>
<bundle-symbolic-name>${project.groupId}.policy</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.policy.*;version="${parsedVersion.osgiVersion}"</Export-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!--
Required for OSGI
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-policy</artifactId>
<version>${jetty-test-policy-version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<includes>**/*.keystore</includes>
<outputDirectory>${jetty.test.policy.loc}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-policy</artifactId>
<version>${jetty-test-policy-version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<includes>**</includes>
<outputDirectory>${jetty.test.policy.loc}</outputDirectory>
<destFileName>jetty-test-policy.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<onlyAnalyze>org.eclipse.jetty.policy.*</onlyAnalyze>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-proxy</artifactId> <artifactId>jetty-proxy</artifactId>
<name>Jetty :: Proxy</name> <name>Jetty :: Proxy</name>
<description>Jetty Proxy</description> <description>Jetty Proxy</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.proxy</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.proxy</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-rewrite</artifactId> <artifactId>jetty-rewrite</artifactId>
<name>Jetty :: Rewrite Handler</name> <name>Jetty :: Rewrite Handler</name>
<description>Jetty Rewrite Handler</description> <description>Jetty Rewrite Handler</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.rewrite</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.rewrite</bundle-symbolic-name>
</properties> </properties>

View File

@ -12,7 +12,7 @@
<properties> <properties>
<assembly-directory>target/distribution</assembly-directory> <assembly-directory>target/distribution</assembly-directory>
</properties> </properties>
<url>http://www.eclipse.org/jetty</url>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-security</artifactId> <artifactId>jetty-security</artifactId>
<name>Jetty :: Security</name> <name>Jetty :: Security</name>
<description>Jetty security infrastructure</description> <description>Jetty security infrastructure</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.security</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.security</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-server</artifactId> <artifactId>jetty-server</artifactId>
<name>Jetty :: Server Core</name> <name>Jetty :: Server Core</name>
<description>The core jetty server artifact.</description> <description>The core jetty server artifact.</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.server</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.server</bundle-symbolic-name>
</properties> </properties>

View File

@ -450,13 +450,22 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable
LOG.ignore(e); LOG.ignore(e);
path = _uri.getDecodedPath(StringUtil.__ISO_8859_1); path = _uri.getDecodedPath(StringUtil.__ISO_8859_1);
} }
String info = URIUtil.canonicalPath(path); String info = URIUtil.canonicalPath(path);
if (info == null) if (info == null)
{
if( path==null && _uri.getScheme()!=null &&_uri.getHost()!=null)
{ {
info = "/"; info = "/";
_request.setRequestURI(""); _request.setRequestURI("");
} }
else
{
badMessage(400,null);
return true;
}
}
_request.setPathInfo(info); _request.setPathInfo(info);
_version = version == null ? HttpVersion.HTTP_0_9 : version; _version = version == null ? HttpVersion.HTTP_0_9 : version;
_request.setHttpVersion(_version); _request.setHttpVersion(_version);
@ -680,7 +689,6 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable
* @param content the content buffer to write * @param content the content buffer to write
* @param complete whether the content is complete for the response * @param complete whether the content is complete for the response
* @param callback Callback when complete or failed * @param callback Callback when complete or failed
* @throws IOException if the write fails
*/ */
protected void write(ByteBuffer content, boolean complete, Callback callback) protected void write(ByteBuffer content, boolean complete, Callback callback)
{ {
@ -706,6 +714,14 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable
return getEndPoint() instanceof ChannelEndPoint; return getEndPoint() instanceof ChannelEndPoint;
} }
/**
* If a write or similar to this channel fails this method should be called. The standard implementation
* of {@link #failed()} is a noop. But the different implementations of HttpChannel might want to take actions.
*/
public void failed()
{
}
private class CommitCallback implements Callback private class CommitCallback implements Callback
{ {
private final Callback _callback; private final Callback _callback;

View File

@ -578,6 +578,12 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
_generator.setPersistent(false); _generator.setPersistent(false);
super.handleException(x); super.handleException(x);
} }
@Override
public void failed()
{
getEndPoint().shutdownOutput();
}
} }
private class CommitCallback extends IteratingNestedCallback private class CommitCallback extends IteratingNestedCallback

View File

@ -24,7 +24,6 @@ import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritePendingException; import java.nio.channels.WritePendingException;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import javax.servlet.RequestDispatcher; import javax.servlet.RequestDispatcher;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
@ -33,6 +32,7 @@ import javax.servlet.WriteListener;
import org.eclipse.jetty.http.HttpContent; import org.eclipse.jetty.http.HttpContent;
import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.util.BlockingCallback; import org.eclipse.jetty.util.BlockingCallback;
import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Callback;
@ -125,7 +125,7 @@ write completed - - - ASYNC READY->owp
} }
catch(IOException e) catch(IOException e)
{ {
_channel.getEndPoint().shutdownOutput(); _channel.failed();
LOG.ignore(e); LOG.ignore(e);
} }
releaseBuffer(); releaseBuffer();
@ -149,7 +149,7 @@ write completed - - - ASYNC READY->owp
} }
catch(IOException e) catch(IOException e)
{ {
_channel.getEndPoint().shutdownOutput(); _channel.failed();
LOG.ignore(e); LOG.ignore(e);
} }
releaseBuffer(); releaseBuffer();

View File

@ -19,6 +19,7 @@
package org.eclipse.jetty.server; package org.eclipse.jetty.server;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -73,6 +74,7 @@ import org.eclipse.jetty.server.handler.ContextHandler.Context;
import org.eclipse.jetty.server.session.AbstractSession; import org.eclipse.jetty.server.session.AbstractSession;
import org.eclipse.jetty.util.Attributes; import org.eclipse.jetty.util.Attributes;
import org.eclipse.jetty.util.AttributesMap; import org.eclipse.jetty.util.AttributesMap;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.MultiException; import org.eclipse.jetty.util.MultiException;
import org.eclipse.jetty.util.MultiMap; import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.MultiPartInputStreamParser; import org.eclipse.jetty.util.MultiPartInputStreamParser;
@ -350,6 +352,7 @@ public class Request implements HttpServletRequest
} }
} }
} }
} }
if (_parameters == null) if (_parameters == null)
@ -359,6 +362,28 @@ public class Request implements HttpServletRequest
// Merge parameters (needed if parameters extracted after a forward). // Merge parameters (needed if parameters extracted after a forward).
_parameters.addAllValues(_baseParameters); _parameters.addAllValues(_baseParameters);
} }
if (content_type != null && content_type.length()>0 && content_type.startsWith("multipart/form-data") && getAttribute(__MULTIPART_CONFIG_ELEMENT)!=null)
{
try
{
getParts();
}
catch (IOException e)
{
if (LOG.isDebugEnabled())
LOG.warn(e);
else
LOG.warn(e.toString());
}
catch (ServletException e)
{
if (LOG.isDebugEnabled())
LOG.warn(e);
else
LOG.warn(e.toString());
}
}
} }
finally finally
{ {
@ -2021,38 +2046,8 @@ public class Request implements HttpServletRequest
@Override @Override
public Part getPart(String name) throws IOException, ServletException public Part getPart(String name) throws IOException, ServletException
{ {
if (getContentType() == null || !getContentType().startsWith("multipart/form-data")) getParts();
throw new ServletException("Content-Type != multipart/form-data");
if (_multiPartInputStream == null)
{
MultipartConfigElement config = (MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT);
if (config == null)
throw new IllegalStateException("No multipart config for servlet");
_multiPartInputStream = new MultiPartInputStreamParser(getInputStream(),
getContentType(),config,
(_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null));
setAttribute(__MULTIPART_INPUT_STREAM, _multiPartInputStream);
setAttribute(__MULTIPART_CONTEXT, _context);
Collection<Part> parts = _multiPartInputStream.getParts(); //causes parsing
for (Part p:parts)
{
MultiPartInputStreamParser.MultiPart mp = (MultiPartInputStreamParser.MultiPart)p;
if (mp.getContentDispositionFilename() == null && mp.getFile() == null)
{
//Servlet Spec 3.0 pg 23, parts without filenames must be put into init params
String charset = null;
if (mp.getContentType() != null)
charset = MimeTypes.getCharsetFromContentType(mp.getContentType());
String content=new String(mp.getBytes(),charset==null?StringUtil.__UTF8:charset);
getParameter(""); //cause params to be evaluated
getParameters().add(mp.getName(), content);
}
}
}
return _multiPartInputStream.getPart(name); return _multiPartInputStream.getPart(name);
} }
@ -2063,6 +2058,9 @@ public class Request implements HttpServletRequest
if (getContentType() == null || !getContentType().startsWith("multipart/form-data")) if (getContentType() == null || !getContentType().startsWith("multipart/form-data"))
throw new ServletException("Content-Type != multipart/form-data"); throw new ServletException("Content-Type != multipart/form-data");
if (_multiPartInputStream == null)
_multiPartInputStream = (MultiPartInputStreamParser)getAttribute(__MULTIPART_INPUT_STREAM);
if (_multiPartInputStream == null) if (_multiPartInputStream == null)
{ {
MultipartConfigElement config = (MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT); MultipartConfigElement config = (MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT);
@ -2080,19 +2078,32 @@ public class Request implements HttpServletRequest
for (Part p:parts) for (Part p:parts)
{ {
MultiPartInputStreamParser.MultiPart mp = (MultiPartInputStreamParser.MultiPart)p; MultiPartInputStreamParser.MultiPart mp = (MultiPartInputStreamParser.MultiPart)p;
if (mp.getContentDispositionFilename() == null && mp.getFile() == null) if (mp.getContentDispositionFilename() == null)
{ {
//Servlet Spec 3.0 pg 23, parts without filenames must be put into init params //Servlet Spec 3.0 pg 23, parts without filenames must be put into init params
String charset = null; String charset = null;
if (mp.getContentType() != null) if (mp.getContentType() != null)
charset = MimeTypes.getCharsetFromContentType(mp.getContentType()); charset = MimeTypes.getCharsetFromContentType(mp.getContentType());
String content=new String(mp.getBytes(),charset==null?StringUtil.__UTF8:charset); ByteArrayOutputStream os = null;
InputStream is = mp.getInputStream(); //get the bytes regardless of being in memory or in temp file
try
{
os = new ByteArrayOutputStream();
IO.copy(is, os);
String content=new String(os.toByteArray(),charset==null?StringUtil.__UTF8:charset);
getParameter(""); //cause params to be evaluated getParameter(""); //cause params to be evaluated
getParameters().add(mp.getName(), content); getParameters().add(mp.getName(), content);
} }
finally
{
IO.close(os);
IO.close(is);
} }
} }
}
}
return _multiPartInputStream.getParts(); return _multiPartInputStream.getParts();
} }

View File

@ -169,6 +169,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
private final List<ServletContextAttributeListener> _contextAttributeListeners=new CopyOnWriteArrayList<>(); private final List<ServletContextAttributeListener> _contextAttributeListeners=new CopyOnWriteArrayList<>();
private final List<ServletRequestListener> _requestListeners=new CopyOnWriteArrayList<>(); private final List<ServletRequestListener> _requestListeners=new CopyOnWriteArrayList<>();
private final List<ServletRequestAttributeListener> _requestAttributeListeners=new CopyOnWriteArrayList<>(); private final List<ServletRequestAttributeListener> _requestAttributeListeners=new CopyOnWriteArrayList<>();
private final List<EventListener> _durableListeners = new CopyOnWriteArrayList<>();
private Map<String, Object> _managedAttributes; private Map<String, Object> _managedAttributes;
private String[] _protectedTargets; private String[] _protectedTargets;
private final CopyOnWriteArrayList<AliasCheck> _aliasChecks = new CopyOnWriteArrayList<ContextHandler.AliasCheck>(); private final CopyOnWriteArrayList<AliasCheck> _aliasChecks = new CopyOnWriteArrayList<ContextHandler.AliasCheck>();
@ -567,6 +568,9 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
{ {
_eventListeners.add(listener); _eventListeners.add(listener);
if (!(isStarted() || isStarting()))
_durableListeners.add(listener);
if (listener instanceof ServletContextListener) if (listener instanceof ServletContextListener)
_contextListeners.add((ServletContextListener)listener); _contextListeners.add((ServletContextListener)listener);
@ -623,6 +627,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
return _programmaticListeners.contains(listener); return _programmaticListeners.contains(listener);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @return true if this context is accepting new requests * @return true if this context is accepting new requests
@ -822,6 +828,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
callContextDestroyed(_contextListeners.get(i),event); callContextDestroyed(_contextListeners.get(i),event);
} }
//retain only durable listeners
setEventListeners(_durableListeners.toArray(new EventListener[_durableListeners.size()]));
_durableListeners.clear();
if (_errorHandler != null) if (_errorHandler != null)
_errorHandler.stop(); _errorHandler.stop();
@ -1823,14 +1833,15 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
query = uriInContext.substring(q + 1); query = uriInContext.substring(q + 1);
uriInContext = uriInContext.substring(0,q); uriInContext = uriInContext.substring(0,q);
} }
// if ((q = uriInContext.indexOf(';')) > 0)
// uriInContext = uriInContext.substring(0,q);
String pathInContext = URIUtil.canonicalPath(URIUtil.decodePath(uriInContext)); String pathInContext = URIUtil.canonicalPath(URIUtil.decodePath(uriInContext));
if (pathInContext!=null)
{
String uri = URIUtil.addPaths(getContextPath(),uriInContext); String uri = URIUtil.addPaths(getContextPath(),uriInContext);
ContextHandler context = ContextHandler.this; ContextHandler context = ContextHandler.this;
return new Dispatcher(context,uri,pathInContext,query); return new Dispatcher(context,uri,pathInContext,query);
} }
}
catch (Exception e) catch (Exception e)
{ {
LOG.ignore(e); LOG.ignore(e);

View File

@ -138,6 +138,66 @@ public class HttpConnectionTest
checkContains(response,offset,"pathInfo=/"); checkContains(response,offset,"pathInfo=/");
} }
@Test
public void testBadNoPath() throws Exception
{
String response=connector.getResponses("GET http://localhost:80/../cheat HTTP/1.1\n"+
"Host: localhost:80\n"+
"\n");
int offset=0;
offset = checkContains(response,offset,"HTTP/1.1 400");
}
@Test
public void testOKPathDotDotPath() throws Exception
{
String response=connector.getResponses("GET /ooops/../path HTTP/1.0\nHost: localhost:80\n\n");
checkContains(response,0,"HTTP/1.1 200 OK");
checkContains(response,0,"pathInfo=/path");
}
@Test
public void testBadPathDotDotPath() throws Exception
{
String response=connector.getResponses("GET /ooops/../../path HTTP/1.0\nHost: localhost:80\n\n");
checkContains(response,0,"HTTP/1.1 400 Bad Request");
}
@Test
public void testOKPathEncodedDotDotPath() throws Exception
{
String response=connector.getResponses("GET /ooops/%2e%2e/path HTTP/1.0\nHost: localhost:80\n\n");
checkContains(response,0,"HTTP/1.1 200 OK");
checkContains(response,0,"pathInfo=/path");
}
@Test
public void testBadPathEncodedDotDotPath() throws Exception
{
String response=connector.getResponses("GET /ooops/%2e%2e/%2e%2e/path HTTP/1.0\nHost: localhost:80\n\n");
checkContains(response,0,"HTTP/1.1 400 Bad Request");
}
@Test
public void testBadDotDotPath() throws Exception
{
String response=connector.getResponses("GET ../path HTTP/1.0\nHost: localhost:80\n\n");
checkContains(response,0,"HTTP/1.1 400 Bad Request");
}
@Test
public void testBadSlashDotDotPath() throws Exception
{
String response=connector.getResponses("GET /../path HTTP/1.0\nHost: localhost:80\n\n");
checkContains(response,0,"HTTP/1.1 400 Bad Request");
}
@Test
public void testEncodedBadDotDotPath() throws Exception
{
String response=connector.getResponses("GET %2e%2e/path HTTP/1.0\nHost: localhost:80\n\n");
checkContains(response,0,"HTTP/1.1 400 Bad Request");
}
@Test @Test
public void testEmpty() throws Exception public void testEmpty() throws Exception

View File

@ -1094,10 +1094,12 @@ public class RequestTest
MultipartConfigElement mpce = new MultipartConfigElement(tmpDir.getAbsolutePath(),-1, -1, 2); MultipartConfigElement mpce = new MultipartConfigElement(tmpDir.getAbsolutePath(),-1, -1, 2);
request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce); request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce);
String field1 = request.getParameter("field1");
assertNotNull(field1);
Part foo = request.getPart("stuff"); Part foo = request.getPart("stuff");
assertNotNull(foo); assertNotNull(foo);
assertTrue(foo.getSize() > 0); assertTrue(foo.getSize() > 0);
response.setStatus(200); response.setStatus(200);
} }
catch (IllegalStateException e) catch (IllegalStateException e)

View File

@ -9,6 +9,7 @@
<artifactId>jetty-servlet</artifactId> <artifactId>jetty-servlet</artifactId>
<name>Jetty :: Servlet Handling</name> <name>Jetty :: Servlet Handling</name>
<description>Jetty Servlet Container</description> <description>Jetty Servlet Container</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.servlet</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.servlet</bundle-symbolic-name>
</properties> </properties>

View File

@ -53,7 +53,7 @@ public class FilterHolder extends Holder<Filter>
*/ */
public FilterHolder() public FilterHolder()
{ {
super (Source.EMBEDDED); this(Source.EMBEDDED);
} }
@ -70,7 +70,7 @@ public class FilterHolder extends Holder<Filter>
*/ */
public FilterHolder(Class<? extends Filter> filter) public FilterHolder(Class<? extends Filter> filter)
{ {
super (Source.EMBEDDED); this(Source.EMBEDDED);
setHeldClass(filter); setHeldClass(filter);
} }
@ -79,7 +79,7 @@ public class FilterHolder extends Holder<Filter>
*/ */
public FilterHolder(Filter filter) public FilterHolder(Filter filter)
{ {
super (Source.EMBEDDED); this(Source.EMBEDDED);
setFilter(filter); setFilter(filter);
} }

View File

@ -57,7 +57,7 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
protected String _className; protected String _className;
protected String _displayName; protected String _displayName;
protected boolean _extInstance; protected boolean _extInstance;
protected boolean _asyncSupported=true; protected boolean _asyncSupported;
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
protected String _name; protected String _name;
@ -67,8 +67,19 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
protected Holder(Source source) protected Holder(Source source)
{ {
_source=source; _source=source;
switch(_source)
{
case JAVAX_API:
case DESCRIPTOR:
case ANNOTATION:
_asyncSupported=false;
break;
default:
_asyncSupported=true;
}
} }
/* ------------------------------------------------------------ */
public Source getSource() public Source getSource()
{ {
return _source; return _source;

View File

@ -1041,8 +1041,6 @@ public class ServletContextHandler extends ContextHandler
if (!_enabled) if (!_enabled)
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
//TODO handle partial registrations
final ServletHandler handler = ServletContextHandler.this.getServletHandler(); final ServletHandler handler = ServletContextHandler.this.getServletHandler();
ServletHolder holder = handler.getServlet(servletName); ServletHolder holder = handler.getServlet(servletName);
if (holder == null) if (holder == null)

View File

@ -21,10 +21,12 @@ package org.eclipse.jetty.servlet;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.ListIterator;
import java.util.Map; import java.util.Map;
import java.util.Queue; import java.util.Queue;
import java.util.Set; import java.util.Set;
@ -187,30 +189,81 @@ public class ServletHandler extends ScopedHandler
super.doStop(); super.doStop();
// Stop filters // Stop filters
List<FilterHolder> filterHolders = new ArrayList<FilterHolder>();
List<FilterMapping> filterMappings = ArrayUtil.asMutableList(_filterMappings);
if (_filters!=null) if (_filters!=null)
{ {
for (int i=_filters.length; i-->0;) for (int i=_filters.length; i-->0;)
{ {
try { _filters[i].stop(); }catch(Exception e){LOG.warn(Log.EXCEPTION,e);} try { _filters[i].stop(); }catch(Exception e){LOG.warn(Log.EXCEPTION,e);}
if (_filters[i].getSource() != Source.EMBEDDED)
{
//remove all of the mappings that were for non-embedded filters
_filterNameMap.remove(_filters[i].getName());
//remove any mappings associated with this filter
ListIterator<FilterMapping> fmitor = filterMappings.listIterator();
while (fmitor.hasNext())
{
FilterMapping fm = fmitor.next();
if (fm.getFilterName().equals(_filters[i].getName()))
fmitor.remove();
}
}
else
filterHolders.add(_filters[i]); //only retain embedded
} }
} }
//Retain only filters and mappings that were added using jetty api (ie Source.EMBEDDED)
FilterHolder[] fhs = (FilterHolder[]) LazyList.toArray(filterHolders, FilterHolder.class);
updateBeans(_filters, fhs);
_filters = fhs;
FilterMapping[] fms = (FilterMapping[]) LazyList.toArray(filterMappings, FilterMapping.class);
updateBeans(_filterMappings, fms);
_filterMappings = fms;
_matchAfterIndex = (_filterMappings == null || _filterMappings.length == 0 ? -1 : _filterMappings.length-1);
_matchBeforeIndex = -1;
// Stop servlets // Stop servlets
List<ServletHolder> servletHolders = new ArrayList<ServletHolder>(); //will be remaining servlets
List<ServletMapping> servletMappings = ArrayUtil.asMutableList(_servletMappings); //will be remaining mappings
if (_servlets!=null) if (_servlets!=null)
{ {
for (int i=_servlets.length; i-->0;) for (int i=_servlets.length; i-->0;)
{ {
try { _servlets[i].stop(); }catch(Exception e){LOG.warn(Log.EXCEPTION,e);} try { _servlets[i].stop(); }catch(Exception e){LOG.warn(Log.EXCEPTION,e);}
if (_servlets[i].getSource() != Source.EMBEDDED)
{
//remove from servlet name map
_servletNameMap.remove(_servlets[i].getName());
//remove any mappings associated with this servlet
ListIterator<ServletMapping> smitor = servletMappings.listIterator();
while (smitor.hasNext())
{
ServletMapping sm = smitor.next();
if (sm.getServletName().equals(_servlets[i].getName()))
smitor.remove();
}
}
else
servletHolders.add(_servlets[i]); //only retain embedded
} }
} }
//Retain only Servlets and mappings added via jetty apis (ie Source.EMBEDDED)
ServletHolder[] shs = (ServletHolder[]) LazyList.toArray(servletHolders, ServletHolder.class);
updateBeans(_servlets, shs);
_servlets = shs;
ServletMapping[] sms = (ServletMapping[])LazyList.toArray(servletMappings, ServletMapping.class);
updateBeans(_servletMappings, sms);
_servletMappings = sms;
//will be regenerated on next start
_filterPathMappings=null; _filterPathMappings=null;
_filterNameMappings=null; _filterNameMappings=null;
_servletPathMap=null; _servletPathMap=null;
_matchBeforeIndex=-1;
_matchAfterIndex=-1;
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -786,7 +839,7 @@ public class ServletHandler extends ScopedHandler
*/ */
public ServletHolder addServletWithMapping (String className,String pathSpec) public ServletHolder addServletWithMapping (String className,String pathSpec)
{ {
ServletHolder holder = newServletHolder(null); ServletHolder holder = newServletHolder(Holder.Source.EMBEDDED);
holder.setName(className+"-"+(_servlets==null?0:_servlets.length)); holder.setName(className+"-"+(_servlets==null?0:_servlets.length));
holder.setClassName(className); holder.setClassName(className);
addServletWithMapping(holder,pathSpec); addServletWithMapping(holder,pathSpec);
@ -801,7 +854,6 @@ public class ServletHandler extends ScopedHandler
{ {
ServletHolder holder = newServletHolder(Holder.Source.EMBEDDED); ServletHolder holder = newServletHolder(Holder.Source.EMBEDDED);
holder.setHeldClass(servlet); holder.setHeldClass(servlet);
setServlets(ArrayUtil.addToArray(getServlets(), holder, ServletHolder.class));
addServletWithMapping(holder,pathSpec); addServletWithMapping(holder,pathSpec);
return holder; return holder;
@ -972,7 +1024,7 @@ public class ServletHandler extends ScopedHandler
*/ */
public FilterHolder addFilterWithMapping (String className,String pathSpec,int dispatches) public FilterHolder addFilterWithMapping (String className,String pathSpec,int dispatches)
{ {
FilterHolder holder = newFilterHolder(null); FilterHolder holder = newFilterHolder(Holder.Source.EMBEDDED);
holder.setName(className+"-"+_filters.length); holder.setName(className+"-"+_filters.length);
holder.setClassName(className); holder.setClassName(className);
@ -1119,7 +1171,7 @@ public class ServletHandler extends ScopedHandler
{ {
//programmatically defined filter mappings are prepended to mapping list in the order //programmatically defined filter mappings are prepended to mapping list in the order
//in which they were defined. In other words, insert this mapping at the tail of the //in which they were defined. In other words, insert this mapping at the tail of the
//programmatically added filter mappings, BEFORE the first web.xml defined filter mapping. //programmatically prepended filter mappings, BEFORE the first web.xml defined filter mapping.
if (_matchBeforeIndex < 0) if (_matchBeforeIndex < 0)
{ {
@ -1162,14 +1214,15 @@ public class ServletHandler extends ScopedHandler
{ {
if (pos < 0) if (pos < 0)
throw new IllegalArgumentException("FilterMapping insertion pos < 0"); throw new IllegalArgumentException("FilterMapping insertion pos < 0");
FilterMapping[] mappings = getFilterMappings(); FilterMapping[] mappings = getFilterMappings();
if (mappings==null || mappings.length==0) if (mappings==null || mappings.length==0)
{ {
return new FilterMapping[] {mapping}; return new FilterMapping[] {mapping};
} }
FilterMapping[] new_mappings = new FilterMapping[mappings.length+1]; FilterMapping[] new_mappings = new FilterMapping[mappings.length+1];
if (before) if (before)
{ {
//copy existing filter mappings up to but not including the pos //copy existing filter mappings up to but not including the pos
@ -1382,6 +1435,7 @@ public class ServletHandler extends ScopedHandler
if (holders!=null) if (holders!=null)
for (ServletHolder holder:holders) for (ServletHolder holder:holders)
holder.setServletHandler(this); holder.setServletHandler(this);
updateBeans(_servlets,holders); updateBeans(_servlets,holders);
_servlets=holders; _servlets=holders;
updateNameMappings(); updateNameMappings();

View File

@ -93,7 +93,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
*/ */
public ServletHolder() public ServletHolder()
{ {
super (Source.EMBEDDED); this(Source.EMBEDDED);
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
@ -109,7 +109,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
*/ */
public ServletHolder(Servlet servlet) public ServletHolder(Servlet servlet)
{ {
super (Source.EMBEDDED); this(Source.EMBEDDED);
setServlet(servlet); setServlet(servlet);
} }
@ -118,7 +118,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
*/ */
public ServletHolder(String name, Class<? extends Servlet> servlet) public ServletHolder(String name, Class<? extends Servlet> servlet)
{ {
super (Source.EMBEDDED); this(Source.EMBEDDED);
setName(name); setName(name);
setHeldClass(servlet); setHeldClass(servlet);
} }
@ -128,7 +128,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
*/ */
public ServletHolder(String name, Servlet servlet) public ServletHolder(String name, Servlet servlet)
{ {
super (Source.EMBEDDED); this(Source.EMBEDDED);
setName(name); setName(name);
setServlet(servlet); setServlet(servlet);
} }
@ -138,7 +138,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
*/ */
public ServletHolder(Class<? extends Servlet> servlet) public ServletHolder(Class<? extends Servlet> servlet)
{ {
super (Source.EMBEDDED); this(Source.EMBEDDED);
setHeldClass(servlet); setHeldClass(servlet);
} }
@ -665,6 +665,8 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
Servlet servlet=_servlet; Servlet servlet=_servlet;
synchronized(this) synchronized(this)
{ {
if (!isStarted())
throw new UnavailableException("Servlet not initialized", -1);
if (_unavailable!=0 || !_initOnStartup) if (_unavailable!=0 || !_initOnStartup)
servlet=getServlet(); servlet=getServlet();
if (servlet==null) if (servlet==null)

View File

@ -220,6 +220,32 @@ public class DispatcherTest
assertEquals(expected, responses); assertEquals(expected, responses);
} }
@Test
public void testServletForwardDotDot() throws Exception
{
_contextHandler.addServlet(DispatchServletServlet.class, "/dispatch/*");
_contextHandler.addServlet(RogerThatServlet.class, "/roger/that");
String requests="GET /context/dispatch/test?forward=/%2e%2e/roger/that HTTP/1.0\n" + "Host: localhost\n\n";
String responses = _connector.getResponses(requests);
assertThat(responses,startsWith("HTTP/1.1 404 "));
}
@Test
public void testServletForwardEncodedDotDot() throws Exception
{
_contextHandler.addServlet(DispatchServletServlet.class, "/dispatch/*");
_contextHandler.addServlet(RogerThatServlet.class, "/roger/that");
String requests="GET /context/dispatch/test?forward=/%252e%252e/roger/that HTTP/1.0\n" + "Host: localhost\n\n";
String responses = _connector.getResponses(requests);
assertThat(responses,startsWith("HTTP/1.1 404 "));
}
@Test @Test
public void testServletInclude() throws Exception public void testServletInclude() throws Exception
{ {
@ -412,7 +438,10 @@ public class DispatcherTest
else if(request.getParameter("forward")!=null) else if(request.getParameter("forward")!=null)
{ {
dispatcher = getServletContext().getRequestDispatcher(request.getParameter("forward")); dispatcher = getServletContext().getRequestDispatcher(request.getParameter("forward"));
if (dispatcher!=null)
dispatcher.forward(new ServletRequestWrapper(request), new ServletResponseWrapper(response)); dispatcher.forward(new ServletRequestWrapper(request), new ServletResponseWrapper(response));
else
response.sendError(404);
} }
} }
@ -586,10 +615,14 @@ public class DispatcherTest
assertEquals(null, request.getPathInfo()); assertEquals(null, request.getPathInfo());
assertEquals(null, request.getPathTranslated()); assertEquals(null, request.getPathTranslated());
UrlEncoded query = new UrlEncoded(request.getQueryString()); UrlEncoded query = new UrlEncoded();
query.decode(request.getQueryString());
assertThat(query.getString("do"), is("end")); assertThat(query.getString("do"), is("end"));
// Russian for "selected=Temperature" // Russian for "selected=Temperature"
String russian = new UrlEncoded(query.getString("else")).encode(); UrlEncoded q2=new UrlEncoded();
q2.decode(query.getString("else"));
String russian = q2.encode();
assertThat(russian, is("%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D0%BD%D0%BE=%D0%A2%D0%B5%D0%BC%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D1%83%D1%80%D0%B0")); assertThat(russian, is("%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D0%BD%D0%BE=%D0%A2%D0%B5%D0%BC%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D1%83%D1%80%D0%B0"));
assertThat(query.getString("test"), is("1")); assertThat(query.getString("test"), is("1"));
assertThat(query.containsKey("foreign"), is(true)); assertThat(query.containsKey("foreign"), is(true));

View File

@ -9,6 +9,7 @@
<artifactId>jetty-servlets</artifactId> <artifactId>jetty-servlets</artifactId>
<name>Jetty :: Utility Servlets and Filters</name> <name>Jetty :: Utility Servlets and Filters</name>
<description>Utility Servlets from Jetty</description> <description>Utility Servlets from Jetty</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.servlets</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.servlets</bundle-symbolic-name>
</properties> </properties>

View File

@ -22,6 +22,9 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
@ -32,8 +35,11 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.UrlEncoded;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
@ -222,12 +228,32 @@ public class CGI extends HttpServlet
if ((pathTranslated == null) || (pathTranslated.length() == 0)) if ((pathTranslated == null) || (pathTranslated.length() == 0))
pathTranslated = path; pathTranslated = path;
String bodyFormEncoded = null;
if ((HttpMethod.POST.equals(req.getMethod()) || HttpMethod.PUT.equals(req.getMethod())) && "application/x-www-form-urlencoded".equals(req.getContentType()))
{
MultiMap<String> parameterMap = new MultiMap<String>();
Enumeration names = req.getParameterNames();
while (names.hasMoreElements())
{
String parameterName = (String)names.nextElement();
parameterMap.addValues(parameterName, req.getParameterValues(parameterName));
}
bodyFormEncoded = UrlEncoded.encode(parameterMap, Charset.forName(req.getCharacterEncoding()), true);
}
EnvList env = new EnvList(_env); EnvList env = new EnvList(_env);
// these ones are from "The WWW Common Gateway Interface Version 1.1" // these ones are from "The WWW Common Gateway Interface Version 1.1"
// look at : // look at :
// http://Web.Golux.Com/coar/cgi/draft-coar-cgi-v11-03-clean.html#6.1.1 // http://Web.Golux.Com/coar/cgi/draft-coar-cgi-v11-03-clean.html#6.1.1
env.set("AUTH_TYPE", req.getAuthType()); env.set("AUTH_TYPE", req.getAuthType());
if (bodyFormEncoded != null)
{
env.set("CONTENT_LENGTH", Integer.toString(bodyFormEncoded.length()));
}
else
{
env.set("CONTENT_LENGTH", Integer.toString(len)); env.set("CONTENT_LENGTH", Integer.toString(len));
}
env.set("CONTENT_TYPE", req.getContentType()); env.set("CONTENT_TYPE", req.getContentType());
env.set("GATEWAY_INTERFACE", "CGI/1.1"); env.set("GATEWAY_INTERFACE", "CGI/1.1");
if ((pathInfo != null) && (pathInfo.length() > 0)) if ((pathInfo != null) && (pathInfo.length() > 0))
@ -275,32 +301,23 @@ public class CGI extends HttpServlet
if (_cmdPrefix != null) if (_cmdPrefix != null)
execCmd = _cmdPrefix + " " + execCmd; execCmd = _cmdPrefix + " " + execCmd;
Process p = (dir == null)?Runtime.getRuntime().exec(execCmd,env.getEnvArray()):Runtime.getRuntime().exec(execCmd,env.getEnvArray(),dir); LOG.debug("Environment: " + env.getExportString());
LOG.debug("Command: " + execCmd);
Process p;
if (dir == null)
p = Runtime.getRuntime().exec(execCmd, env.getEnvArray());
else
p = Runtime.getRuntime().exec(execCmd, env.getEnvArray(), dir);
// hook processes input to browser's output (async) // hook processes input to browser's output (async)
final InputStream inFromReq = req.getInputStream(); if (bodyFormEncoded != null)
final OutputStream outToCgi = p.getOutputStream(); writeProcessInput(p, bodyFormEncoded);
final int inLength = len; else if (len > 0)
writeProcessInput(p, req.getInputStream(), len);
IO.copyThread(p.getErrorStream(), System.err); IO.copyThread(p.getErrorStream(), System.err);
new Thread(new Runnable()
{
public void run()
{
try
{
if (inLength > 0)
IO.copy(inFromReq,outToCgi,inLength);
outToCgi.close();
}
catch (IOException e)
{
LOG.ignore(e);
}
}
}).start();
// hook processes output to browser's input (sync) // hook processes output to browser's input (sync)
// if browser closes stream, we should detect it and kill process... // if browser closes stream, we should detect it and kill process...
OutputStream os = null; OutputStream os = null;
@ -376,15 +393,56 @@ public class CGI extends HttpServlet
} }
catch (Exception e) catch (Exception e)
{ {
LOG.ignore(e); LOG.debug(e);
} }
} }
os = null;
p.destroy(); p.destroy();
// LOG.debug("CGI: terminated!"); // LOG.debug("CGI: terminated!");
} }
} }
private static void writeProcessInput(final Process p, final String input)
{
new Thread(new Runnable()
{
public void run()
{
try
{
Writer outToCgi = new OutputStreamWriter(p.getOutputStream());
outToCgi.write(input);
outToCgi.close();
}
catch (IOException e)
{
LOG.debug(e);
}
}
}).start();
}
private static void writeProcessInput(final Process p, final InputStream input, final int len)
{
if (len <= 0) return;
new Thread(new Runnable()
{
public void run()
{
try
{
OutputStream outToCgi = p.getOutputStream();
IO.copy(input, outToCgi, len);
outToCgi.close();
}
catch (IOException e)
{
LOG.debug(e);
}
}
}).start();
}
/** /**
* Utility method to get a line of text from the input stream. * Utility method to get a line of text from the input stream.
* *
@ -393,7 +451,7 @@ public class CGI extends HttpServlet
* @return the line of text * @return the line of text
* @throws IOException * @throws IOException
*/ */
private String getTextLineFromStream(InputStream is) throws IOException private static String getTextLineFromStream(InputStream is) throws IOException
{ {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
int b; int b;
@ -411,16 +469,16 @@ public class CGI extends HttpServlet
*/ */
private static class EnvList private static class EnvList
{ {
private Map envMap; private Map<String, String> envMap;
EnvList() EnvList()
{ {
envMap = new HashMap(); envMap = new HashMap<String, String>();
} }
EnvList(EnvList l) EnvList(EnvList l)
{ {
envMap = new HashMap(l.envMap); envMap = new HashMap<String,String>(l.envMap);
} }
/** /**
@ -434,7 +492,19 @@ public class CGI extends HttpServlet
/** Get representation suitable for passing to exec. */ /** Get representation suitable for passing to exec. */
public String[] getEnvArray() public String[] getEnvArray()
{ {
return (String[])envMap.values().toArray(new String[envMap.size()]); return envMap.values().toArray(new String[envMap.size()]);
}
public String getExportString()
{
StringBuilder sb = new StringBuilder();
for (String variable : getEnvArray())
{
sb.append("export \"");
sb.append(variable);
sb.append("\"; ");
}
return sb.toString();
} }
@Override @Override

View File

@ -11,7 +11,7 @@
<artifactId>spdy-parent</artifactId> <artifactId>spdy-parent</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Jetty :: SPDY :: Parent</name> <name>Jetty :: SPDY :: Parent</name>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<npn.api.version>1.1.0.v20120525</npn.api.version> <npn.api.version>1.1.0.v20120525</npn.api.version>
</properties> </properties>

View File

@ -14,6 +14,7 @@
<bundle-symbolic-name>${project.groupId}.client</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.client</bundle-symbolic-name>
</properties> </properties>
<url>http://www.eclipse.org/jetty</url>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -143,7 +143,7 @@ public class SPDYClient
protected SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel) protected SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
{ {
String peerHost = channel.socket().getInetAddress().getHostAddress(); String peerHost = channel.socket().getInetAddress().getHostName();
int peerPort = channel.socket().getPort(); int peerPort = channel.socket().getPort();
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost, peerPort); SSLEngine engine = sslContextFactory.newSSLEngine(peerHost, peerPort);
engine.setUseClientMode(true); engine.setUseClientMode(true);

View File

@ -14,6 +14,7 @@
<bundle-symbolic-name>${project.groupId}.core</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.core</bundle-symbolic-name>
</properties> </properties>
<url>http://www.eclipse.org/jetty</url>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>

View File

@ -490,9 +490,15 @@ public class StandardSession implements ISession, Parser.Listener, Dumpable
goAway(x.getSessionStatus(), 0, TimeUnit.SECONDS, new Callback.Adapter()); goAway(x.getSessionStatus(), 0, TimeUnit.SECONDS, new Callback.Adapter());
} }
private void onSyn(SynStreamFrame frame) private void onSyn(final SynStreamFrame frame)
{ {
IStream stream = createStream(frame, null, false, null); IStream stream = createStream(frame, null, false, new Promise.Adapter<Stream>(){
@Override
public void failed(Throwable x)
{
LOG.debug("Received: {} but creating new Stream failed: {}", frame, x.getMessage());
}
});
if (stream != null) if (stream != null)
processSyn(listener, stream, frame); processSyn(listener, stream, frame);
} }

View File

@ -8,8 +8,8 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>spdy-example-webapp</artifactId> <artifactId>spdy-example-webapp</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>Jetty :: SPDY :: Example Web Application</name> <name>Jetty :: SPDY :: Jetty HTTP Web Application</name>
<url>http://www.eclipse.org/jetty</url>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -103,7 +103,8 @@
<New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory"> <New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
<Arg name="version" type="int">3</Arg> <Arg name="version" type="int">3</Arg>
<Arg name="config"><Ref refid="sslHttpConfig" /></Arg> <Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
<Arg name="pushStrategy"><Ref refid="pushStrategy"/></Arg> <!-- Uncomment to enable ReferrerPushStrategy -->
<!--<Arg name="pushStrategy"><Ref refid="pushStrategy"/></Arg>-->
</New> </New>
</Item> </Item>

View File

@ -23,7 +23,6 @@ import java.nio.ByteBuffer;
import java.util.Queue; import java.util.Queue;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpField;
@ -306,7 +305,7 @@ public class HttpTransportOverSPDY implements HttpTransport
final Fields pushHeaders = createPushHeaders(scheme, host, pushResource); final Fields pushHeaders = createPushHeaders(scheme, host, pushResource);
final Fields pushRequestHeaders = createRequestHeaders(scheme, host, uri, pushResource); final Fields pushRequestHeaders = createRequestHeaders(scheme, host, uri, pushResource);
stream.push(new PushInfo(pushHeaders, false), new Promise.Adapter<Stream>() stream.push(new PushInfo(pushHeaders, false), new Promise<Stream>()
{ {
@Override @Override
public void succeeded(Stream pushStream) public void succeeded(Stream pushStream)
@ -315,6 +314,12 @@ public class HttpTransportOverSPDY implements HttpTransport
queue.offer(new PushResource(pushStream, pushRequestHeaders)); queue.offer(new PushResource(pushStream, pushRequestHeaders));
sendNextResourceData(); sendNextResourceData();
} }
@Override
public void failed(Throwable x)
{
LOG.debug("Creating push stream failed.", x);
}
}); });
} }

View File

@ -67,7 +67,6 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@Ignore
public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
{ {
private static final Logger LOG = Log.getLogger(ReferrerPushStrategyTest.class); private static final Logger LOG = Log.getLogger(ReferrerPushStrategyTest.class);
@ -260,6 +259,7 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
public void testPushResourceOrder() throws Exception public void testPushResourceOrder() throws Exception
{ {
final CountDownLatch allExpectedPushesReceivedLatch = new CountDownLatch(4); final CountDownLatch allExpectedPushesReceivedLatch = new CountDownLatch(4);
final CountDownLatch allPushDataReceivedLatch = new CountDownLatch(4);
Session pushCacheBuildSession = startClient(version, serverAddress, null); Session pushCacheBuildSession = startClient(version, serverAddress, null);
@ -296,12 +296,22 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
break; break;
} }
allExpectedPushesReceivedLatch.countDown(); allExpectedPushesReceivedLatch.countDown();
return super.onPush(stream, pushInfo); return new Adapter()
{
@Override
public void onData(Stream stream, DataInfo dataInfo)
{
if(dataInfo.isClose())
allPushDataReceivedLatch.countDown();
}
};
} }
}); });
assertThat("All expected push resources have been received", allExpectedPushesReceivedLatch.await(5, assertThat("All expected push resources have been received", allExpectedPushesReceivedLatch.await(5,
TimeUnit.SECONDS), is(true)); TimeUnit.SECONDS), is(true));
assertThat("All push data has been fully received", allPushDataReceivedLatch.await(5, TimeUnit.SECONDS),
is(true));
} }
@Test @Test
@ -451,7 +461,6 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
private void sendRequest(Session session, Fields requestHeaders, final CountDownLatch pushSynHeadersValid, private void sendRequest(Session session, Fields requestHeaders, final CountDownLatch pushSynHeadersValid,
final CountDownLatch pushDataLatch, final boolean resetPush) throws InterruptedException final CountDownLatch pushDataLatch, final boolean resetPush) throws InterruptedException
{ {
LOG.info("sendRequest. headers={},resetPush={}", requestHeaders, resetPush);
final CountDownLatch dataReceivedLatch = new CountDownLatch(1); final CountDownLatch dataReceivedLatch = new CountDownLatch(1);
session.syn(new SynInfo(requestHeaders, true), new StreamFrameListener.Adapter() session.syn(new SynInfo(requestHeaders, true), new StreamFrameListener.Adapter()
{ {
@ -496,7 +505,6 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
} }
}, new Promise.Adapter<Stream>()); }, new Promise.Adapter<Stream>());
assertThat(dataReceivedLatch.await(5, TimeUnit.SECONDS), is(true)); assertThat(dataReceivedLatch.await(5, TimeUnit.SECONDS), is(true));
LOG.info("sendRequest done");
} }
private void run2ndClientRequests(final boolean validateHeaders, private void run2ndClientRequests(final boolean validateHeaders,

View File

@ -14,6 +14,7 @@
<bundle-symbolic-name>${project.groupId}.server</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.server</bundle-symbolic-name>
</properties> </properties>
<url>http://www.eclipse.org/jetty</url>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-start</artifactId> <artifactId>jetty-start</artifactId>
<name>Jetty :: Start</name> <name>Jetty :: Start</name>
<description>The start utility</description> <description>The start utility</description>
<url>http://www.eclipse.org/jetty</url>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -0,0 +1,41 @@
//
// ========================================================================
// Copyright (c) 1995-2013 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.start;
import java.util.Enumeration;
import java.util.Properties;
public class PropertyDump
{
public static void main(String[] args)
{
Properties props = System.getProperties();
Enumeration<?> names = props.propertyNames();
while (names.hasMoreElements())
{
String name = (String)names.nextElement();
// only interested in "test." prefixed properties
if (name.startsWith("test."))
{
System.out.printf("%s=%s%n",name,props.getProperty(name));
}
}
System.exit(0);
}
}

View File

@ -0,0 +1,245 @@
//
// ========================================================================
// Copyright (c) 1995-2013 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.start;
import static org.hamcrest.Matchers.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.toolchain.test.IO;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.OS;
import org.eclipse.jetty.toolchain.test.TestingDir;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
public class PropertyPassingTest
{
private static class ConsoleCapture implements Runnable
{
private String mode;
private BufferedReader reader;
private StringWriter output;
public ConsoleCapture(String mode, InputStream is)
{
this.mode = mode;
this.reader = new BufferedReader(new InputStreamReader(is));
this.output = new StringWriter();
}
@Override
public void run()
{
String line;
try (PrintWriter out = new PrintWriter(output))
{
while ((line = reader.readLine()) != (null))
{
out.println(line);
}
}
catch (IOException ignore)
{
/* ignore */
}
finally
{
IO.close(reader);
}
}
public String getConsoleOutput()
{
return output.toString();
}
public ConsoleCapture start()
{
Thread thread = new Thread(this,"ConsoleCapture/" + mode);
thread.start();
return this;
}
}
@Rule
public TestingDir testingdir = new TestingDir();
@Test
public void testAsJvmArg() throws IOException, InterruptedException
{
File testCfg = MavenTestingUtils.getTestResourceFile("property-dump-start.config");
File bogusXml = MavenTestingUtils.getTestResourceFile("bogus.xml");
// Setup command line
List<String> commands = new ArrayList<>();
commands.add(getJavaBin());
commands.add("-cp");
commands.add(getClassPath());
// addDebug(commands);
commands.add("-Dtest.foo=bar"); // TESTING THIS
commands.add(getStartJarBin());
commands.add("--config=" + testCfg.getAbsolutePath());
commands.add(bogusXml.getAbsolutePath());
// Run command, collect output
String output = collectRunOutput(commands);
// Test for values
Assert.assertThat("output",output,containsString("foo=bar"));
}
@Test
@Ignore("not working yet")
public void testAsCommandLineArg() throws IOException, InterruptedException
{
File testCfg = MavenTestingUtils.getTestResourceFile("property-dump-start.config");
File bogusXml = MavenTestingUtils.getTestResourceFile("bogus.xml");
// Setup command line
List<String> commands = new ArrayList<>();
commands.add(getJavaBin());
commands.add("-cp");
commands.add(getClassPath());
// addDebug(commands);
commands.add(getStartJarBin());
commands.add("test.foo=bar"); // TESTING THIS
commands.add("--config=" + testCfg.getAbsolutePath());
commands.add(bogusXml.getAbsolutePath());
// Run command, collect output
String output = collectRunOutput(commands);
// Test for values
Assert.assertThat("output",output,containsString("foo=bar"));
}
@Test
public void testAsDashDCommandLineArg() throws IOException, InterruptedException
{
File testCfg = MavenTestingUtils.getTestResourceFile("property-dump-start.config");
File bogusXml = MavenTestingUtils.getTestResourceFile("bogus.xml");
// Setup command line
List<String> commands = new ArrayList<>();
commands.add(getJavaBin());
commands.add("-cp");
commands.add(getClassPath());
// addDebug(commands);
commands.add(getStartJarBin());
commands.add("-Dtest.foo=bar"); // TESTING THIS
commands.add("--config=" + testCfg.getAbsolutePath());
commands.add(bogusXml.getAbsolutePath());
// Run command, collect output
String output = collectRunOutput(commands);
// Test for values
Assert.assertThat("output",output,containsString("foo=bar"));
}
private String getClassPath()
{
StringBuilder cp = new StringBuilder();
String pathSep = System.getProperty("path.separator");
cp.append(MavenTestingUtils.getProjectDir("target/classes"));
cp.append(pathSep);
cp.append(MavenTestingUtils.getProjectDir("target/test-classes"));
return cp.toString();
}
protected void addDebug(List<String> commands)
{
commands.add("-Xdebug");
commands.add("-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y");
}
private String collectRunOutput(List<String> commands) throws IOException, InterruptedException
{
StringBuilder cline = new StringBuilder();
for (String command : commands)
{
cline.append(command).append(" ");
}
System.out.println("Command line: " + cline);
ProcessBuilder builder = new ProcessBuilder(commands);
Process pid = builder.start();
ConsoleCapture stdOutPump = new ConsoleCapture("STDOUT",pid.getInputStream()).start();
ConsoleCapture stdErrPump = new ConsoleCapture("STDERR",pid.getErrorStream()).start();
int exitCode = pid.waitFor();
if(exitCode != 0) {
System.out.printf("STDERR: [" + stdErrPump.getConsoleOutput() + "]%n");
System.out.printf("STDOUT: [" + stdOutPump.getConsoleOutput() + "]%n");
Assert.assertThat("Exit code",exitCode,is(0));
}
return stdOutPump.getConsoleOutput();
}
private String getStartJarBin()
{
return org.eclipse.jetty.start.Main.class.getName();
}
private String getJavaBin()
{
File javaHome = new File(System.getProperty("java.home"));
if (!javaHome.exists())
{
return null;
}
File javabin = findExecutable(javaHome,"bin/java");
if (javabin != null)
{
return javabin.getAbsolutePath();
}
javabin = findExecutable(javaHome,"bin/java.exe");
if (javabin != null)
{
return javabin.getAbsolutePath();
}
return "java";
}
private File findExecutable(File root, String path)
{
String npath = OS.separators(path);
File exe = new File(root,npath);
if (!exe.exists())
{
return null;
}
return exe;
}
}

View File

@ -0,0 +1,2 @@
<?xml version="1.0"?>
<Configure />

View File

@ -0,0 +1,8 @@
org.eclipse.jetty.start.PropertyDump.class
[*]
$(basedir)/src/test/resources
[default]
$(basedir)/src/test/resources

View File

@ -8,6 +8,7 @@
<artifactId>jetty-util-ajax</artifactId> <artifactId>jetty-util-ajax</artifactId>
<name>Jetty :: Utilities :: Ajax(JSON)</name> <name>Jetty :: Utilities :: Ajax(JSON)</name>
<description>JSON/Ajax Utility classes for Jetty</description> <description>JSON/Ajax Utility classes for Jetty</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.util.ajax</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.util.ajax</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,6 +8,7 @@
<artifactId>jetty-util</artifactId> <artifactId>jetty-util</artifactId>
<name>Jetty :: Utilities</name> <name>Jetty :: Utilities</name>
<description>Utility classes for Jetty</description> <description>Utility classes for Jetty</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.util</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.util</bundle-symbolic-name>
</properties> </properties>

View File

@ -84,7 +84,7 @@ import java.nio.charset.Charset;
*/ */
public class BufferUtil public class BufferUtil
{ {
static final int TEMP_BUFFER_SIZE = 512; static final int TEMP_BUFFER_SIZE = 4096;
static final byte SPACE = 0x20; static final byte SPACE = 0x20;
static final byte MINUS = '-'; static final byte MINUS = '-';
static final byte[] DIGIT = static final byte[] DIGIT =

View File

@ -0,0 +1,69 @@
//
// ========================================================================
// Copyright (c) 1995-2013 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.util.log;
/**
* A try-with-resources compatible layer for {@link StdErrLog#setHideStacks(boolean) hiding stacktraces} within the scope of the <code>try</code> block when
* logging with {@link StdErrLog} implementation.
* <p>
* Use of other logging implementation cause no effect when using this class
* <p>
* Example:
*
* <pre>
* try (StacklessLogging scope = new StacklessLogging(EventDriver.class,Noisy.class))
* {
* doActionThatCausesStackTraces();
* }
* </pre>
*/
public class StacklessLogging implements AutoCloseable
{
private final Class<?> clazzes[];
public StacklessLogging(Class<?>... classesToSquelch)
{
this.clazzes = classesToSquelch;
hideStacks(true);
}
@Override
public void close() throws Exception
{
hideStacks(false);
}
private void hideStacks(boolean hide)
{
for (Class<?> clazz : clazzes)
{
Logger log = Log.getLogger(clazz);
if (log == null)
{
// not interested in classes without loggers
continue;
}
if (log instanceof StdErrLog)
{
// only operate on loggers that are of type StdErrLog
((StdErrLog)log).setHideStacks(hide);
}
}
}
}

View File

@ -157,9 +157,9 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
int size = _threads.size(); int size = _threads.size();
if (size > 0) if (size > 0)
{ {
LOG.warn("{} threads could not be stopped", size); Thread.yield();
if ((size <= Runtime.getRuntime().availableProcessors()) || LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
{ {
for (Thread unstopped : _threads) for (Thread unstopped : _threads)
{ {
@ -171,6 +171,11 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
LOG.warn("Couldn't stop {}{}", unstopped, dmp.toString()); LOG.warn("Couldn't stop {}{}", unstopped, dmp.toString());
} }
} }
else
{
for (Thread unstopped : _threads)
LOG.warn("{} Couldn't stop {}",this,unstopped);
}
} }
synchronized (_joinLock) synchronized (_joinLock)

View File

@ -8,6 +8,7 @@
<artifactId>jetty-webapp</artifactId> <artifactId>jetty-webapp</artifactId>
<name>Jetty :: Webapp Application Support</name> <name>Jetty :: Webapp Application Support</name>
<description>Jetty web application support</description> <description>Jetty web application support</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.webapp</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.webapp</bundle-symbolic-name>
</properties> </properties>

View File

@ -1083,6 +1083,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param extractWAR True if war files are extracted * @param extractWAR True if war files are extracted

View File

@ -121,24 +121,12 @@ public class WebXmlConfiguration extends AbstractConfiguration
@Override @Override
public void deconfigure (WebAppContext context) throws Exception public void deconfigure (WebAppContext context) throws Exception
{ {
// TODO preserve any configuration that pre-existed.
ServletHandler _servletHandler = context.getServletHandler();
_servletHandler.setFilters(null);
_servletHandler.setFilterMappings(null);
_servletHandler.setServlets(null);
_servletHandler.setServletMappings(null);
context.setEventListeners(null);
context.setWelcomeFiles(null); context.setWelcomeFiles(null);
if (context.getErrorHandler() instanceof ErrorPageErrorHandler) if (context.getErrorHandler() instanceof ErrorPageErrorHandler)
((ErrorPageErrorHandler) ((ErrorPageErrorHandler)
context.getErrorHandler()).setErrorPages(null); context.getErrorHandler()).setErrorPages(null);
// TODO remove classpaths from classloader // TODO remove classpaths from classloader
} }
} }

View File

@ -11,6 +11,7 @@
<artifactId>websocket-parent</artifactId> <artifactId>websocket-parent</artifactId>
<name>Jetty :: Websocket :: Parent</name> <name>Jetty :: Websocket :: Parent</name>
<packaging>pom</packaging> <packaging>pom</packaging>
<url>http://www.eclipse.org/jetty</url>
<modules> <modules>
<module>websocket-common</module> <module>websocket-common</module>

View File

@ -42,6 +42,7 @@ public class UpgradeRequest
private String httpVersion; private String httpVersion;
private String method; private String method;
private String host; private String host;
private boolean secure = false;
protected UpgradeRequest() protected UpgradeRequest()
{ {
@ -225,6 +226,11 @@ public class UpgradeRequest
return test.equalsIgnoreCase(getOrigin()); return test.equalsIgnoreCase(getOrigin());
} }
public boolean isSecure()
{
return secure;
}
public void setCookies(List<HttpCookie> cookies) public void setCookies(List<HttpCookie> cookies)
{ {
this.cookies = cookies; this.cookies = cookies;
@ -261,6 +267,19 @@ public class UpgradeRequest
public void setRequestURI(URI uri) public void setRequestURI(URI uri)
{ {
this.requestURI = uri; this.requestURI = uri;
String scheme = uri.getScheme();
if ("ws".equalsIgnoreCase(scheme))
{
secure = false;
}
else if ("wss".equalsIgnoreCase(scheme))
{
secure = true;
}
else
{
throw new IllegalArgumentException("URI scheme must be 'ws' or 'wss'");
}
this.host = this.requestURI.getHost(); this.host = this.requestURI.getHost();
this.parameters.clear(); this.parameters.clear();
} }

View File

@ -0,0 +1,145 @@
//
// ========================================================================
// Copyright (c) 1995-2013 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.websocket.api.util;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;
/**
* Utility methods for converting a {@link URI} between a HTTP(S) and WS(S) URI.
*/
public final class WSURI
{
/**
* Convert to HTTP <code>http</code> or <code>https</code> scheme URIs.
* <p>
* Converting <code>ws</code> and <code>wss</code> URIs to their HTTP equivalent
*
* @param inputUri
* the input URI
* @return the HTTP scheme URI for the input URI.
* @throws URISyntaxException
* if unable to convert the input URI
*/
public static URI toHttp(final URI inputUri) throws URISyntaxException
{
Objects.requireNonNull(inputUri,"Input URI must not be null");
String wsScheme = inputUri.getScheme();
String httpScheme = null;
if ("http".equalsIgnoreCase(wsScheme) || "https".equalsIgnoreCase(wsScheme))
{
// leave alone
httpScheme = wsScheme;
}
else if ("ws".equalsIgnoreCase(wsScheme))
{
// convert to http
httpScheme = "http";
}
else if ("wss".equalsIgnoreCase(wsScheme))
{
// convert to https
httpScheme = "https";
}
else
{
throw new URISyntaxException(inputUri.toString(),"Unrecognized WebSocket scheme");
}
return new URI(httpScheme,inputUri.getUserInfo(),inputUri.getHost(),inputUri.getPort(),inputUri.getPath(),inputUri.getQuery(),inputUri.getFragment());
}
/**
* Convert to WebSocket <code>ws</code> or <code>wss</code> scheme URIs
* <p>
* Converting <code>http</code> and <code>https</code> URIs to their WebSocket equivalent
*
* @param inputUrl
* the input URI
* @return the WebSocket scheme URI for the input URI.
* @throws URISyntaxException
* if unable to convert the input URI
*/
public static URI toWebsocket(CharSequence inputUrl) throws URISyntaxException
{
return toWebsocket(new URI(inputUrl.toString()));
}
/**
* Convert to WebSocket <code>ws</code> or <code>wss</code> scheme URIs
* <p>
* Converting <code>http</code> and <code>https</code> URIs to their WebSocket equivalent
*
* @param inputUrl
* the input URI
* @param query
* the optional query string
* @return the WebSocket scheme URI for the input URI.
* @throws URISyntaxException
* if unable to convert the input URI
*/
public static URI toWebsocket(CharSequence inputUrl, String query) throws URISyntaxException
{
if (query == null)
{
return toWebsocket(new URI(inputUrl.toString()));
}
return toWebsocket(new URI(inputUrl.toString() + '?' + query));
}
/**
* Convert to WebSocket <code>ws</code> or <code>wss</code> scheme URIs
*
* <p>
* Converting <code>http</code> and <code>https</code> URIs to their WebSocket equivalent
*
* @param inputUri
* the input URI
* @return the WebSocket scheme URI for the input URI.
* @throws URISyntaxException
* if unable to convert the input URI
*/
public static URI toWebsocket(final URI inputUri) throws URISyntaxException
{
Objects.requireNonNull(inputUri,"Input URI must not be null");
String httpScheme = inputUri.getScheme();
String wsScheme = null;
if ("ws".equalsIgnoreCase(httpScheme) || "wss".equalsIgnoreCase(httpScheme))
{
// keep as-is
wsScheme = httpScheme;
}
else if ("http".equalsIgnoreCase(httpScheme))
{
// convert to ws
wsScheme = "ws";
}
else if ("https".equalsIgnoreCase(httpScheme))
{
// convert to wss
wsScheme = "wss";
}
else
{
throw new URISyntaxException(inputUri.toString(),"Unrecognized HTTP scheme");
}
return new URI(wsScheme,inputUri.getUserInfo(),inputUri.getHost(),inputUri.getPort(),inputUri.getPath(),inputUri.getQuery(),inputUri.getFragment());
}
}

View File

@ -0,0 +1,88 @@
//
// ========================================================================
// Copyright (c) 1995-2013 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.websocket.api.util;
import static org.hamcrest.Matchers.*;
import java.net.URI;
import java.net.URISyntaxException;
import org.junit.Assert;
import org.junit.Test;
public class WSURITest
{
private void assertURI(URI actual, URI expected)
{
Assert.assertThat(actual.toASCIIString(),is(expected.toASCIIString()));
}
@Test
public void testHttpsToHttps() throws URISyntaxException
{
assertURI(WSURI.toHttp(URI.create("https://localhost/")),URI.create("https://localhost/"));
}
@Test
public void testHttpsToWss() throws URISyntaxException
{
assertURI(WSURI.toWebsocket(URI.create("https://localhost/")),URI.create("wss://localhost/"));
}
@Test
public void testHttpToHttp() throws URISyntaxException
{
assertURI(WSURI.toHttp(URI.create("http://localhost/")),URI.create("http://localhost/"));
}
@Test
public void testHttpToWs() throws URISyntaxException
{
assertURI(WSURI.toWebsocket(URI.create("http://localhost/")),URI.create("ws://localhost/"));
assertURI(WSURI.toWebsocket(URI.create("http://localhost:8080/deeper/")),URI.create("ws://localhost:8080/deeper/"));
assertURI(WSURI.toWebsocket("http://localhost/"),URI.create("ws://localhost/"));
assertURI(WSURI.toWebsocket("http://localhost/",null),URI.create("ws://localhost/"));
assertURI(WSURI.toWebsocket("http://localhost/","a=b"),URI.create("ws://localhost/?a=b"));
}
@Test
public void testWssToHttps() throws URISyntaxException
{
assertURI(WSURI.toHttp(URI.create("wss://localhost/")),URI.create("https://localhost/"));
}
@Test
public void testWssToWss() throws URISyntaxException
{
assertURI(WSURI.toWebsocket(URI.create("wss://localhost/")),URI.create("wss://localhost/"));
}
@Test
public void testWsToHttp() throws URISyntaxException
{
assertURI(WSURI.toHttp(URI.create("ws://localhost/")),URI.create("http://localhost/"));
}
@Test
public void testWsToWs() throws URISyntaxException
{
assertURI(WSURI.toWebsocket(URI.create("ws://localhost/")),URI.create("ws://localhost/"));
}
}

View File

@ -140,7 +140,7 @@ public class UpgradeConnection extends AbstractConnection
public void onOpen() public void onOpen()
{ {
super.onOpen(); super.onOpen();
// TODO: handle timeout // TODO: handle timeout?
getExecutor().execute(new SendUpgradeRequest()); getExecutor().execute(new SendUpgradeRequest());
} }

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.nio.channels.SelectionKey; import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel; import java.nio.channels.SocketChannel;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLEngine;
import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ByteBufferPool;
@ -87,7 +88,6 @@ public class WebSocketClientSelectorManager extends SelectorManager
Connection connection = newUpgradeConnection(channel,sslEndPoint,connectPromise); Connection connection = newUpgradeConnection(channel,sslEndPoint,connectPromise);
sslEndPoint.setIdleTimeout(connectPromise.getClient().getMaxIdleTimeout()); sslEndPoint.setIdleTimeout(connectPromise.getClient().getMaxIdleTimeout());
sslEndPoint.setConnection(connection); sslEndPoint.setConnection(connection);
connectionOpened(connection);
return sslConnection; return sslConnection;
} }
else else
@ -104,7 +104,7 @@ public class WebSocketClientSelectorManager extends SelectorManager
} }
catch (IOException e) catch (IOException e)
{ {
LOG.debug(e); LOG.ignore(e);
connectPromise.failed(e); connectPromise.failed(e);
// rethrow // rethrow
throw e; throw e;
@ -120,7 +120,7 @@ public class WebSocketClientSelectorManager extends SelectorManager
public SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel) public SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
{ {
String peerHost = channel.socket().getInetAddress().getHostAddress(); String peerHost = channel.socket().getInetAddress().getHostName();
int peerPort = channel.socket().getPort(); int peerPort = channel.socket().getPort();
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost,peerPort); SSLEngine engine = sslContextFactory.newSSLEngine(peerHost,peerPort);
engine.setUseClientMode(true); engine.setUseClientMode(true);

View File

@ -245,13 +245,16 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
@Override @Override
public RemoteEndpoint getRemote() public RemoteEndpoint getRemote()
{ {
if (!isOpen()) ConnectionState state = connection.getIOState().getConnectionState();
if ((state == ConnectionState.OPEN) || (state == ConnectionState.CONNECTED))
{ {
throw new WebSocketException("Session has not been opened yet");
}
return remote; return remote;
} }
throw new WebSocketException("RemoteEndpoint unavailable, current state [" + state + "], expecting [OPEN or CONNECTED]");
}
@Override @Override
public InetSocketAddress getRemoteAddress() public InetSocketAddress getRemoteAddress()
{ {

View File

@ -163,8 +163,15 @@ public abstract class EventDriver implements IncomingFrames
{ {
LOG.debug("openSession({})",session); LOG.debug("openSession({})",session);
this.session = session; this.session = session;
try
{
this.onConnect(); this.onConnect();
} }
catch (Throwable t)
{
unhandled(t);
}
}
protected void terminateConnection(int statusCode, String rawreason) protected void terminateConnection(int statusCode, String rawreason)
{ {
@ -177,6 +184,7 @@ public abstract class EventDriver implements IncomingFrames
private void unhandled(Throwable t) private void unhandled(Throwable t)
{ {
LOG.warn("Unhandled Error (closing connection)",t); LOG.warn("Unhandled Error (closing connection)",t);
onError(t);
// Unhandled Error, close the connection. // Unhandled Error, close the connection.
switch (policy.getBehavior()) switch (policy.getBehavior())

View File

@ -37,6 +37,11 @@
<artifactId>websocket-common</artifactId> <artifactId>websocket-common</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-servlet</artifactId> <artifactId>websocket-servlet</artifactId>

Some files were not shown because too many files have changed in this diff Show More