Merge remote-tracking branch 'origin/jetty-9.4.x'
This commit is contained in:
commit
3ec5f8fa3d
|
@ -0,0 +1,8 @@
|
|||
[name]
|
||||
protonego-boot
|
||||
|
||||
[files]
|
||||
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.11.v20170118/alpn-boot-8.1.11.v20170118.jar|lib/alpn/alpn-boot-8.1.11.v20170118.jar
|
||||
|
||||
[exec]
|
||||
-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.11.v20170118.jar
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.jetty.cdi</groupId>
|
||||
<artifactId>jetty-cdi-parent</artifactId>
|
||||
<version>9.3.0-SNAPSHOT</version>
|
||||
<version>9.4.7-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cdi-webapp-it</artifactId>
|
||||
|
|
|
@ -602,23 +602,6 @@ public class DeploymentManager extends ContainerLifeCycle
|
|||
public void scope(XmlConfiguration xmlc, Resource webapp)
|
||||
throws IOException
|
||||
{
|
||||
xmlc.getIdMap().put("Server", getServer());
|
||||
Resource home = Resource.newResource(System.getProperty("jetty.home","."));
|
||||
xmlc.getProperties().put("jetty.home",home.toString());
|
||||
xmlc.getProperties().put("jetty.home.uri",normalizeURI(home.getURI().toString()));
|
||||
|
||||
Resource base = Resource.newResource(System.getProperty("jetty.base",home.toString()));
|
||||
xmlc.getProperties().put("jetty.base",base.toString());
|
||||
xmlc.getProperties().put("jetty.base.uri",normalizeURI(base.getURI().toString()));
|
||||
|
||||
xmlc.getProperties().put("jetty.webapp",webapp.toString());
|
||||
xmlc.getProperties().put("jetty.webapps",webapp.getFile().toPath().getParent().toString());
|
||||
}
|
||||
|
||||
private String normalizeURI(String uri)
|
||||
{
|
||||
if (uri.endsWith("/"))
|
||||
return uri.substring(0,uri.length()-1);
|
||||
return uri;
|
||||
xmlc.setJettyStandardIdsAndProperties(getServer(),webapp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ applications to deploy using the following conventions:
|
|||
+ A directory called example/ will be deployed as a standard web
|
||||
application if it contains a WEB-INF/ subdirectory, otherwise it will be
|
||||
deployed as context of static content. The context path will be /example
|
||||
(eg http://localhost:8080/example/) unless the base name is root, in
|
||||
which case the context path is /. If the directory name ends with ".d"
|
||||
it is ignored (by may be used by explicit configuration).
|
||||
(eg http://localhost:8080/example/) unless the base name is "root" (not
|
||||
case sensitive), in which case the context path is /. If the directory name
|
||||
ends with ".d" it is ignored (but may still be used by explicit configuration).
|
||||
|
||||
+ A file called example.war will be deployed as a standard web application
|
||||
with the context path /example (eg http://localhost:8080/example/). If the
|
||||
|
|
|
@ -22,6 +22,6 @@ Conscrypt is distributed under the Apache Licence 2.0
|
|||
https://github.com/google/conscrypt/blob/master/LICENSE
|
||||
|
||||
[ini]
|
||||
conscrypt.version?=1.0.0.RC8
|
||||
conscrypt.version?=1.0.0.RC9
|
||||
jetty.sslContext.provider?=AndroidOpenSSL
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ public class ResourceHttpContent implements HttpContent
|
|||
public HttpField getContentLength()
|
||||
{
|
||||
long l=_resource.length();
|
||||
return l==-1?null:new HttpField.LongValueHttpField(HttpHeader.CONTENT_LENGTH,_resource.length());
|
||||
return l==-1?null:new HttpField.LongValueHttpField(HttpHeader.CONTENT_LENGTH,l);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.eclipse.jetty.util.log.Log;
|
|||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.ReservedThreadExecutor;
|
||||
import org.eclipse.jetty.util.thread.Scheduler;
|
||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
||||
import org.eclipse.jetty.util.thread.strategy.EatWhatYouKill;
|
||||
|
||||
/**
|
||||
|
@ -57,17 +58,35 @@ public abstract class SelectorManager extends ContainerLifeCycle implements Dump
|
|||
private final ManagedSelector[] _selectors;
|
||||
private long _connectTimeout = DEFAULT_CONNECT_TIMEOUT;
|
||||
private long _selectorIndex;
|
||||
private int _reservedThreads = -2;
|
||||
private int _reservedThreads = -1;
|
||||
|
||||
public static int defaultSchedulers(Executor executor)
|
||||
{
|
||||
if (executor instanceof ThreadPool)
|
||||
{
|
||||
int threads = ((ThreadPool)executor).getThreads();
|
||||
int cpus = Runtime.getRuntime().availableProcessors();
|
||||
return Math.max(1,Math.min(cpus/2,threads/16));
|
||||
}
|
||||
|
||||
return Math.max(1,Runtime.getRuntime().availableProcessors()/2);
|
||||
}
|
||||
|
||||
protected SelectorManager(Executor executor, Scheduler scheduler)
|
||||
{
|
||||
this(executor, scheduler, (Runtime.getRuntime().availableProcessors() + 1) / 2);
|
||||
this(executor, scheduler, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param executor The executor to use for handling selected {@link EndPoint}s
|
||||
* @param scheduler The scheduler to use for timing events
|
||||
* @param selectors The number of selectors to use, or -1 for a default derived
|
||||
* from a heuristic over available CPUs and thread pool size.
|
||||
*/
|
||||
protected SelectorManager(Executor executor, Scheduler scheduler, int selectors)
|
||||
{
|
||||
if (selectors <= 0)
|
||||
throw new IllegalArgumentException("No selectors");
|
||||
selectors = defaultSchedulers(executor);
|
||||
this.executor = executor;
|
||||
this.scheduler = scheduler;
|
||||
_selectors = new ManagedSelector[selectors];
|
||||
|
@ -110,20 +129,27 @@ public abstract class SelectorManager extends ContainerLifeCycle implements Dump
|
|||
* Get the number of preallocated producing threads
|
||||
* @see EatWhatYouKill
|
||||
* @see ReservedThreadExecutor
|
||||
* @return The number of threads preallocated to producing (default 1).
|
||||
* @return The number of threads preallocated to producing (default -1).
|
||||
*/
|
||||
@ManagedAttribute("The number of preallocated producer threads")
|
||||
@ManagedAttribute("The number of reserved producer threads")
|
||||
public int getReservedThreads()
|
||||
{
|
||||
return _reservedThreads;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of preallocated threads for high priority tasks
|
||||
* Set the number of reserved threads for high priority tasks.
|
||||
* <p>Reserved threads are used to take over producing duties, so that a
|
||||
* producer thread may immediately consume a task it has produced (EatWhatYouKill
|
||||
* scheduling). If a reserved thread is not available, then produced tasks must
|
||||
* be submitted to an executor to be executed by a different thread.
|
||||
* @see EatWhatYouKill
|
||||
* @see ReservedThreadExecutor
|
||||
* @param threads The number of producing threads to preallocate (default 1).
|
||||
* The EatWhatYouKill scheduler will be disabled with a value of 0.
|
||||
* @param threads The number of producing threads to preallocate. If
|
||||
* less that 0 (the default), then a heuristic based on the number of CPUs and
|
||||
* the thread pool size is used to select the number of threads. If 0, no
|
||||
* threads are preallocated and the EatWhatYouKill scheduler will be
|
||||
* disabled and all produced tasks will be executed in a separate thread.
|
||||
*/
|
||||
public void setReservedThreads(int threads)
|
||||
{
|
||||
|
@ -265,7 +291,7 @@ public abstract class SelectorManager extends ContainerLifeCycle implements Dump
|
|||
@Override
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
addBean(new ReservedThreadExecutor(getExecutor(),_reservedThreads==-2?_selectors.length:_reservedThreads),true);
|
||||
addBean(new ReservedThreadExecutor(getExecutor(),_reservedThreads),true);
|
||||
for (int i = 0; i < _selectors.length; i++)
|
||||
{
|
||||
ManagedSelector selector = newSelector(i);
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly>
|
||||
<id>config</id>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<scope>provided</scope>
|
||||
<outputDirectory>lib/mail</outputDirectory>
|
||||
<includes>
|
||||
<include>org.eclipse.jetty.orbit:javax.mail.glassfish</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/jndi-config</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
|
@ -3,6 +3,7 @@ Adds the Jetty JNDI implementation to the classpath.
|
|||
|
||||
[depend]
|
||||
server
|
||||
mail
|
||||
|
||||
[lib]
|
||||
lib/jetty-jndi-${jetty.version}.jar
|
|
@ -0,0 +1,8 @@
|
|||
[description]
|
||||
Adds the javax.mail implementation to the classpath.
|
||||
|
||||
[provides]
|
||||
mail
|
||||
|
||||
[lib]
|
||||
lib/mail/*.jar
|
|
@ -0,0 +1,104 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-jsp</artifactId>
|
||||
<name>Jetty :: Glassfish JSP Implementation</name>
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>config</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Schemas -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-schemas</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- servlet api -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSP Api -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>javax.servlet.jsp-api</artifactId>
|
||||
</dependency>
|
||||
<!-- JSP Impl -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.web</groupId>
|
||||
<artifactId>javax.servlet.jsp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSTL Api -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||
<artifactId>javax.servlet.jsp.jstl</artifactId>
|
||||
</dependency>
|
||||
<!-- JSTL Impl -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.web</groupId>
|
||||
<artifactId>javax.servlet.jsp.jstl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- EL Api -->
|
||||
<!-- Not needed as glassfish impl jars contain also the api classes
|
||||
<dependency>
|
||||
<groupId>javax.el</groupId>
|
||||
<artifactId>javax.el-api</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- EL Impl -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>javax.el</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Eclipse Java Compiler (for JSP Compilation) -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||
<artifactId>org.eclipse.jdt.core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -18,6 +18,17 @@
|
|||
|
||||
package org.eclipse.jetty.maven.plugin;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.jetty.util.PathWatcher;
|
||||
import org.eclipse.jetty.util.PathWatcher.PathWatchEvent;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
@ -30,17 +41,8 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.jetty.util.PathWatcher;
|
||||
import org.eclipse.jetty.util.PathWatcher.PathWatchEvent;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* This goal is used in-situ on a Maven project without first requiring that the project
|
||||
|
|
|
@ -76,6 +76,10 @@ public class JettyWebAppContext extends WebAppContext
|
|||
private String _jettyEnvXml;
|
||||
private List<Overlay> _overlays;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set the "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern" with a pattern for matching jars on
|
||||
* container classpath to scan. This is analogous to the WebAppContext.setAttribute() call.
|
||||
|
@ -322,6 +326,9 @@ public class JettyWebAppContext extends WebAppContext
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void doStart () throws Exception
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly>
|
||||
<id>config</id>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<scope>provided</scope>
|
||||
<outputDirectory>lib/transactions</outputDirectory>
|
||||
<includes>
|
||||
<include>javax.transaction:javax.transaction-api</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/plus-config</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
|
@ -7,6 +7,7 @@ server
|
|||
security
|
||||
jndi
|
||||
webapp
|
||||
transactions
|
||||
|
||||
[lib]
|
||||
lib/jetty-plus-${jetty.version}.jar
|
|
@ -0,0 +1,8 @@
|
|||
[description]
|
||||
Puts javax.transaction api on the classpath
|
||||
|
||||
[provides]
|
||||
transactions
|
||||
|
||||
[lib]
|
||||
lib/transactions/*.jar
|
|
@ -66,6 +66,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator
|
|||
HttpServletResponse res = (HttpServletResponse)response;
|
||||
|
||||
String header = req.getHeader(HttpHeader.AUTHORIZATION.asString());
|
||||
String authScheme = getAuthSchemeFromHeader(header);
|
||||
|
||||
if (!mandatory)
|
||||
{
|
||||
|
@ -73,7 +74,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator
|
|||
}
|
||||
|
||||
// The client has responded to the challenge we sent previously
|
||||
if (header != null && header.startsWith(HttpHeader.NEGOTIATE.asString().toLowerCase()))
|
||||
if (header != null && isAuthSchemeNegotiate(authScheme))
|
||||
{
|
||||
String spnegoToken = header.substring(10);
|
||||
|
||||
|
@ -106,6 +107,47 @@ public class SpnegoAuthenticator extends LoginAuthenticator
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the auth_scheme from the HTTP Authorization header, {@code Authorization: <auth_scheme> <token>}.
|
||||
*
|
||||
* @param header The HTTP Authorization header or null.
|
||||
* @return The parsed auth scheme from the header, or the empty string.
|
||||
*/
|
||||
String getAuthSchemeFromHeader(String header)
|
||||
{
|
||||
// No header provided, return the empty string
|
||||
if (header == null || header.isEmpty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
// Trim any leading whitespace
|
||||
String trimmed_header = header.trim();
|
||||
// Find the first space, all characters prior should be the auth_scheme
|
||||
int index = trimmed_header.indexOf(' ');
|
||||
if (index > 0) {
|
||||
return trimmed_header.substring(0, index);
|
||||
}
|
||||
// If we don't find a space, this is likely malformed, just return the entire value
|
||||
return trimmed_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if provided auth scheme text from the Authorization header is case-insensitively
|
||||
* equal to {@code negotiate}.
|
||||
*
|
||||
* @param authScheme The auth scheme component of the Authorization header
|
||||
* @return True if the auth scheme component is case-insensitively equal to {@code negotiate}, False otherwise.
|
||||
*/
|
||||
boolean isAuthSchemeNegotiate(String authScheme)
|
||||
{
|
||||
if (authScheme == null || authScheme.length() != HttpHeader.NEGOTIATE.asString().length())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Headers should be treated case-insensitively, so we have to jump through some extra hoops.
|
||||
return authScheme.equalsIgnoreCase(HttpHeader.NEGOTIATE.asString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean secureResponse(ServletRequest request, ServletResponse response, boolean mandatory, User validatedUser) throws ServerAuthException
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
package org.eclipse.jetty.security.authentication;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
@ -110,4 +112,37 @@ public class SpnegoAuthenticatorTest {
|
|||
assertEquals(HttpHeader.NEGOTIATE.asString(), res.getHeader(HttpHeader.WWW_AUTHENTICATE.asString()));
|
||||
assertEquals(HttpServletResponse.SC_UNAUTHORIZED, res.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCaseInsensitiveHeaderParsing()
|
||||
{
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate(null));
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate(""));
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate("Basic"));
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate("basic"));
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate("Digest"));
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate("LotsandLotsandLots of nonsense"));
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate("Negotiat asdfasdf"));
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate("Negotiated"));
|
||||
assertFalse(_authenticator.isAuthSchemeNegotiate("Negotiate-and-more"));
|
||||
|
||||
assertTrue(_authenticator.isAuthSchemeNegotiate("Negotiate"));
|
||||
assertTrue(_authenticator.isAuthSchemeNegotiate("negotiate"));
|
||||
assertTrue(_authenticator.isAuthSchemeNegotiate("negOtiAte"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractAuthScheme()
|
||||
{
|
||||
assertEquals("", _authenticator.getAuthSchemeFromHeader(null));
|
||||
assertEquals("", _authenticator.getAuthSchemeFromHeader(""));
|
||||
assertEquals("", _authenticator.getAuthSchemeFromHeader(" "));
|
||||
assertEquals("Basic", _authenticator.getAuthSchemeFromHeader(" Basic asdfasdf"));
|
||||
assertEquals("Basicasdf", _authenticator.getAuthSchemeFromHeader("Basicasdf asdfasdf"));
|
||||
assertEquals("basic", _authenticator.getAuthSchemeFromHeader(" basic asdfasdf "));
|
||||
assertEquals("Negotiate", _authenticator.getAuthSchemeFromHeader("Negotiate asdfasdf"));
|
||||
assertEquals("negotiate", _authenticator.getAuthSchemeFromHeader("negotiate asdfasdf"));
|
||||
assertEquals("negotiate", _authenticator.getAuthSchemeFromHeader(" negotiate asdfasdf"));
|
||||
assertEquals("negotiated", _authenticator.getAuthSchemeFromHeader(" negotiated asdfasdf"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ import javax.servlet.ServletRequestAttributeListener;
|
|||
import javax.servlet.ServletRequestWrapper;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletMapping;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
@ -64,7 +65,6 @@ import javax.servlet.http.HttpUpgradeHandler;
|
|||
import javax.servlet.http.MappingMatch;
|
||||
import javax.servlet.http.Part;
|
||||
import javax.servlet.http.PushBuilder;
|
||||
import javax.servlet.http.HttpServletMapping;
|
||||
|
||||
import org.eclipse.jetty.http.BadMessageException;
|
||||
import org.eclipse.jetty.http.HostPortHttpField;
|
||||
|
|
|
@ -219,8 +219,7 @@ public class ServerConnector extends AbstractNetworkConnector
|
|||
@Name("factories") ConnectionFactory... factories)
|
||||
{
|
||||
super(server,executor,scheduler,bufferPool,acceptors,factories);
|
||||
_manager = newSelectorManager(getExecutor(), getScheduler(),
|
||||
selectors>0?selectors:Math.max(1,Math.min(4,Runtime.getRuntime().availableProcessors()/2)));
|
||||
_manager = newSelectorManager(getExecutor(), getScheduler(),selectors);
|
||||
addBean(_manager, true);
|
||||
setAcceptorPriorityDelta(-2);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>Jetty :: SPDY :: Parent</name>
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
|
||||
<modules>
|
||||
<module>spdy-core</module>
|
||||
<module>spdy-client</module>
|
||||
<module>spdy-server</module>
|
||||
<module>spdy-http-common</module>
|
||||
<module>spdy-http-server</module>
|
||||
<module>spdy-http-client-transport</module>
|
||||
<module>spdy-example-webapp</module>
|
||||
<module>spdy-alpn-tests</module>
|
||||
</modules>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>npn</id>
|
||||
<activation>
|
||||
<jdk>1.7</jdk>
|
||||
</activation>
|
||||
<modules>
|
||||
<!--
|
||||
<module>spdy-npn-tests</module>
|
||||
-->
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>org.eclipse.jetty.spdy.*;version="9.1"</Export-Package>
|
||||
<Import-Package>org.eclipse.jetty.*;version="[9.0,10.0)",*</Import-Package>
|
||||
<_nouses>true</_nouses>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<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>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,93 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spdy-alpn-tests</artifactId>
|
||||
<name>Jetty :: SPDY :: ALPN Tests</name>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.mortbay.jetty.alpn</groupId>
|
||||
<artifactId>alpn-boot</artifactId>
|
||||
<version>${alpn.version}</version>
|
||||
<type>jar</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/alpn</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>-Xbootclasspath/p:${project.build.directory}/alpn/alpn-boot-${alpn.version}.jar</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-alpn-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,66 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spdy-client</artifactId>
|
||||
<name>Jetty :: SPDY :: Client Binding</name>
|
||||
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.client</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>org.eclipse.jetty.spdy.client;version="9.1"</Export-Package>
|
||||
<Import-Package>!org.eclipse.jetty.npn,!org.eclipse.jetty.alpn,org.eclipse.jetty.*;version="[9.0,10.0)",*</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-alpn-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.npn</groupId>
|
||||
<artifactId>npn-api</artifactId>
|
||||
<version>${npn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,35 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spdy-core</artifactId>
|
||||
<name>Jetty :: SPDY :: Core</name>
|
||||
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.core</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-io</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,84 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spdy-example-webapp</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>Jetty :: SPDY :: HTTP Web Application</name>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<configuration>
|
||||
<stopPort>8888</stopPort>
|
||||
<stopKey>quit</stopKey>
|
||||
<jvmArgs>
|
||||
-Xbootclasspath/p:${settings.localRepository}/org/mortbay/jetty/npn/npn-boot/${npn.version}/npn-boot-${npn.version}.jar
|
||||
</jvmArgs>
|
||||
<jettyXml>${basedir}/src/main/config/example-jetty-spdy.xml</jettyXml>
|
||||
<contextPath>/</contextPath>
|
||||
<excludedGoals>
|
||||
<excludedGoal>run</excludedGoal>
|
||||
<excludedGoal>run-war</excludedGoal>
|
||||
<excludedGoal>deploy</excludedGoal>
|
||||
<excludedGoal>start</excludedGoal>
|
||||
<excludedGoal>stop</excludedGoal>
|
||||
</excludedGoals>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>proxy</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<configuration>
|
||||
<stopPort>8888</stopPort>
|
||||
<stopKey>quit</stopKey>
|
||||
<jvmArgs>
|
||||
-Xbootclasspath/p:${settings.localRepository}/org/mortbay/jetty/npn/npn-boot/${npn.version}/npn-boot-${npn.version}.jar
|
||||
</jvmArgs>
|
||||
<jettyXml>${basedir}/src/main/config/example-jetty-spdy-proxy.xml</jettyXml>
|
||||
<contextPath>/</contextPath>
|
||||
<excludedGoals>
|
||||
<excludedGoal>run</excludedGoal>
|
||||
<excludedGoal>run-war</excludedGoal>
|
||||
<excludedGoal>deploy</excludedGoal>
|
||||
<excludedGoal>start</excludedGoal>
|
||||
<excludedGoal>stop</excludedGoal>
|
||||
</excludedGoals>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,71 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spdy-http-client-transport</artifactId>
|
||||
<name>Jetty :: SPDY :: HTTP Client Transport</name>
|
||||
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.client.http</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>org.eclipse.jetty.spdy.client.http;version="9.1"</Export-Package>
|
||||
<Import-Package>!org.eclipse.jetty.npn,org.eclipse.jetty.*;version="[9.0,10.0)",*</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,48 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spdy-http-common</artifactId>
|
||||
<name>Jetty :: SPDY :: HTTP Common</name>
|
||||
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.http.common</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>org.eclipse.jetty.spdy.http;version="9.1"</Export-Package>
|
||||
<Import-Package>!org.eclipse.jetty.npn,org.eclipse.jetty.*;version="[9.0,10.0)",*</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,120 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<name>Jetty :: SPDY :: HTTP Server</name>
|
||||
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.http.server</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>config</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>artifact-jars</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>org.eclipse.jetty.spdy.server.http;version="9.1",
|
||||
org.eclipse.jetty.spdy.server.proxy;version="9.1"
|
||||
</Export-Package>
|
||||
<Import-Package>!org.eclipse.jetty.npn,org.eclipse.jetty.*;version="[9.0,10.0)",*
|
||||
</Import-Package>
|
||||
<_nouses>true</_nouses>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlets</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.npn</groupId>
|
||||
<artifactId>npn-api</artifactId>
|
||||
<version>${npn.api.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-continuation</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,72 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-parent</artifactId>
|
||||
<version>9.2.23-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spdy-server</artifactId>
|
||||
<name>Jetty :: SPDY :: Server Binding</name>
|
||||
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.server</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>org.eclipse.jetty.spdy.server;version="9.1"</Export-Package>
|
||||
<Import-Package>org.eclipse.jetty.alpn;resolution:=optional,org.eclipse.jetty.alpn.server;resolution:=optional, org.eclipse.jetty.npn;resolution:=optional,org.eclipse.jetty.*;version="[9.0,10.0)",*</Import-Package>
|
||||
<_nouses>true</_nouses>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.npn</groupId>
|
||||
<artifactId>npn-api</artifactId>
|
||||
<version>${npn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
[name]
|
||||
protonego-boot
|
||||
|
||||
[files]
|
||||
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.11.v20170118/alpn-boot-8.1.11.v20170118.jar|lib/alpn/alpn-boot-8.1.11.v20170118.jar
|
||||
|
||||
[exec]
|
||||
-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.11.v20170118.jar
|
|
@ -50,12 +50,29 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
|
||||
/**
|
||||
* @param executor The executor to use to obtain threads
|
||||
* @param capacity The number of threads to preallocate. If less than 0 then the number of available processors is used.
|
||||
* @param capacity The number of threads to preallocate. If less than 0 then capacity
|
||||
* is calculated based on a heuristic from the number of available processors and
|
||||
* thread pool size.
|
||||
*/
|
||||
public ReservedThreadExecutor(Executor executor,int capacity)
|
||||
{
|
||||
_executor = executor;
|
||||
_queue = new ReservedThread[capacity>=0?capacity:Runtime.getRuntime().availableProcessors()];
|
||||
|
||||
if (capacity < 0)
|
||||
{
|
||||
if (executor instanceof ThreadPool)
|
||||
{
|
||||
int threads = ((ThreadPool)executor).getThreads();
|
||||
int cpus = Runtime.getRuntime().availableProcessors();
|
||||
capacity = Math.max(1,Math.min(cpus,threads/8));
|
||||
}
|
||||
else
|
||||
{
|
||||
capacity = Runtime.getRuntime().availableProcessors();
|
||||
}
|
||||
}
|
||||
|
||||
_queue = new ReservedThread[capacity];
|
||||
}
|
||||
|
||||
public Executor getExecutor()
|
||||
|
|
|
@ -83,10 +83,9 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration
|
|||
|
||||
Object xml_attr=context.getAttribute(XML_CONFIGURATION);
|
||||
context.removeAttribute(XML_CONFIGURATION);
|
||||
final XmlConfiguration jetty_config = xml_attr instanceof XmlConfiguration
|
||||
?(XmlConfiguration)xml_attr
|
||||
:new XmlConfiguration(jetty.getURI().toURL());
|
||||
setupXmlConfiguration(jetty_config, web_inf);
|
||||
final XmlConfiguration jetty_config = xml_attr instanceof XmlConfiguration?(XmlConfiguration)xml_attr:new XmlConfiguration(jetty.getURI().toURL());
|
||||
|
||||
setupXmlConfiguration(context, jetty_config, web_inf);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -107,11 +106,12 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration
|
|||
* @param jetty_config The configuration object.
|
||||
* @param web_inf the WEB-INF location
|
||||
*/
|
||||
private void setupXmlConfiguration(XmlConfiguration jetty_config, Resource web_inf) throws IOException
|
||||
private void setupXmlConfiguration(WebAppContext context, XmlConfiguration jetty_config, Resource web_inf) throws IOException
|
||||
{
|
||||
jetty_config.setJettyStandardIdsAndProperties(context.getServer(),null);
|
||||
Map<String,String> props = jetty_config.getProperties();
|
||||
props.put(PROPERTY_THIS_WEB_INF_URL, web_inf.getURI().toString());
|
||||
props.put(PROPERTY_WEB_INF_URI, web_inf.getURI().toString());
|
||||
props.put(PROPERTY_WEB_INF_URI, XmlConfiguration.normalizeURI(web_inf.getURI().toString()));
|
||||
props.put(PROPERTY_WEB_INF, web_inf.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 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.server;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.notNullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.io.MappedByteBufferPool;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.log.StdErrLog;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketBehavior;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||
import org.junit.Test;
|
||||
|
||||
public class WebSocketServerFactoryTest
|
||||
{
|
||||
private int setLogLevel(Class<?> clazz, int newLevel)
|
||||
{
|
||||
int oldLevel = StdErrLog.LEVEL_DEFAULT;
|
||||
Logger logger = Log.getLogger(clazz);
|
||||
if (logger instanceof StdErrLog)
|
||||
{
|
||||
StdErrLog stdErrLog = (StdErrLog) logger;
|
||||
oldLevel = stdErrLog.getLevel();
|
||||
stdErrLog.setLevel(newLevel);
|
||||
}
|
||||
|
||||
return oldLevel;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInit()
|
||||
{
|
||||
WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.SERVER);
|
||||
Executor executor = new QueuedThreadPool();
|
||||
ByteBufferPool bufferPool = new MappedByteBufferPool();
|
||||
|
||||
int wsFactoryLevel = setLogLevel(WebSocketServerFactory.class, StdErrLog.LEVEL_DEBUG);
|
||||
int abstractLifecycleLevel = setLogLevel(AbstractLifeCycle.class, StdErrLog.LEVEL_DEBUG);
|
||||
int containerLifecycleLevel = setLogLevel(ContainerLifeCycle.class, StdErrLog.LEVEL_DEBUG);
|
||||
try
|
||||
{
|
||||
WebSocketServerFactory wsFactory = new WebSocketServerFactory(policy, executor, bufferPool);
|
||||
// The above init caused NPE due to bad constructor initialization order with debug active
|
||||
assertThat("wsFactory.toString()", wsFactory.toString(), notNullValue());
|
||||
}
|
||||
finally
|
||||
{
|
||||
setLogLevel(WebSocketServerFactory.class, wsFactoryLevel);
|
||||
setLogLevel(AbstractLifeCycle.class, abstractLifecycleLevel);
|
||||
setLogLevel(ContainerLifeCycle.class, containerLifecycleLevel);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -115,6 +115,55 @@ public class XmlConfiguration
|
|||
return parser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the standard IDs and properties expected in a jetty XML file:
|
||||
* <ul>
|
||||
* <li>RefId Server</li>
|
||||
* <li>Property jetty.home</li>
|
||||
* <li>Property jetty.home.uri</li>
|
||||
* <li>Property jetty.base</li>
|
||||
* <li>Property jetty.base.uri</li>
|
||||
* <li>Property jetty.webapps</li>
|
||||
* <li>Property jetty.webapps.uri</li>
|
||||
* </ul>
|
||||
* @param server The Server object to set
|
||||
* @param webapp The webapps Resource
|
||||
*/
|
||||
public void setJettyStandardIdsAndProperties(Object server, Resource webapp)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (server!=null)
|
||||
getIdMap().put("Server", server);
|
||||
|
||||
Resource home = Resource.newResource(System.getProperty("jetty.home","."));
|
||||
getProperties().put("jetty.home",home.toString());
|
||||
getProperties().put("jetty.home.uri",normalizeURI(home.getURI().toString()));
|
||||
|
||||
Resource base = Resource.newResource(System.getProperty("jetty.base",home.toString()));
|
||||
getProperties().put("jetty.base",base.toString());
|
||||
getProperties().put("jetty.base.uri",normalizeURI(base.getURI().toString()));
|
||||
|
||||
if (webapp!=null)
|
||||
{
|
||||
getProperties().put("jetty.webapp",webapp.toString());
|
||||
getProperties().put("jetty.webapps",webapp.getFile().toPath().getParent().toString());
|
||||
getProperties().put("jetty.webapps.uri",normalizeURI(webapp.getURI().toString()));
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
LOG.warn(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String normalizeURI(String uri)
|
||||
{
|
||||
if (uri.endsWith("/"))
|
||||
return uri.substring(0,uri.length()-1);
|
||||
return uri;
|
||||
}
|
||||
|
||||
private final Map<String, Object> _idMap = new HashMap<>();
|
||||
private final Map<String, String> _propertyMap = new HashMap<>();
|
||||
private final URL _url;
|
||||
|
|
|
@ -23,14 +23,13 @@ package org.eclipse.jetty.server.session;
|
|||
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -215,7 +214,8 @@ public class SessionEvictionFailureTest
|
|||
TestServer server = new TestServer (0, inactivePeriod, scavengePeriod, cacheFactory, storeFactory);
|
||||
ServletContextHandler context = server.addContext(contextPath);
|
||||
context.getSessionHandler().getSessionCache().setSaveOnInactiveEviction(true);
|
||||
MockSessionDataStore ds = new MockSessionDataStore(new boolean[] {true, false, true, false, true});
|
||||
//test values: allow first save, fail evict save, allow save, fail evict save, allow save, allow save on shutdown
|
||||
MockSessionDataStore ds = new MockSessionDataStore(new boolean[] {true, false, true, false, true, true});
|
||||
context.getSessionHandler().getSessionCache().setSessionDataStore(ds);
|
||||
|
||||
TestServlet servlet = new TestServlet();
|
||||
|
@ -242,7 +242,6 @@ public class SessionEvictionFailureTest
|
|||
//should remain in the cache
|
||||
pause(evictionPeriod+(int)(evictionPeriod*0.5));
|
||||
|
||||
|
||||
// Make another request to see if the session is still in the cache and can be used,
|
||||
//allow it to be saved this time
|
||||
Request request = client.newRequest(url + "?action=test");
|
||||
|
@ -250,11 +249,9 @@ public class SessionEvictionFailureTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
assertNull(response.getHeaders().get("Set-Cookie")); //check that the cookie wasn't reset
|
||||
|
||||
|
||||
//Wait for the eviction period to expire again
|
||||
pause(evictionPeriod+(int)(evictionPeriod*0.5));
|
||||
|
||||
|
||||
request = client.newRequest(url + "?action=test");
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
|
Loading…
Reference in New Issue