Merge branch 'master' into websocket-ssl

Conflicts:
	jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/ServletWebSocketRequest.java
This commit is contained in:
Joakim Erdfelt 2013-06-13 16:05:26 -07:00
commit 83bd15559b
89 changed files with 2129 additions and 204 deletions

View File

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

View File

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

View File

@ -10,6 +10,7 @@
<artifactId>example-jetty-embedded</artifactId>
<name>Example :: Jetty Embedded</name>
<description>Jetty Embedded Examples</description>
<url>http://www.eclipse.org/jetty</url>
<dependencies>
<dependency>
<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>
<name>Jetty :: Servlet Annotations</name>
<description>Annotation support for deploying servlets in jetty.</description>
<url>http://www.eclipse.org/jetty</url>
<properties>
<bundle-symbolic-name>${project.groupId}.annotations</bundle-symbolic-name>
</properties>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ReadPendingException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jetty.util.Callback;
@ -34,8 +35,7 @@ import org.eclipse.jetty.util.Callback;
*/
public abstract class FillInterest
{
private final AtomicBoolean _interested = new AtomicBoolean(false);
private volatile Callback _callback;
private final AtomicReference<Callback> _interested = new AtomicReference<>(null);
/* ------------------------------------------------------------ */
protected FillInterest()
@ -52,9 +52,11 @@ public abstract class FillInterest
*/
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();
_callback=callback;
try
{
if (needsFill())
@ -71,12 +73,9 @@ public abstract class FillInterest
*/
public void fillable()
{
if (_interested.compareAndSet(true,false))
{
Callback callback=_callback;
_callback=null;
Callback callback=_interested.get();
if (callback!=null && _interested.compareAndSet(callback,null))
callback.succeeded();
}
}
/* ------------------------------------------------------------ */
@ -85,7 +84,7 @@ public abstract class FillInterest
*/
public boolean isInterested()
{
return _interested.get();
return _interested.get()!=null;
}
/* ------------------------------------------------------------ */
@ -93,30 +92,24 @@ public abstract class FillInterest
*/
public void onFail(Throwable cause)
{
if (_interested.compareAndSet(true,false))
{
Callback callback=_callback;
_callback=null;
Callback callback=_interested.get();
if (callback!=null && _interested.compareAndSet(callback,null))
callback.failed(cause);
}
}
/* ------------------------------------------------------------ */
public void onClose()
{
if (_interested.compareAndSet(true,false))
{
Callback callback=_callback;
_callback=null;
Callback callback=_interested.get();
if (callback!=null && _interested.compareAndSet(callback,null))
callback.failed(new ClosedChannelException());
}
}
/* ------------------------------------------------------------ */
@Override
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>
<name>Jetty :: JASPI Security</name>
<description>Jetty security infrastructure</description>
<url>http://www.eclipse.org/jetty</url>
<properties>
<bundle-symbolic-name>${project.groupId}.jaspi</bundle-symbolic-name>
</properties>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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>
<name>Jetty :: OSGi :: HttpService</name>
<description>Jetty OSGi HttpService bundle</description>
<url>http://www.eclipse.org/jetty</url>
<properties>
<bundle-symbolic-name>${project.groupId}.httpservice</bundle-symbolic-name>
</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>
<artifactId>jetty-osgi-project</artifactId>
<name>Jetty :: OSGi</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging>
<properties>
<osgi-version>3.6.0.v20100517</osgi-version>

View File

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

View File

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

View File

@ -8,7 +8,8 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>test-jetty-osgi</artifactId>
<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>
<bundle-symbolic-name>${project.groupId}.boot.test.spdy</bundle-symbolic-name>
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit/</jetty-orbit-url>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
@ -31,6 +30,7 @@ import javax.servlet.ServletResponse;
import org.eclipse.jetty.http.HttpContent;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.util.BlockingCallback;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
@ -168,7 +168,7 @@ public class HttpOutput extends ServletOutputStream
public void write(byte[] b, int off, int len) throws IOException
{
if (isClosed())
throw new EOFException("Closed");
throw new EofException("Closed");
_written+=len;
boolean complete=_channel.getResponse().isAllContentWritten(_written);

View File

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

View File

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

View File

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

View File

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

View File

@ -14,6 +14,7 @@
<bundle-symbolic-name>${project.groupId}.core</bundle-symbolic-name>
</properties>
<url>http://www.eclipse.org/jetty</url>
<dependencies>
<dependency>
<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());
}
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)
processSyn(listener, stream, frame);
}

View File

@ -8,8 +8,8 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>spdy-example-webapp</artifactId>
<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>
<plugins>
<plugin>

View File

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

View File

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

View File

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

View File

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

View File

@ -84,7 +84,7 @@ import java.nio.charset.Charset;
*/
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 MINUS = '-';
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();
if (size > 0)
{
LOG.warn("{} threads could not be stopped", size);
if ((size <= Runtime.getRuntime().availableProcessors()) || LOG.isDebugEnabled())
Thread.yield();
if (LOG.isDebugEnabled())
{
for (Thread unstopped : _threads)
{
@ -171,6 +171,11 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
LOG.warn("Couldn't stop {}{}", unstopped, dmp.toString());
}
}
else
{
for (Thread unstopped : _threads)
LOG.warn("{} Couldn't stop {}",this,unstopped);
}
}
synchronized (_joinLock)

View File

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

View File

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

View File

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

View File

@ -28,12 +28,14 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.WebSocketAdapter;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.events.EventDriver;
import org.eclipse.jetty.websocket.server.blockhead.BlockheadClient;
import org.eclipse.jetty.websocket.server.helper.IncomingFramesCapture;
import org.eclipse.jetty.websocket.server.helper.RFCSocket;
@ -52,28 +54,7 @@ import org.junit.Test;
*/
public class WebSocketCloseTest
{
@SuppressWarnings("serial")
public static class CloseServlet extends WebSocketServlet implements WebSocketCreator
{
@Override
public void configure(WebSocketServletFactory factory)
{
factory.setCreator(this);
}
@Override
public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
{
if (req.hasSubProtocol("fastclose"))
{
fastcloseSocket = new FastCloseSocket();
return fastcloseSocket;
}
return new RFCSocket();
}
}
public static class FastCloseSocket extends WebSocketAdapter
static class AbstractCloseSocket extends WebSocketAdapter
{
public CountDownLatch closeLatch = new CountDownLatch(1);
public String closeReason = null;
@ -89,6 +70,48 @@ public class WebSocketCloseTest
closeLatch.countDown();
}
@Override
public void onWebSocketError(Throwable cause)
{
errors.add(cause);
}
}
@SuppressWarnings("serial")
public static class CloseServlet extends WebSocketServlet implements WebSocketCreator
{
@Override
public void configure(WebSocketServletFactory factory)
{
factory.setCreator(this);
}
@Override
public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
{
if (req.hasSubProtocol("fastclose"))
{
closeSocket = new FastCloseSocket();
return closeSocket;
}
if (req.hasSubProtocol("fastfail"))
{
closeSocket = new FastFailSocket();
return closeSocket;
}
return new RFCSocket();
}
}
/**
* On Connect, close socket
*/
public static class FastCloseSocket extends AbstractCloseSocket
{
private static final Logger LOG = Log.getLogger(WebSocketCloseTest.FastCloseSocket.class);
@Override
public void onWebSocketConnect(Session sess)
{
@ -102,6 +125,21 @@ public class WebSocketCloseTest
e.printStackTrace(System.err);
}
}
}
/**
* On Connect, throw unhandled exception
*/
public static class FastFailSocket extends AbstractCloseSocket
{
private static final Logger LOG = Log.getLogger(WebSocketCloseTest.FastFailSocket.class);
@Override
public void onWebSocketConnect(Session sess)
{
LOG.debug("onWebSocketConnect({})",sess);
throw new RuntimeException("Intentional FastFail");
}
@Override
public void onWebSocketError(Throwable cause)
@ -111,8 +149,9 @@ public class WebSocketCloseTest
}
private static final Logger LOG = Log.getLogger(WebSocketCloseTest.class);
private static SimpleServletServer server;
private static FastCloseSocket fastcloseSocket;
private static AbstractCloseSocket closeSocket;
@BeforeClass
public static void startServer() throws Exception
@ -150,8 +189,44 @@ public class WebSocketCloseTest
client.write(close.asFrame()); // respond with close
Assert.assertThat("Fast Close Latch",fastcloseSocket.closeLatch.await(1,TimeUnit.SECONDS),is(true));
Assert.assertThat("Fast Close.statusCode",fastcloseSocket.closeStatusCode,is(StatusCode.NORMAL));
Assert.assertThat("Fast Close Latch",closeSocket.closeLatch.await(1,TimeUnit.SECONDS),is(true));
Assert.assertThat("Fast Close.statusCode",closeSocket.closeStatusCode,is(StatusCode.NORMAL));
}
finally
{
client.close();
}
}
/**
* Test fast fail (bug #410537)
*/
@Test
public void testFastFail() throws Exception
{
BlockheadClient client = new BlockheadClient(server.getServerUri());
client.setProtocols("fastfail");
client.setTimeout(TimeUnit.SECONDS,1);
try
{
try (StacklessLogging scope = new StacklessLogging(EventDriver.class))
{
client.connect();
client.sendStandardRequest();
client.expectUpgradeResponse();
IncomingFramesCapture capture = client.readFrames(1,TimeUnit.SECONDS,1);
WebSocketFrame frame = capture.getFrames().poll();
Assert.assertThat("frames[0].opcode",frame.getOpCode(),is(OpCode.CLOSE));
CloseInfo close = new CloseInfo(frame);
Assert.assertThat("Close Status Code",close.getStatusCode(),is(StatusCode.SERVER_ERROR));
client.write(close.asFrame()); // respond with close
Assert.assertThat("Fast Fail Latch",closeSocket.closeLatch.await(1,TimeUnit.SECONDS),is(true));
Assert.assertThat("Fast Fail.statusCode",closeSocket.closeStatusCode,is(StatusCode.SERVER_ERROR));
Assert.assertThat("Fast Fail.errors",closeSocket.errors.size(),is(1));
}
}
finally
{

View File

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

29
pom.xml
View File

@ -8,12 +8,12 @@
<artifactId>jetty-project</artifactId>
<version>9.0.4-SNAPSHOT</version>
<name>Jetty :: Project</name>
<url>${jetty.url}</url>
<url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.url>http://www.eclipse.org/jetty</jetty.url>
<orbit-servlet-api-version>3.0.0.v201112011016</orbit-servlet-api-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<build-support-version>1.1</build-support-version>
<slf4j-version>1.6.1</slf4j-version>
<jetty-test-policy-version>1.2</jetty-test-policy-version>
@ -709,5 +709,30 @@
</plugins>
</build>
</profile>
<profile>
<id>api-change</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>compare-api</id>
<phase>package</phase>
<goals>
<goal>clirr</goal>
</goals>
</execution>
</executions>
<configuration>
<minSeverity>info</minSeverity>
<comparisonVersion>9.0.3.v20130506</comparisonVersion>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,64 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>7.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-continuation-jetty6</artifactId>
<packaging>jar</packaging>
<name>Test :: Continuation - (Jetty 6)</name>
<description>Asynchronous API</description>
<url>http://www.eclipse.org/jetty</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<!-- DO NOT DEPLOY (or Release) -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>test-continuation</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.26</version>
<type>jar</type>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>servlet-api-2.5</artifactId>
<groupId>org.mortbay.jetty</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>

38
test-continuation/pom.xml Normal file
View File

@ -0,0 +1,38 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-continuation</artifactId>
<packaging>jar</packaging>
<name>Test :: Continuation</name>
<description>Asynchronous API</description>
<url>http://www.eclipse.org/jetty</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<!-- DO NOT DEPLOY (or Release) -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,24 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>7.6.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-jetty-servlet</artifactId>
<packaging>jar</packaging>
<name>Test :: Jetty Servlet Tester</name>
<url>http://www.eclipse.org/jetty</url>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -27,6 +27,7 @@
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>tests-parent</artifactId>
<name>Jetty Tests :: Parent</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging>
<build>
<plugins>

View File

@ -26,6 +26,7 @@
<artifactId>test-integration</artifactId>
<packaging>jar</packaging>
<name>Jetty Tests :: Integrations</name>
<url>http://www.eclipse.org/jetty</url>
<properties>
<test-wars-dir>${project.build.directory}/test-wars</test-wars-dir>
<test-libs-dir>${project.build.directory}/test-libs</test-libs-dir>

View File

@ -25,6 +25,7 @@
</parent>
<artifactId>test-loginservice</artifactId>
<name>Jetty Tests :: Login Service</name>
<url>http://www.eclipse.org/jetty</url>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>

View File

@ -25,6 +25,7 @@
</parent>
<artifactId>test-sessions-parent</artifactId>
<name>Jetty Tests :: Sessions :: Parent</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging>
<build>
</build>

View File

@ -25,6 +25,7 @@
</parent>
<artifactId>test-hash-sessions</artifactId>
<name>Jetty Tests :: Sessions :: Hash</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<plugins>
<plugin>

View File

@ -25,6 +25,7 @@
</parent>
<artifactId>test-jdbc-sessions</artifactId>
<name>Jetty Tests :: Sessions :: JDBC</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<plugins>
<plugin>

View File

@ -25,6 +25,7 @@
</parent>
<artifactId>test-mongodb-sessions</artifactId>
<name>Jetty Tests :: Sessions :: Mongo</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<plugins>
<plugin>

View File

@ -25,6 +25,7 @@
</parent>
<artifactId>test-sessions-common</artifactId>
<name>Jetty Tests :: Sessions :: Common</name>
<url>http://www.eclipse.org/jetty</url>
<build>
</build>
<dependencies>

View File

@ -26,6 +26,7 @@
</parent>
<artifactId>test-webapps-parent</artifactId>
<name>Jetty Tests :: WebApps :: Parent</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging>
<build>
<plugins>

View File

@ -27,6 +27,7 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>test-jetty-webapp</artifactId>
<name>Test :: Jetty Test Webapp</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>war</packaging>
<build>
<plugins>

View File

@ -19,13 +19,11 @@
package com.acme;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicReference;
import javax.servlet.AsyncContext;
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
@ -34,57 +32,70 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
// Simple asynchronous Chat room.
// This does not handle duplicate usernames or multiple frames/tabs from the same browser
// Some code is duplicated for clarity.
@SuppressWarnings("serial")
public class ChatServlet extends HttpServlet
{
private static final Logger LOG = Log.getLogger(ChatServlet.class);
private long asyncTimeout = 10000;
public void init()
{
String parameter = getServletConfig().getInitParameter("asyncTimeout");
if (parameter != null)
asyncTimeout = Long.parseLong(parameter);
}
// inner class to hold message queue for each chat room member
class Member implements AsyncListener
{
final String _name;
final AtomicReference<AsyncContext> _async=new AtomicReference<>();
final Queue<String> _queue = new LinkedList<String>();
final AtomicReference<AsyncContext> _async = new AtomicReference<>();
final Queue<String> _queue = new LinkedList<>();
Member(String name)
{
_name=name;
_name = name;
}
@Override
public void onTimeout(AsyncEvent event) throws IOException
{
LOG.debug("resume request");
AsyncContext async = _async.get();
if (async!=null && _async.compareAndSet(async,null))
if (async != null && _async.compareAndSet(async, null))
{
HttpServletResponse response = (HttpServletResponse)async.getResponse();
response.setContentType("text/json;charset=utf-8");
PrintWriter out=response.getWriter();
out.print("{action:\"poll\"}");
response.getOutputStream().write("{action:\"poll\"}".getBytes());
async.complete();
}
}
@Override
public void onStartAsync(AsyncEvent event) throws IOException
{
event.getAsyncContext().addListener(this);
}
@Override
public void onError(AsyncEvent event) throws IOException
{
}
@Override
public void onComplete(AsyncEvent event) throws IOException
{
}
}
Map<String,Map<String,Member>> _rooms = new HashMap<String,Map<String, Member>>();
Map<String, Map<String, Member>> _rooms = new HashMap<>();
// Handle Ajax calls from browser
@ -92,113 +103,119 @@ public class ChatServlet extends HttpServlet
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// Ajax calls are form encoded
String action = request.getParameter("action");
boolean join = Boolean.parseBoolean(request.getParameter("join"));
String message = request.getParameter("message");
String username = request.getParameter("user");
if (action.equals("join"))
join(request,response,username);
else if (action.equals("poll"))
poll(request,response,username);
else if (action.equals("chat"))
chat(request,response,username,message);
}
private synchronized void join(HttpServletRequest request,HttpServletResponse response,String username)
throws IOException
{
Member member = new Member(username);
Map<String,Member> room=_rooms.get(request.getPathInfo());
if (room==null)
LOG.debug("doPost called. join={},message={},username={}", join, message, username);
if (username == null)
{
room=new HashMap<String,Member>();
_rooms.put(request.getPathInfo(),room);
}
room.put(username,member);
response.setContentType("text/json;charset=utf-8");
PrintWriter out=response.getWriter();
out.print("{action:\"join\"}");
}
private synchronized void poll(HttpServletRequest request,HttpServletResponse response,String username)
throws IOException
{
Map<String,Member> room=_rooms.get(request.getPathInfo());
if (room==null)
{
response.sendError(503);
return;
}
final Member member = room.get(username);
if (member==null)
{
response.sendError(503);
LOG.debug("no paramter user set, sending 503");
response.sendError(503, "user==null");
return;
}
synchronized(member)
Map<String, Member> room = getRoom(request.getPathInfo());
Member member = getMember(username, room);
if (message != null)
{
if (member._queue.size()>0)
sendMessageToAllMembers(message, username, room);
}
// If a message is set, we only want to enter poll mode if the user is a new user. This is necessary to avoid
// two parallel requests per user (one is already in async wait and the new one). Sending a message will
// dispatch to an existing poll request if necessary and the client will issue a new request to receive the
// next message or long poll again.
if (message == null || join)
{
synchronized (member)
{
// Send one chat message
response.setContentType("text/json;charset=utf-8");
StringBuilder buf=new StringBuilder();
buf.append("{\"action\":\"poll\",");
buf.append("\"from\":\"");
buf.append(member._queue.poll());
buf.append("\",");
String message = member._queue.poll();
int quote=message.indexOf('"');
while (quote>=0)
LOG.debug("Queue size: {}", member._queue.size());
if (member._queue.size() > 0)
{
message=message.substring(0,quote)+'\\'+message.substring(quote);
quote=message.indexOf('"',quote+2);
sendSingleMessage(response, member);
}
else
{
LOG.debug("starting async");
AsyncContext async = request.startAsync();
async.setTimeout(asyncTimeout);
async.addListener(member);
if (!member._async.compareAndSet(null, async))
throw new IllegalStateException();
}
buf.append("\"chat\":\"");
buf.append(message);
buf.append("\"}");
byte[] bytes = buf.toString().getBytes("utf-8");
response.setContentLength(bytes.length);
response.getOutputStream().write(bytes);
}
else
{
AsyncContext async = request.startAsync();
async.setTimeout(10000);
async.addListener(member);
if (!member._async.compareAndSet(null,async))
throw new IllegalStateException();
}
}
}
private synchronized void chat(HttpServletRequest request,HttpServletResponse response,String username,String message)
throws IOException
private Member getMember(String username, Map<String, Member> room)
{
Map<String,Member> room=_rooms.get(request.getPathInfo());
if (room!=null)
Member member = room.get(username);
if (member == null)
{
// Post chat to all members
for (Member m:room.values())
{
synchronized (m)
{
m._queue.add(username); // from
m._queue.add(message); // chat
LOG.debug("user: {} in room: {} doesn't exist. Creating new user.", username, room);
member = new Member(username);
room.put(username, member);
}
return member;
}
// wakeup member if polling
AsyncContext async=m._async.get();
if (async!=null & m._async.compareAndSet(async,null))
async.dispatch();
private Map<String, Member> getRoom(String path)
{
Map<String, Member> room = _rooms.get(path);
if (room == null)
{
LOG.debug("room: {} doesn't exist. Creating new room.", path);
room = new HashMap<>();
_rooms.put(path, room);
}
return room;
}
private void sendSingleMessage(HttpServletResponse response, Member member) throws IOException
{
response.setContentType("text/json;charset=utf-8");
StringBuilder buf = new StringBuilder();
buf.append("{\"from\":\"");
buf.append(member._queue.poll());
buf.append("\",");
String returnMessage = member._queue.poll();
int quote = returnMessage.indexOf('"');
while (quote >= 0)
{
returnMessage = returnMessage.substring(0, quote) + '\\' + returnMessage.substring(quote);
quote = returnMessage.indexOf('"', quote + 2);
}
buf.append("\"chat\":\"");
buf.append(returnMessage);
buf.append("\"}");
byte[] bytes = buf.toString().getBytes("utf-8");
response.setContentLength(bytes.length);
response.getOutputStream().write(bytes);
}
private void sendMessageToAllMembers(String message, String username, Map<String, Member> room)
{
LOG.debug("Sending message: {} from: {}", message, username);
for (Member m : room.values())
{
synchronized (m)
{
m._queue.add(username); // from
m._queue.add(message); // chat
// wakeup member if polling
AsyncContext async = m._async.get();
LOG.debug("Async found: {}", async);
if (async != null & m._async.compareAndSet(async, null))
{
LOG.debug("dispatch");
async.dispatch();
}
}
}
response.setContentType("text/json;charset=utf-8");
PrintWriter out=response.getWriter();
out.print("{action:\"chat\"}");
}
// Serve the HTML with embedded CSS and Javascript.
@ -206,10 +223,10 @@ public class ChatServlet extends HttpServlet
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
if (request.getParameter("action")!=null)
doPost(request,response);
if (request.getParameter("action") != null)
doPost(request, response);
else
getServletContext().getNamedDispatcher("default").forward(request,response);
getServletContext().getNamedDispatcher("default").forward(request, response);
}
}

View File

@ -0,0 +1,2 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
com.acme.LEVEL=INFO

View File

@ -30,38 +30,28 @@
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req.send(body);
}
;
function send(action, user, message, handler)
function send(user, message, handler, join)
{
if (message) message = message.replace('%', '%25').replace('&', '%26').replace('=', '%3D');
if (user) user = user.replace('%', '%25').replace('&', '%26').replace('=', '%3D');
xhr('POST', 'chat', 'action=' + action + '&user=' + user + '&message=' + message, handler);
var requestBody = 'user=' + user + (message ? '&message=' + message : '') + (join ? '&join=true' : '');
xhr('POST', 'chat', requestBody , handler);
}
;
var room = {
join:function (name)
join: function (name)
{
this._username = name;
$('join').className = 'hidden';
$('joined').className = '';
$('phrase').focus();
send('join', room._username, null, room._joined);
send(room._username, 'has joined!', room._poll, true);
},
_joined:function ()
{
send('chat', room._username, 'has joined!', room._startPolling);
},
_startPolling:function ()
{
send('poll', room._username, null, room._poll);
},
chat:function (text)
chat: function (text)
{
if (text != null && text.length > 0)
send('chat', room._username, text);
send(room._username, text, room._poll, false);
},
_poll:function (m)
_poll: function (m)
{
//console.debug(m);
if (m.chat)
@ -79,10 +69,9 @@
chat.appendChild(lineBreak);
chat.scrollTop = chat.scrollHeight - chat.clientHeight;
}
if (m.action == 'poll')
send('poll', room._username, null, room._poll);
send(room._username, null, room._poll, false);
},
_end:''
_end: ''
};
</script>
<style type='text/css'>
@ -106,7 +95,7 @@
padding: 4px;
background-color: #e0e0e0;
border: 1px solid black;
border-top: 0px
border-top: 0
}
input#phrase {
@ -122,14 +111,6 @@
div.hidden {
display: none;
}
span.from {
font-weight: bold;
}
span.alert {
font-style: italic;
}
</style>
</head>
<body>

View File

@ -0,0 +1,93 @@
//
// ========================================================================
// 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;
import com.acme.ChatServlet;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.ServletTester;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
@RunWith(JUnit4.class)
public class ChatServletTest
{
private final ServletTester tester = new ServletTester();
@Before
public void setUp() throws Exception
{
tester.setContextPath("/");
ServletHolder dispatch = tester.addServlet(ChatServlet.class, "/chat/*");
dispatch.setInitParameter("asyncTimeout", "500");
tester.start();
}
@After
public void tearDown() throws Exception
{
tester.stop();
}
@Test
public void testLogin() throws Exception
{
assertResponse("user=test&join=true&message=has%20joined!", "{\"from\":\"test\",\"chat\":\"has joined!\"}");
}
@Test
public void testChat() throws Exception
{
assertResponse("user=test&join=true&message=has%20joined!", "{\"from\":\"test\",\"chat\":\"has joined!\"}");
String response = tester.getResponses(createRequestString("user=test&message=message"));
assertThat(response.contains("{"), is(false)); // make sure we didn't get a json body
}
@Test
public void testPoll() throws Exception
{
assertResponse("user=test", "{action:\"poll\"}");
}
private void assertResponse(String requestBody, String expectedResponse) throws Exception
{
String response = tester.getResponses(createRequestString(requestBody));
assertThat(response.contains(expectedResponse), is(true));
}
private String createRequestString(String body)
{
StringBuilder req1 = new StringBuilder();
req1.append("POST /chat/ HTTP/1.1\r\n");
req1.append("Host: tester\r\n");
req1.append("Content-length: " + body.length() + "\r\n");
req1.append("Content-type: application/x-www-form-urlencoded\r\n");
req1.append("Connection: close\r\n");
req1.append("\r\n");
req1.append(body);
return req1.toString();
}
}

View File

@ -25,6 +25,7 @@
</parent>
<artifactId>test-webapp-rfc2616</artifactId>
<name>Jetty Tests :: WebApp :: RFC2616</name>
<url>http://www.eclipse.org/jetty</url>
<packaging>war</packaging>
<build>
<plugins>