Merge branch 'master' into javawebsocket-jsr
Conflicts: jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/ReferrerPushStrategyTest.java jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/EventDriver.java jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/ServletWebSocketRequest.java jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketLoadRFC6455Test.java
This commit is contained in:
commit
2da8c9c306
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.security.CodeSource;
|
|||
import java.security.PermissionCollection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
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.PlusConfiguration;
|
||||
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.ServletHandler;
|
||||
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.Logger;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
|
@ -676,6 +680,13 @@ public class AntWebAppContext extends WebAppContext
|
|||
TaskLog.logWithTimestamp("Stopping web application "+this);
|
||||
Thread.currentThread().sleep(500L);
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -166,7 +166,17 @@ public class Servlet3Continuation implements Continuation
|
|||
@Override
|
||||
public boolean isSuspended()
|
||||
{
|
||||
return _request.isAsyncStarted();
|
||||
if (_request.isAsyncStarted())
|
||||
return true;
|
||||
try
|
||||
{
|
||||
return _request.getAsyncContext()!=null;
|
||||
}
|
||||
catch(IllegalStateException e)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -25,10 +25,12 @@ import org.eclipse.jetty.deploy.AppProvider;
|
|||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.deploy.test.XmlConfiguredJetty;
|
||||
import org.eclipse.jetty.toolchain.test.OS;
|
||||
import org.eclipse.jetty.toolchain.test.TestTracker;
|
||||
import org.eclipse.jetty.toolchain.test.TestingDir;
|
||||
import org.eclipse.jetty.util.Scanner;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.junit.After;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Before;
|
||||
|
@ -43,6 +45,9 @@ public class ScanningAppProviderRuntimeUpdatesTest
|
|||
{
|
||||
private static final Logger LOG = Log.getLogger(ScanningAppProviderRuntimeUpdatesTest.class);
|
||||
|
||||
@Rule
|
||||
public TestTracker tracker = new TestTracker();
|
||||
|
||||
@Rule
|
||||
public TestingDir testdir = new TestingDir();
|
||||
private static XmlConfiguredJetty jetty;
|
||||
|
@ -52,6 +57,9 @@ public class ScanningAppProviderRuntimeUpdatesTest
|
|||
@Before
|
||||
public void setupEnvironment() throws Exception
|
||||
{
|
||||
testdir.ensureEmpty();
|
||||
Resource.setDefaultUseCaches(false);
|
||||
|
||||
jetty = new XmlConfiguredJetty(testdir);
|
||||
jetty.addConfiguration("jetty.xml");
|
||||
jetty.addConfiguration("jetty-http.xml");
|
||||
|
@ -91,7 +99,7 @@ public class ScanningAppProviderRuntimeUpdatesTest
|
|||
|
||||
public void waitForDirectoryScan()
|
||||
{
|
||||
int scan=_scans.get()+2*_providers;
|
||||
int scan=_scans.get()+(2*_providers);
|
||||
do
|
||||
{
|
||||
try
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.eclipse.jetty.deploy.test;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -207,6 +209,7 @@ public class XmlConfiguredJetty
|
|||
if (context.getContextPath().equals(expectedPath))
|
||||
{
|
||||
found = true;
|
||||
Assert.assertThat("Context[" + context.getContextPath() + "].state", context.getState(), is("STARTED"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -371,7 +371,7 @@ fi
|
|||
#####################################################
|
||||
if [ "$JETTY_PORT" ]
|
||||
then
|
||||
JAVA_OPTIONS+=("-Djetty.port=$JETTY_PORT")
|
||||
JETTY_ARGS+=("jetty.port=$JETTY_PORT")
|
||||
fi
|
||||
|
||||
#####################################################
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -29,6 +30,10 @@ import java.util.Set;
|
|||
import java.util.TreeSet;
|
||||
|
||||
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.log.Log;
|
||||
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
|
||||
Thread.currentThread().sleep(500L);
|
||||
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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -40,6 +40,7 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme
|
|||
private int _savePeriod=0;
|
||||
private int _idlePeriod=-1;
|
||||
private boolean _invalidateOnStop;
|
||||
private boolean _preserveOnStop;
|
||||
private boolean _saveAllAttributes;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -104,7 +105,10 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme
|
|||
for (NoSqlSession session : sessions)
|
||||
{
|
||||
session.save(false);
|
||||
removeSession(session,false);
|
||||
|
||||
if (!_preserveOnStop) {
|
||||
removeSession(session,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -277,6 +281,16 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme
|
|||
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.
|
||||
|
@ -287,6 +301,16 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme
|
|||
_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.
|
||||
|
|
|
@ -137,25 +137,25 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
BasicDBObject sets = new BasicDBObject();
|
||||
BasicDBObject unsets = new BasicDBObject();
|
||||
|
||||
// handle new or existing
|
||||
if (version == null)
|
||||
{
|
||||
// New session
|
||||
upsert = true;
|
||||
version = new Long(1);
|
||||
sets.put(__CREATED,session.getCreationTime());
|
||||
sets.put(__VALID,true);
|
||||
sets.put(getContextKey(__VERSION),version);
|
||||
}
|
||||
else
|
||||
{
|
||||
version = new Long(((Number)version).longValue() + 1);
|
||||
update.put("$inc",__version_1);
|
||||
}
|
||||
|
||||
// handle valid or invalid
|
||||
if (session.isValid())
|
||||
{
|
||||
// handle new or existing
|
||||
if (version == null)
|
||||
{
|
||||
// New session
|
||||
upsert = true;
|
||||
version = new Long(1);
|
||||
sets.put(__CREATED,session.getCreationTime());
|
||||
sets.put(__VALID,true);
|
||||
sets.put(getContextKey(__VERSION),version);
|
||||
}
|
||||
else
|
||||
{
|
||||
version = new Long(((Number)version).longValue() + 1);
|
||||
update.put("$inc",__version_1);
|
||||
}
|
||||
|
||||
sets.put(__ACCESSED,session.getAccessed());
|
||||
Set<String> names = session.takeDirty();
|
||||
if (isSaveAllAttributes() || upsert)
|
||||
|
@ -253,6 +253,7 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
|
||||
DBObject attrs = (DBObject)getNestedValue(o,getContextKey());
|
||||
|
||||
|
||||
if (attrs != null)
|
||||
{
|
||||
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();
|
||||
|
||||
return version;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -272,8 +272,13 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
|
|||
if (tmp != null)
|
||||
{
|
||||
File defaultWebXml = getFile (tmp, bundleInstallLocation);
|
||||
if (defaultWebXml != null && defaultWebXml.exists())
|
||||
_webApp.setDefaultsDescriptor(defaultWebXml.getAbsolutePath());
|
||||
if (defaultWebXml != null)
|
||||
{
|
||||
if (defaultWebXml.exists())
|
||||
_webApp.setDefaultsDescriptor(defaultWebXml.getAbsolutePath());
|
||||
else
|
||||
LOG.warn(defaultWebXml.getAbsolutePath()+" does not exist");
|
||||
}
|
||||
}
|
||||
|
||||
//Handle Require-TldBundle
|
||||
|
@ -377,6 +382,7 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
|
|||
HashMap properties = new HashMap();
|
||||
properties.put("Server", getDeploymentManager().getServer());
|
||||
properties.put(OSGiWebappConstants.JETTY_BUNDLE_ROOT, rootResource.toString());
|
||||
properties.put(OSGiServerConstants.JETTY_HOME, getDeploymentManager().getServer().getAttribute(OSGiServerConstants.JETTY_HOME));
|
||||
xmlConfiguration.getProperties().putAll(properties);
|
||||
xmlConfiguration.configure(_webApp);
|
||||
}
|
||||
|
@ -390,11 +396,21 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
|
|||
{
|
||||
if (file == null)
|
||||
return null;
|
||||
|
||||
if (file.startsWith("/") || file.startsWith("file:/"))
|
||||
|
||||
if (file.startsWith("/") || file.startsWith("file:/")) //absolute location
|
||||
return new File(file);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<properties>
|
||||
<assembly-directory>target/distribution</assembly-directory>
|
||||
</properties>
|
||||
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -435,12 +435,21 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable
|
|||
LOG.ignore(e);
|
||||
path = _uri.getDecodedPath(StringUtil.__ISO_8859_1);
|
||||
}
|
||||
|
||||
String info = URIUtil.canonicalPath(path);
|
||||
|
||||
if (info == null)
|
||||
{
|
||||
info = "/";
|
||||
_request.setRequestURI("");
|
||||
if( path==null && _uri.getScheme()!=null &&_uri.getHost()!=null)
|
||||
{
|
||||
info = "/";
|
||||
_request.setRequestURI("");
|
||||
}
|
||||
else
|
||||
{
|
||||
badMessage(400,null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_request.setPathInfo(info);
|
||||
_version = version == null ? HttpVersion.HTTP_0_9 : version;
|
||||
|
@ -663,7 +672,6 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable
|
|||
* @param content the content buffer to write
|
||||
* @param complete whether the content is complete for the response
|
||||
* @param callback Callback when complete or failed
|
||||
* @throws IOException if the write fails
|
||||
*/
|
||||
protected void write(ByteBuffer content, boolean complete, Callback callback)
|
||||
{
|
||||
|
@ -689,6 +697,14 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable
|
|||
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 final Callback _callback;
|
||||
|
|
|
@ -311,7 +311,6 @@ public class HttpChannelState
|
|||
boolean dispatch;
|
||||
synchronized (this)
|
||||
{
|
||||
|
||||
switch(_state)
|
||||
{
|
||||
case ASYNCSTARTED:
|
||||
|
@ -326,11 +325,7 @@ public class HttpChannelState
|
|||
_event.setDispatchTarget(context,path);
|
||||
_dispatched=true;
|
||||
break;
|
||||
|
||||
case REDISPATCH:
|
||||
_event.setDispatchTarget(context,path);
|
||||
return;
|
||||
|
||||
|
||||
default:
|
||||
throw new IllegalStateException(this.getStatusString());
|
||||
}
|
||||
|
@ -575,8 +570,6 @@ public class HttpChannelState
|
|||
switch(_state)
|
||||
{
|
||||
case ASYNCSTARTED:
|
||||
case REDISPATCHING:
|
||||
case COMPLETECALLED:
|
||||
case ASYNCWAIT:
|
||||
return true;
|
||||
|
||||
|
|
|
@ -578,6 +578,12 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
_generator.setPersistent(false);
|
||||
super.handleException(x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed()
|
||||
{
|
||||
getEndPoint().shutdownOutput();
|
||||
}
|
||||
}
|
||||
|
||||
private class CommitCallback extends IteratingCallback
|
||||
|
|
|
@ -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;
|
||||
|
@ -99,7 +99,7 @@ public class HttpOutput extends ServletOutputStream
|
|||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
_channel.getEndPoint().shutdownOutput();
|
||||
_channel.failed();
|
||||
LOG.ignore(e);
|
||||
}
|
||||
releaseBuffer();
|
||||
|
@ -120,7 +120,7 @@ public class HttpOutput extends ServletOutputStream
|
|||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
_channel.getEndPoint().shutdownOutput();
|
||||
_channel.failed();
|
||||
LOG.ignore(e);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.server;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -72,6 +73,7 @@ import org.eclipse.jetty.server.handler.ContextHandler.Context;
|
|||
import org.eclipse.jetty.server.session.AbstractSession;
|
||||
import org.eclipse.jetty.util.Attributes;
|
||||
import org.eclipse.jetty.util.AttributesMap;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.MultiException;
|
||||
import org.eclipse.jetty.util.MultiMap;
|
||||
import org.eclipse.jetty.util.MultiPartInputStreamParser;
|
||||
|
@ -349,6 +351,7 @@ public class Request implements HttpServletRequest
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (_parameters == null)
|
||||
|
@ -358,6 +361,28 @@ public class Request implements HttpServletRequest
|
|||
// Merge parameters (needed if parameters extracted after a forward).
|
||||
_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
|
||||
{
|
||||
|
@ -2036,38 +2061,8 @@ public class Request implements HttpServletRequest
|
|||
@Override
|
||||
public Part getPart(String name) throws IOException, ServletException
|
||||
{
|
||||
if (getContentType() == null || !getContentType().startsWith("multipart/form-data"))
|
||||
throw new ServletException("Content-Type != multipart/form-data");
|
||||
getParts();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2078,6 +2073,9 @@ public class Request implements HttpServletRequest
|
|||
if (getContentType() == null || !getContentType().startsWith("multipart/form-data"))
|
||||
throw new ServletException("Content-Type != multipart/form-data");
|
||||
|
||||
if (_multiPartInputStream == null)
|
||||
_multiPartInputStream = (MultiPartInputStreamParser)getAttribute(__MULTIPART_INPUT_STREAM);
|
||||
|
||||
if (_multiPartInputStream == null)
|
||||
{
|
||||
MultipartConfigElement config = (MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT);
|
||||
|
@ -2095,19 +2093,32 @@ public class Request implements HttpServletRequest
|
|||
for (Part p:parts)
|
||||
{
|
||||
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
|
||||
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);
|
||||
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
|
||||
getParameters().add(mp.getName(), content);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IO.close(os);
|
||||
IO.close(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _multiPartInputStream.getParts();
|
||||
}
|
||||
|
||||
|
|
|
@ -169,6 +169,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
private final List<ServletContextAttributeListener> _contextAttributeListeners=new CopyOnWriteArrayList<>();
|
||||
private final List<ServletRequestListener> _requestListeners=new CopyOnWriteArrayList<>();
|
||||
private final List<ServletRequestAttributeListener> _requestAttributeListeners=new CopyOnWriteArrayList<>();
|
||||
private final List<EventListener> _durableListeners = new CopyOnWriteArrayList<>();
|
||||
private Map<String, Object> _managedAttributes;
|
||||
private String[] _protectedTargets;
|
||||
private final CopyOnWriteArrayList<AliasCheck> _aliasChecks = new CopyOnWriteArrayList<ContextHandler.AliasCheck>();
|
||||
|
@ -567,6 +568,9 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
{
|
||||
_eventListeners.add(listener);
|
||||
|
||||
if (!(isStarted() || isStarting()))
|
||||
_durableListeners.add(listener);
|
||||
|
||||
if (listener instanceof ServletContextListener)
|
||||
_contextListeners.add((ServletContextListener)listener);
|
||||
|
||||
|
@ -623,6 +627,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
return _programmaticListeners.contains(listener);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return true if this context is accepting new requests
|
||||
|
@ -821,6 +827,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
for (int i = _contextListeners.size(); i-->0;)
|
||||
callContextDestroyed(_contextListeners.get(i),event);
|
||||
}
|
||||
|
||||
//retain only durable listeners
|
||||
setEventListeners(_durableListeners.toArray(new EventListener[_durableListeners.size()]));
|
||||
_durableListeners.clear();
|
||||
|
||||
if (_errorHandler != null)
|
||||
_errorHandler.stop();
|
||||
|
@ -1821,13 +1831,14 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
query = uriInContext.substring(q + 1);
|
||||
uriInContext = uriInContext.substring(0,q);
|
||||
}
|
||||
// if ((q = uriInContext.indexOf(';')) > 0)
|
||||
// uriInContext = uriInContext.substring(0,q);
|
||||
|
||||
String pathInContext = URIUtil.canonicalPath(URIUtil.decodePath(uriInContext));
|
||||
String uri = URIUtil.addPaths(getContextPath(),uriInContext);
|
||||
ContextHandler context = ContextHandler.this;
|
||||
return new Dispatcher(context,uri,pathInContext,query);
|
||||
if (pathInContext!=null)
|
||||
{
|
||||
String uri = URIUtil.addPaths(getContextPath(),uriInContext);
|
||||
ContextHandler context = ContextHandler.this;
|
||||
return new Dispatcher(context,uri,pathInContext,query);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -138,6 +138,66 @@ public class HttpConnectionTest
|
|||
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
|
||||
public void testEmpty() throws Exception
|
||||
|
|
|
@ -1094,10 +1094,12 @@ public class RequestTest
|
|||
MultipartConfigElement mpce = new MultipartConfigElement(tmpDir.getAbsolutePath(),-1, -1, 2);
|
||||
request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce);
|
||||
|
||||
String field1 = request.getParameter("field1");
|
||||
assertNotNull(field1);
|
||||
|
||||
Part foo = request.getPart("stuff");
|
||||
assertNotNull(foo);
|
||||
assertTrue(foo.getSize() > 0);
|
||||
|
||||
response.setStatus(200);
|
||||
}
|
||||
catch (IllegalStateException e)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -57,7 +57,7 @@ public class FilterHolder extends Holder<Filter>
|
|||
*/
|
||||
public FilterHolder()
|
||||
{
|
||||
super (Source.EMBEDDED);
|
||||
this(Source.EMBEDDED);
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class FilterHolder extends Holder<Filter>
|
|||
*/
|
||||
public FilterHolder(Holder.Source source)
|
||||
{
|
||||
super (source);
|
||||
super(source);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
@ -74,7 +74,7 @@ public class FilterHolder extends Holder<Filter>
|
|||
*/
|
||||
public FilterHolder(Class<? extends Filter> filter)
|
||||
{
|
||||
super (Source.EMBEDDED);
|
||||
this(Source.EMBEDDED);
|
||||
setHeldClass(filter);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class FilterHolder extends Holder<Filter>
|
|||
*/
|
||||
public FilterHolder(Filter filter)
|
||||
{
|
||||
super (Source.EMBEDDED);
|
||||
this(Source.EMBEDDED);
|
||||
setFilter(filter);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
|||
protected String _className;
|
||||
protected String _displayName;
|
||||
protected boolean _extInstance;
|
||||
protected boolean _asyncSupported=true;
|
||||
protected boolean _asyncSupported;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
protected String _name;
|
||||
|
@ -67,8 +67,19 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
|||
protected Holder(Source source)
|
||||
{
|
||||
_source=source;
|
||||
switch(_source)
|
||||
{
|
||||
case JAVAX_API:
|
||||
case DESCRIPTOR:
|
||||
case ANNOTATION:
|
||||
_asyncSupported=false;
|
||||
break;
|
||||
default:
|
||||
_asyncSupported=true;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Source getSource()
|
||||
{
|
||||
return _source;
|
||||
|
|
|
@ -176,19 +176,28 @@ public class ServletContextHandler extends ContextHandler
|
|||
|
||||
if (getSessionHandler()!=null)
|
||||
{
|
||||
handler.setHandler(_sessionHandler);
|
||||
if (handler==this)
|
||||
super.setHandler(_sessionHandler);
|
||||
else
|
||||
handler.setHandler(_sessionHandler);
|
||||
handler=_sessionHandler;
|
||||
}
|
||||
|
||||
|
||||
if (getSecurityHandler()!=null)
|
||||
{
|
||||
handler.setHandler(_securityHandler);
|
||||
if (handler==this)
|
||||
super.setHandler(_securityHandler);
|
||||
else
|
||||
handler.setHandler(_securityHandler);
|
||||
handler=_securityHandler;
|
||||
}
|
||||
|
||||
|
||||
if (getServletHandler()!=null)
|
||||
{
|
||||
handler.setHandler(_servletHandler);
|
||||
if (handler==this)
|
||||
super.setHandler(_servletHandler);
|
||||
else
|
||||
handler.setHandler(_servletHandler);
|
||||
handler=_servletHandler;
|
||||
}
|
||||
}
|
||||
|
@ -488,6 +497,50 @@ public class ServletContextHandler extends ContextHandler
|
|||
relinkHandlers();
|
||||
_servletHandler.setHandler(next);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void setHandler(Handler handler)
|
||||
{
|
||||
if (handler instanceof ServletHandler)
|
||||
setServletHandler((ServletHandler) handler);
|
||||
else if (handler instanceof SessionHandler)
|
||||
setSessionHandler((SessionHandler) handler);
|
||||
else if (handler instanceof SecurityHandler)
|
||||
setSecurityHandler((SecurityHandler)handler);
|
||||
else if (handler == null || handler instanceof HandlerWrapper)
|
||||
{
|
||||
super.setHandler(handler);
|
||||
relinkHandlers();
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Insert a HandlerWrapper before the first Session,Security or ServletHandler
|
||||
* but after any other HandlerWrappers.
|
||||
*/
|
||||
public void insertHandler(HandlerWrapper handler)
|
||||
{
|
||||
HandlerWrapper h=this;
|
||||
|
||||
// Skip any injected handlers
|
||||
while (h.getHandler() instanceof HandlerWrapper)
|
||||
{
|
||||
HandlerWrapper wrapper = (HandlerWrapper)h.getHandler();
|
||||
if (wrapper instanceof SessionHandler ||
|
||||
wrapper instanceof SecurityHandler ||
|
||||
wrapper instanceof ServletHandler)
|
||||
break;
|
||||
h=wrapper;
|
||||
}
|
||||
|
||||
h.setHandler(handler);
|
||||
relinkHandlers();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
@ -1022,8 +1075,6 @@ public class ServletContextHandler extends ContextHandler
|
|||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
//TODO handle partial registrations
|
||||
|
||||
final ServletHandler handler = ServletContextHandler.this.getServletHandler();
|
||||
ServletHolder holder = handler.getServlet(servletName);
|
||||
if (holder == null)
|
||||
|
|
|
@ -21,10 +21,12 @@ package org.eclipse.jetty.servlet;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
|
@ -187,30 +189,81 @@ public class ServletHandler extends ScopedHandler
|
|||
super.doStop();
|
||||
|
||||
// Stop filters
|
||||
List<FilterHolder> filterHolders = new ArrayList<FilterHolder>();
|
||||
List<FilterMapping> filterMappings = ArrayUtil.asMutableList(_filterMappings);
|
||||
if (_filters!=null)
|
||||
{
|
||||
for (int i=_filters.length; i-->0;)
|
||||
{
|
||||
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
|
||||
List<ServletHolder> servletHolders = new ArrayList<ServletHolder>(); //will be remaining servlets
|
||||
List<ServletMapping> servletMappings = ArrayUtil.asMutableList(_servletMappings); //will be remaining mappings
|
||||
if (_servlets!=null)
|
||||
{
|
||||
for (int i=_servlets.length; i-->0;)
|
||||
{
|
||||
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;
|
||||
_filterNameMappings=null;
|
||||
|
||||
_servletPathMap=null;
|
||||
|
||||
_matchBeforeIndex=-1;
|
||||
_matchAfterIndex=-1;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -786,7 +839,7 @@ public class ServletHandler extends ScopedHandler
|
|||
*/
|
||||
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.setClassName(className);
|
||||
addServletWithMapping(holder,pathSpec);
|
||||
|
@ -801,7 +854,6 @@ public class ServletHandler extends ScopedHandler
|
|||
{
|
||||
ServletHolder holder = newServletHolder(Holder.Source.EMBEDDED);
|
||||
holder.setHeldClass(servlet);
|
||||
setServlets(ArrayUtil.addToArray(getServlets(), holder, ServletHolder.class));
|
||||
addServletWithMapping(holder,pathSpec);
|
||||
|
||||
return holder;
|
||||
|
@ -969,7 +1021,7 @@ public class ServletHandler extends ScopedHandler
|
|||
*/
|
||||
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.setClassName(className);
|
||||
|
||||
|
@ -1116,7 +1168,7 @@ public class ServletHandler extends ScopedHandler
|
|||
{
|
||||
//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
|
||||
//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)
|
||||
{
|
||||
|
@ -1159,14 +1211,15 @@ public class ServletHandler extends ScopedHandler
|
|||
{
|
||||
if (pos < 0)
|
||||
throw new IllegalArgumentException("FilterMapping insertion pos < 0");
|
||||
|
||||
FilterMapping[] mappings = getFilterMappings();
|
||||
|
||||
if (mappings==null || mappings.length==0)
|
||||
{
|
||||
return new FilterMapping[] {mapping};
|
||||
}
|
||||
FilterMapping[] new_mappings = new FilterMapping[mappings.length+1];
|
||||
|
||||
|
||||
if (before)
|
||||
{
|
||||
//copy existing filter mappings up to but not including the pos
|
||||
|
@ -1375,6 +1428,7 @@ public class ServletHandler extends ScopedHandler
|
|||
if (holders!=null)
|
||||
for (ServletHolder holder:holders)
|
||||
holder.setServletHandler(this);
|
||||
|
||||
updateBeans(_servlets,holders);
|
||||
_servlets=holders;
|
||||
updateNameMappings();
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
*/
|
||||
public ServletHolder()
|
||||
{
|
||||
super (Source.EMBEDDED);
|
||||
this(Source.EMBEDDED);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
@ -101,7 +101,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
*/
|
||||
public ServletHolder(Holder.Source creator)
|
||||
{
|
||||
super (creator);
|
||||
super(creator);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
@ -109,7 +109,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
*/
|
||||
public ServletHolder(Servlet servlet)
|
||||
{
|
||||
super (Source.EMBEDDED);
|
||||
this(Source.EMBEDDED);
|
||||
setServlet(servlet);
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
*/
|
||||
public ServletHolder(String name, Class<? extends Servlet> servlet)
|
||||
{
|
||||
super (Source.EMBEDDED);
|
||||
this(Source.EMBEDDED);
|
||||
setName(name);
|
||||
setHeldClass(servlet);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
*/
|
||||
public ServletHolder(String name, Servlet servlet)
|
||||
{
|
||||
super (Source.EMBEDDED);
|
||||
this(Source.EMBEDDED);
|
||||
setName(name);
|
||||
setServlet(servlet);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
*/
|
||||
public ServletHolder(Class<? extends Servlet> servlet)
|
||||
{
|
||||
super (Source.EMBEDDED);
|
||||
this(Source.EMBEDDED);
|
||||
setHeldClass(servlet);
|
||||
}
|
||||
|
||||
|
@ -665,6 +665,8 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
Servlet servlet=_servlet;
|
||||
synchronized(this)
|
||||
{
|
||||
if (!isStarted())
|
||||
throw new UnavailableException("Servlet not initialized", -1);
|
||||
if (_unavailable!=0 || !_initOnStartup)
|
||||
servlet=getServlet();
|
||||
if (servlet==null)
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
|
||||
package org.eclipse.jetty.servlet;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
@ -55,6 +57,7 @@ import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
|||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.UrlEncoded;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
@ -217,6 +220,32 @@ public class DispatcherTest
|
|||
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
|
||||
public void testServletInclude() throws Exception
|
||||
{
|
||||
|
@ -409,7 +438,10 @@ public class DispatcherTest
|
|||
else if(request.getParameter("forward")!=null)
|
||||
{
|
||||
dispatcher = getServletContext().getRequestDispatcher(request.getParameter("forward"));
|
||||
dispatcher.forward(new ServletRequestWrapper(request), new ServletResponseWrapper(response));
|
||||
if (dispatcher!=null)
|
||||
dispatcher.forward(new ServletRequestWrapper(request), new ServletResponseWrapper(response));
|
||||
else
|
||||
response.sendError(404);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -581,8 +613,19 @@ public class DispatcherTest
|
|||
assertTrue(requestAttributeNames.containsAll(expectedAttributeNames));
|
||||
|
||||
assertEquals(null, request.getPathInfo());
|
||||
assertEquals(null, request.getPathTranslated());
|
||||
assertTrue(request.getQueryString().startsWith("do=end&else=%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D0%BD%D0%BE%3D%D0%A2%D0%B5%D0%BC%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D1%83%D1%80%D0%B0&test=1&foreign="));
|
||||
assertEquals(null, request.getPathTranslated());
|
||||
|
||||
UrlEncoded query = new UrlEncoded();
|
||||
query.decode(request.getQueryString());
|
||||
assertThat(query.getString("do"), is("end"));
|
||||
|
||||
// Russian for "selected=Temperature"
|
||||
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(query.getString("test"), is("1"));
|
||||
assertThat(query.containsKey("foreign"), is(true));
|
||||
|
||||
String[] vals = request.getParameterValues("foreign");
|
||||
assertTrue(vals!=null);
|
||||
|
|
|
@ -23,12 +23,17 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -41,8 +46,11 @@ import org.eclipse.jetty.server.Server;
|
|||
import org.eclipse.jetty.server.handler.AbstractHandlerContainer;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.hamcrest.core.IsEqual;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
@ -229,6 +237,49 @@ public class ServletContextHandlerTest
|
|||
response = _connector.getResponses(request.toString());
|
||||
assertResponseContains("Hello World", response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceHandler () throws Exception
|
||||
{
|
||||
ServletContextHandler servletContextHandler = new ServletContextHandler();
|
||||
ServletHolder sh = new ServletHolder(new TestServlet());
|
||||
servletContextHandler.addServlet(sh, "/foo");
|
||||
final AtomicBoolean contextInit = new AtomicBoolean(false);
|
||||
final AtomicBoolean contextDestroy = new AtomicBoolean(false);
|
||||
|
||||
servletContextHandler.addEventListener(new ServletContextListener() {
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce)
|
||||
{
|
||||
if (sce.getServletContext() != null)
|
||||
contextInit.set(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sce)
|
||||
{
|
||||
if (sce.getServletContext() != null)
|
||||
contextDestroy.set(true);
|
||||
}
|
||||
|
||||
});
|
||||
ServletHandler shandler = servletContextHandler.getServletHandler();
|
||||
|
||||
ResourceHandler rh = new ResourceHandler();
|
||||
|
||||
servletContextHandler.setHandler(rh);
|
||||
assertEquals(shandler, servletContextHandler.getServletHandler());
|
||||
assertEquals(rh, servletContextHandler.getHandler());
|
||||
assertEquals(rh.getHandler(), shandler);
|
||||
_server.setHandler(servletContextHandler);
|
||||
_server.start();
|
||||
assertTrue(contextInit.get());
|
||||
_server.stop();
|
||||
assertTrue(contextDestroy.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int assertResponseContains(String expected, String response)
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -22,6 +22,9 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
@ -32,8 +35,11 @@ import javax.servlet.http.HttpServlet;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.MultiMap;
|
||||
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.Logger;
|
||||
|
||||
|
@ -222,35 +228,55 @@ public class CGI extends HttpServlet
|
|||
if ((pathTranslated == null) || (pathTranslated.length() == 0))
|
||||
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);
|
||||
// these ones are from "The WWW Common Gateway Interface Version 1.1"
|
||||
// look at :
|
||||
// http://Web.Golux.Com/coar/cgi/draft-coar-cgi-v11-03-clean.html#6.1.1
|
||||
env.set("AUTH_TYPE",req.getAuthType());
|
||||
env.set("CONTENT_LENGTH",Integer.toString(len));
|
||||
env.set("CONTENT_TYPE",req.getContentType());
|
||||
env.set("GATEWAY_INTERFACE","CGI/1.1");
|
||||
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_TYPE", req.getContentType());
|
||||
env.set("GATEWAY_INTERFACE", "CGI/1.1");
|
||||
if ((pathInfo != null) && (pathInfo.length() > 0))
|
||||
{
|
||||
env.set("PATH_INFO",pathInfo);
|
||||
env.set("PATH_INFO", pathInfo);
|
||||
}
|
||||
env.set("PATH_TRANSLATED",pathTranslated);
|
||||
env.set("QUERY_STRING",req.getQueryString());
|
||||
env.set("REMOTE_ADDR",req.getRemoteAddr());
|
||||
env.set("REMOTE_HOST",req.getRemoteHost());
|
||||
env.set("PATH_TRANSLATED", pathTranslated);
|
||||
env.set("QUERY_STRING", req.getQueryString());
|
||||
env.set("REMOTE_ADDR", req.getRemoteAddr());
|
||||
env.set("REMOTE_HOST", req.getRemoteHost());
|
||||
// The identity information reported about the connection by a
|
||||
// RFC 1413 [11] request to the remote agent, if
|
||||
// available. Servers MAY choose not to support this feature, or
|
||||
// not to request the data for efficiency reasons.
|
||||
// "REMOTE_IDENT" => "NYI"
|
||||
env.set("REMOTE_USER",req.getRemoteUser());
|
||||
env.set("REQUEST_METHOD",req.getMethod());
|
||||
env.set("SCRIPT_NAME",scriptName);
|
||||
env.set("SCRIPT_FILENAME",scriptPath);
|
||||
env.set("SERVER_NAME",req.getServerName());
|
||||
env.set("SERVER_PORT",Integer.toString(req.getServerPort()));
|
||||
env.set("SERVER_PROTOCOL",req.getProtocol());
|
||||
env.set("SERVER_SOFTWARE",getServletContext().getServerInfo());
|
||||
env.set("REMOTE_USER", req.getRemoteUser());
|
||||
env.set("REQUEST_METHOD", req.getMethod());
|
||||
env.set("SCRIPT_NAME", scriptName);
|
||||
env.set("SCRIPT_FILENAME", scriptPath);
|
||||
env.set("SERVER_NAME", req.getServerName());
|
||||
env.set("SERVER_PORT", Integer.toString(req.getServerPort()));
|
||||
env.set("SERVER_PROTOCOL", req.getProtocol());
|
||||
env.set("SERVER_SOFTWARE", getServletContext().getServerInfo());
|
||||
|
||||
Enumeration enm = req.getHeaderNames();
|
||||
while (enm.hasMoreElements())
|
||||
|
@ -261,7 +287,7 @@ public class CGI extends HttpServlet
|
|||
}
|
||||
|
||||
// these extra ones were from printenv on www.dev.nomura.co.uk
|
||||
env.set("HTTPS",(req.isSecure()?"ON":"OFF"));
|
||||
env.set("HTTPS", (req.isSecure()?"ON":"OFF"));
|
||||
// "DOCUMENT_ROOT" => root + "/docs",
|
||||
// "SERVER_URL" => "NYI - http://us0245",
|
||||
// "TZ" => System.getProperty("user.timezone"),
|
||||
|
@ -275,31 +301,22 @@ public class CGI extends HttpServlet
|
|||
if (_cmdPrefix != null)
|
||||
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)
|
||||
final InputStream inFromReq = req.getInputStream();
|
||||
final OutputStream outToCgi = p.getOutputStream();
|
||||
final int inLength = len;
|
||||
if (bodyFormEncoded != null)
|
||||
writeProcessInput(p, bodyFormEncoded);
|
||||
else if (len > 0)
|
||||
writeProcessInput(p, req.getInputStream(), len);
|
||||
|
||||
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();
|
||||
IO.copyThread(p.getErrorStream(), System.err);
|
||||
|
||||
// hook processes output to browser's input (sync)
|
||||
// if browser closes stream, we should detect it and kill process...
|
||||
|
@ -376,15 +393,56 @@ public class CGI extends HttpServlet
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
LOG.debug(e);
|
||||
}
|
||||
}
|
||||
os = null;
|
||||
p.destroy();
|
||||
// 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.
|
||||
*
|
||||
|
@ -393,7 +451,7 @@ public class CGI extends HttpServlet
|
|||
* @return the line of text
|
||||
* @throws IOException
|
||||
*/
|
||||
private String getTextLineFromStream(InputStream is) throws IOException
|
||||
private static String getTextLineFromStream(InputStream is) throws IOException
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
int b;
|
||||
|
@ -411,16 +469,16 @@ public class CGI extends HttpServlet
|
|||
*/
|
||||
private static class EnvList
|
||||
{
|
||||
private Map envMap;
|
||||
private Map<String, String> envMap;
|
||||
|
||||
EnvList()
|
||||
{
|
||||
envMap = new HashMap();
|
||||
envMap = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
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. */
|
||||
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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<bundle-symbolic-name>${project.groupId}.client</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
|
@ -143,7 +143,7 @@ public class SPDYClient
|
|||
|
||||
protected SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
|
||||
{
|
||||
String peerHost = channel.socket().getInetAddress().getHostAddress();
|
||||
String peerHost = channel.socket().getInetAddress().getHostName();
|
||||
int peerPort = channel.socket().getPort();
|
||||
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost, peerPort);
|
||||
engine.setUseClientMode(true);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -103,7 +103,8 @@
|
|||
<New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
|
||||
<Arg name="version" type="int">3</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>
|
||||
</Item>
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.nio.ByteBuffer;
|
|||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.eclipse.jetty.http.HttpField;
|
||||
|
@ -86,14 +85,14 @@ public class HttpTransportOverSPDY implements HttpTransport
|
|||
return requestHeaders;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void send(ByteBuffer responseBodyContent, boolean lastContent, Callback callback)
|
||||
{
|
||||
// TODO can this be more efficient?
|
||||
send(null,responseBodyContent, lastContent, callback);
|
||||
send(null, responseBodyContent, lastContent, callback);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void send(HttpGenerator.ResponseInfo info, ByteBuffer content, boolean lastContent, Callback callback)
|
||||
{
|
||||
|
@ -306,7 +305,7 @@ public class HttpTransportOverSPDY implements HttpTransport
|
|||
final Fields pushHeaders = createPushHeaders(scheme, host, 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
|
||||
public void succeeded(Stream pushStream)
|
||||
|
@ -315,6 +314,12 @@ public class HttpTransportOverSPDY implements HttpTransport
|
|||
queue.offer(new PushResource(pushStream, pushRequestHeaders));
|
||||
sendNextResourceData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Throwable x)
|
||||
{
|
||||
LOG.debug("Creating push stream failed.", x);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -496,7 +506,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,
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<bundle-symbolic-name>${project.groupId}.server</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0"?>
|
||||
<Configure />
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
org.eclipse.jetty.start.PropertyDump.class
|
||||
|
||||
[*]
|
||||
$(basedir)/src/test/resources
|
||||
|
||||
[default]
|
||||
$(basedir)/src/test/resources
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1080,6 +1080,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
|||
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param extractWAR True if war files are extracted
|
||||
|
|
|
@ -120,25 +120,13 @@ public class WebXmlConfiguration extends AbstractConfiguration
|
|||
/* ------------------------------------------------------------------------------- */
|
||||
@Override
|
||||
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);
|
||||
|
||||
if (context.getErrorHandler() instanceof ErrorPageErrorHandler)
|
||||
((ErrorPageErrorHandler)
|
||||
context.getErrorHandler()).setErrorPages(null);
|
||||
|
||||
|
||||
// TODO remove classpaths from classloader
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -42,6 +42,7 @@ public class UpgradeRequest
|
|||
private String httpVersion;
|
||||
private String method;
|
||||
private String host;
|
||||
private boolean secure = false;
|
||||
|
||||
protected UpgradeRequest()
|
||||
{
|
||||
|
@ -230,6 +231,11 @@ public class UpgradeRequest
|
|||
return test.equalsIgnoreCase(getOrigin());
|
||||
}
|
||||
|
||||
public boolean isSecure()
|
||||
{
|
||||
return secure;
|
||||
}
|
||||
|
||||
public void setCookies(List<HttpCookie> cookies)
|
||||
{
|
||||
this.cookies = cookies;
|
||||
|
@ -278,6 +284,19 @@ public class UpgradeRequest
|
|||
public void setRequestURI(URI 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.parameters.clear();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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/"));
|
||||
}
|
||||
|
||||
}
|
|
@ -154,6 +154,7 @@ public class UpgradeConnection extends AbstractConnection
|
|||
public void onOpen()
|
||||
{
|
||||
super.onOpen();
|
||||
// TODO: handle timeout?
|
||||
getExecutor().execute(new SendUpgradeRequest());
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue