+ """
emailext (
- to: email,
- subject: summary,
- body: detail
+ to: email,
+ subject: summary,
+ body: detail
)
}
diff --git a/VERSION.txt b/VERSION.txt
index 6dc3b971b20..ed7bee002cf 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -171,6 +171,9 @@ jetty-9.4.7.v20170914 - 14 September 2017
+ 475546 ClosedChannelException when connection to HTTPS over HTTP proxy
with CONNECT
+jetty-9.2.24.v20180105 - 05 January 2018
+ + 2065 Backport #347 to Jetty 9.2.x
+
jetty-9.2.23.v20171218 - 18 December 2017
+ 1556 Remove a timing channel in Password matching
+ 1685 Update ALPN support for Java 8u141
diff --git a/examples/async-rest/async-rest-jar/src/main/java/org/eclipse/jetty/example/asyncrest/AbstractRestServlet.java b/examples/async-rest/async-rest-jar/src/main/java/org/eclipse/jetty/example/asyncrest/AbstractRestServlet.java
index 58ff22ed5ca..7198dd6e4df 100644
--- a/examples/async-rest/async-rest-jar/src/main/java/org/eclipse/jetty/example/asyncrest/AbstractRestServlet.java
+++ b/examples/async-rest/async-rest-jar/src/main/java/org/eclipse/jetty/example/asyncrest/AbstractRestServlet.java
@@ -121,6 +121,7 @@ public class AbstractRestServlet extends HttpServlet
return w;
}
+ @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
diff --git a/examples/async-rest/async-rest-jar/src/main/java/org/eclipse/jetty/example/asyncrest/SerialRestServlet.java b/examples/async-rest/async-rest-jar/src/main/java/org/eclipse/jetty/example/asyncrest/SerialRestServlet.java
index 158b2f24758..c9093c1e8de 100644
--- a/examples/async-rest/async-rest-jar/src/main/java/org/eclipse/jetty/example/asyncrest/SerialRestServlet.java
+++ b/examples/async-rest/async-rest-jar/src/main/java/org/eclipse/jetty/example/asyncrest/SerialRestServlet.java
@@ -40,6 +40,7 @@ import org.eclipse.jetty.util.ajax.JSON;
*/
public class SerialRestServlet extends AbstractRestServlet
{
+ @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
long start = System.nanoTime();
@@ -98,6 +99,7 @@ public class SerialRestServlet extends AbstractRestServlet
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
+ @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/HelloHandler.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/HelloHandler.java
index 0c785691dea..ec7fd04ecc0 100644
--- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/HelloHandler.java
+++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/HelloHandler.java
@@ -49,6 +49,7 @@ public class HelloHandler extends AbstractHandler
this.body = body;
}
+ @Override
public void handle( String target,
Request baseRequest,
HttpServletRequest request,
diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ManyHandlers.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ManyHandlers.java
index d9bfc61d57f..337f760af86 100644
--- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ManyHandlers.java
+++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ManyHandlers.java
@@ -72,6 +72,7 @@ public class ManyHandlers
*/
public static class ParamHandler extends AbstractHandler
{
+ @Override
public void handle( String target,
Request baseRequest,
HttpServletRequest request,
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java
index 97d7816cd50..4140a535333 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java
@@ -167,6 +167,7 @@ public class AnnotationConfiguration extends AbstractConfiguration
_stat = stat;
}
+ @Override
public Void call() throws Exception
{
if (_stat != null)
@@ -275,6 +276,7 @@ public class AnnotationConfiguration extends AbstractConfiguration
return _indexMap.size();
}
+ @Override
public String toString()
{
if (_ordering == null)
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationIntrospector.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationIntrospector.java
index 4a381e6e8ff..7a24a989fc5 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationIntrospector.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationIntrospector.java
@@ -61,6 +61,7 @@ public class AnnotationIntrospector
_introspectAncestors = introspectAncestors;
}
+ @Override
public void handle(Class> clazz)
{
Class> c = clazz;
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java
index cceb8511a9b..b1096cf7952 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java
@@ -44,6 +44,7 @@ public class ClassInheritanceHandler extends AbstractHandler
_inheritanceMap = map;
}
+ @Override
public void handle(ClassInfo classInfo)
{
try
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ContainerInitializerAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ContainerInitializerAnnotationHandler.java
index fedcb65a2a1..5fd74b4b579 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ContainerInitializerAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ContainerInitializerAnnotationHandler.java
@@ -49,6 +49,7 @@ public class ContainerInitializerAnnotationHandler extends AbstractHandler
*
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(org.eclipse.jetty.annotations.AnnotationParser.ClassInfo, String)
*/
+ @Override
public void handle(ClassInfo info, String annotationName)
{
if (annotationName == null || !_annotation.getName().equals(annotationName))
@@ -62,6 +63,7 @@ public class ContainerInitializerAnnotationHandler extends AbstractHandler
*
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(org.eclipse.jetty.annotations.AnnotationParser.FieldInfo, String)
*/
+ @Override
public void handle(FieldInfo info, String annotationName)
{
if (annotationName == null || !_annotation.getName().equals(annotationName))
@@ -74,6 +76,7 @@ public class ContainerInitializerAnnotationHandler extends AbstractHandler
*
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(org.eclipse.jetty.annotations.AnnotationParser.MethodInfo, String)
*/
+ @Override
public void handle(MethodInfo info, String annotationName)
{
if (annotationName == null || !_annotation.getName().equals(annotationName))
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/DeclareRolesAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/DeclareRolesAnnotationHandler.java
index 96eaab6fc5e..daba6494b12 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/DeclareRolesAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/DeclareRolesAnnotationHandler.java
@@ -48,6 +48,7 @@ public class DeclareRolesAnnotationHandler extends AbstractIntrospectableAnnotat
/**
* @see org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler#doHandle(java.lang.Class)
*/
+ @Override
public void doHandle(Class clazz)
{
if (!Servlet.class.isAssignableFrom(clazz))
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/MultiPartConfigAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/MultiPartConfigAnnotationHandler.java
index 3334050bf5e..72d171eed0a 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/MultiPartConfigAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/MultiPartConfigAnnotationHandler.java
@@ -46,6 +46,7 @@ public class MultiPartConfigAnnotationHandler extends AbstractIntrospectableAnno
/**
* @see org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler#doHandle(java.lang.Class)
*/
+ @Override
public void doHandle(Class clazz)
{
if (!Servlet.class.isAssignableFrom(clazz))
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/PostConstructAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/PostConstructAnnotationHandler.java
index df69dae5b49..4c1ac135f1c 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/PostConstructAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/PostConstructAnnotationHandler.java
@@ -41,6 +41,7 @@ public class PostConstructAnnotationHandler extends AbstractIntrospectableAnnota
}
+ @Override
public void doHandle(Class clazz)
{
//Check that the PostConstruct is on a class that we're interested in
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/PreDestroyAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/PreDestroyAnnotationHandler.java
index bb5c3777397..09fa4c922c2 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/PreDestroyAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/PreDestroyAnnotationHandler.java
@@ -40,6 +40,7 @@ public class PreDestroyAnnotationHandler extends AbstractIntrospectableAnnotatio
_context = wac;
}
+ @Override
public void doHandle(Class clazz)
{
//Check that the PreDestroy is on a class that we're interested in
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java
index 6bf58140628..445f5d943e8 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java
@@ -61,6 +61,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
* environment that will be looked up at runtime. They do
* not specify an injection.
*/
+ @Override
public void doHandle(Class> clazz)
{
if (supportsResourceInjection(clazz))
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java
index 9865e81b600..9132a337f82 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java
@@ -40,6 +40,7 @@ public class ResourcesAnnotationHandler extends AbstractIntrospectableAnnotation
_wac = wac;
}
+ @Override
public void doHandle (Class> clazz)
{
Resources resources = (Resources)clazz.getAnnotation(Resources.class);
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/RunAsAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/RunAsAnnotationHandler.java
index 871a4bd3969..43ed86d213c 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/RunAsAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/RunAsAnnotationHandler.java
@@ -44,6 +44,7 @@ public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHand
_context = wac;
}
+ @Override
public void doHandle (Class clazz)
{
if (!Servlet.class.isAssignableFrom(clazz))
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletContainerInitializersStarter.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletContainerInitializersStarter.java
index 5b98abc1fe3..13dd0348568 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletContainerInitializersStarter.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletContainerInitializersStarter.java
@@ -48,6 +48,7 @@ public class ServletContainerInitializersStarter extends AbstractLifeCycle imple
* Call the doStart method of the ServletContainerInitializers
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
*/
+ @Override
public void doStart()
{
List initializers = (List)_context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS);
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletSecurityAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletSecurityAnnotationHandler.java
index d5ffb24b339..a4395036faf 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletSecurityAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletSecurityAnnotationHandler.java
@@ -69,6 +69,7 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno
/**
* @see org.eclipse.jetty.annotations.AnnotationIntrospector.IntrospectableAnnotationHandler#handle(java.lang.Class)
*/
+ @Override
public void doHandle(Class clazz)
{
if (!(_context.getSecurityHandler() instanceof ConstraintAware))
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java
index 0fb430295b2..c7de61c8263 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java
@@ -58,6 +58,7 @@ public class WebFilterAnnotation extends DiscoveredAnnotation
/**
* @see DiscoveredAnnotation#apply()
*/
+ @Override
public void apply()
{
// TODO verify against rules for annotation v descriptor
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotation.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotation.java
index 3591234cfd8..55dd55bdf42 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotation.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotation.java
@@ -58,6 +58,7 @@ public class WebListenerAnnotation extends DiscoveredAnnotation
/**
* @see DiscoveredAnnotation#apply()
*/
+ @Override
public void apply()
{
Class extends java.util.EventListener> clazz = (Class extends EventListener>)getTargetClass();
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotationHandler.java
index 72b1c14ca84..441d1441627 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotationHandler.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotationHandler.java
@@ -34,6 +34,7 @@ public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotation
super(context);
}
+ @Override
public void handle(ClassInfo info, String annotationName)
{
if (annotationName == null || !"javax.servlet.annotation.WebListener".equals(annotationName))
@@ -43,6 +44,7 @@ public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotation
addAnnotation(wlAnnotation);
}
+ @Override
public void handle(FieldInfo info, String annotationName)
{
if (annotationName == null || !"javax.servlet.annotation.WebListener".equals(annotationName))
@@ -50,6 +52,7 @@ public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotation
LOG.warn ("@WebListener is not applicable to fields: "+info.getClassInfo().getClassName()+"."+info.getFieldName());
}
+ @Override
public void handle(MethodInfo info, String annotationName)
{
if (annotationName == null || !"javax.servlet.annotation.WebListener".equals(annotationName))
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java
index 1077fa3a951..940adba4f07 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java
@@ -65,6 +65,7 @@ public class WebServletAnnotation extends DiscoveredAnnotation
/**
* @see DiscoveredAnnotation#apply()
*/
+ @Override
public void apply()
{
//TODO check this algorithm with new rules for applying descriptors and annotations in order
diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ClassB.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ClassB.java
index 80b3eab4ab9..b83a56ec793 100644
--- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ClassB.java
+++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ClassB.java
@@ -45,6 +45,7 @@ public class ClassB extends ClassA implements InterfaceD
System.err.println("ClassB.package");
}
+ @Override
public void l()
{
System.err.println("Overridden method l has no annotation");
diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/FilterC.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/FilterC.java
index df6e39df196..2f61d74d6b4 100644
--- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/FilterC.java
+++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/FilterC.java
@@ -57,6 +57,7 @@ public class FilterC implements Filter
}
+ @Override
public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
throws IOException, ServletException
{
@@ -69,10 +70,12 @@ public class FilterC implements Filter
arg2.doFilter(request, response);
}
+ @Override
public void destroy()
{
}
+ @Override
public void init(FilterConfig arg0) throws ServletException
{
}
diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ListenerC.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ListenerC.java
index 6dcbe572ac3..7f33ae760b0 100644
--- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ListenerC.java
+++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ListenerC.java
@@ -26,11 +26,13 @@ import javax.servlet.annotation.WebListener;
public class ListenerC implements ServletContextListener
{
+ @Override
public void contextDestroyed(ServletContextEvent arg0)
{
}
+ @Override
public void contextInitialized(ServletContextEvent arg0)
{
diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ServletC.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ServletC.java
index 0e23a66ebb1..25124475ea5 100644
--- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ServletC.java
+++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/ServletC.java
@@ -58,6 +58,7 @@ public class ServletC extends HttpServlet
}
+ @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationInheritance.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationInheritance.java
index 8489c32d94e..f67c8254396 100644
--- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationInheritance.java
+++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationInheritance.java
@@ -54,6 +54,7 @@ public class TestAnnotationInheritance
public final List annotatedMethods = new ArrayList();
public final List annotatedFields = new ArrayList();
+ @Override
public void handle(ClassInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
@@ -62,6 +63,7 @@ public class TestAnnotationInheritance
annotatedClassNames.add(info.getClassName());
}
+ @Override
public void handle(FieldInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
@@ -69,6 +71,7 @@ public class TestAnnotationInheritance
annotatedFields.add(info.getClassInfo().getClassName()+"."+info.getFieldName());
}
+ @Override
public void handle(MethodInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java
index 7bcc8a16b44..6d16ee34095 100644
--- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java
+++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java
@@ -116,6 +116,7 @@ public class TestAnnotationParser
{
private List methods = Arrays.asList("a","b","c","d","l");
+ @Override
public void handle(ClassInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
@@ -124,6 +125,7 @@ public class TestAnnotationParser
assertEquals("org.eclipse.jetty.annotations.ClassA",info.getClassName());
}
+ @Override
public void handle(FieldInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
@@ -132,6 +134,7 @@ public class TestAnnotationParser
assertEquals(org.objectweb.asm.Type.OBJECT,org.objectweb.asm.Type.getType(info.getFieldType()).getSort());
}
+ @Override
public void handle(MethodInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
@@ -158,6 +161,7 @@ public class TestAnnotationParser
class MultiAnnotationHandler extends AnnotationParser.AbstractHandler
{
+ @Override
public void handle(ClassInfo info, String annotation)
{
if (annotation == null || ! "org.eclipse.jetty.annotations.Multi".equals(annotation))
@@ -165,6 +169,7 @@ public class TestAnnotationParser
assertTrue("org.eclipse.jetty.annotations.ClassB".equals(info.getClassName()));
}
+ @Override
public void handle(FieldInfo info, String annotation)
{
if (annotation == null || ! "org.eclipse.jetty.annotations.Multi".equals(annotation))
@@ -173,6 +178,7 @@ public class TestAnnotationParser
fail();
}
+ @Override
public void handle(MethodInfo info, String annotation)
{
if (annotation == null || ! "org.eclipse.jetty.annotations.Multi".equals(annotation))
diff --git a/jetty-ant/src/main/java/org/eclipse/jetty/ant/AntWebAppContext.java b/jetty-ant/src/main/java/org/eclipse/jetty/ant/AntWebAppContext.java
index ef3a8785b6e..b00f4bbd97e 100644
--- a/jetty-ant/src/main/java/org/eclipse/jetty/ant/AntWebAppContext.java
+++ b/jetty-ant/src/main/java/org/eclipse/jetty/ant/AntWebAppContext.java
@@ -591,6 +591,7 @@ public class AntWebAppContext extends WebAppContext
/**
*
*/
+ @Override
public void doStart()
{
try
@@ -627,6 +628,7 @@ public class AntWebAppContext extends WebAppContext
}
}
+ @Override
public void doStop()
{
try
diff --git a/jetty-ant/src/main/java/org/eclipse/jetty/ant/AntWebInfConfiguration.java b/jetty-ant/src/main/java/org/eclipse/jetty/ant/AntWebInfConfiguration.java
index 09a2b0c6b2a..64c3bd2a98e 100644
--- a/jetty-ant/src/main/java/org/eclipse/jetty/ant/AntWebInfConfiguration.java
+++ b/jetty-ant/src/main/java/org/eclipse/jetty/ant/AntWebInfConfiguration.java
@@ -19,16 +19,8 @@
package org.eclipse.jetty.ant;
import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
import java.util.List;
-import java.util.regex.Pattern;
-import org.apache.tools.ant.AntClassLoader;
-import org.eclipse.jetty.util.PatternMatcher;
-import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;
@@ -50,6 +42,7 @@ public class AntWebInfConfiguration extends WebInfConfiguration
*
* @see WebXmlConfiguration#configure(WebAppContext)
*/
+ @Override
public void configure(WebAppContext context) throws Exception
{
if (context instanceof AntWebAppContext)
diff --git a/jetty-ant/src/main/java/org/eclipse/jetty/ant/JettyRunTask.java b/jetty-ant/src/main/java/org/eclipse/jetty/ant/JettyRunTask.java
index cc2cb49fcd1..9e9eab1f038 100644
--- a/jetty-ant/src/main/java/org/eclipse/jetty/ant/JettyRunTask.java
+++ b/jetty-ant/src/main/java/org/eclipse/jetty/ant/JettyRunTask.java
@@ -189,6 +189,7 @@ public class JettyRunTask extends Task
*
* @throws BuildException if unable to build
*/
+ @Override
public void execute() throws BuildException
{
diff --git a/jetty-ant/src/main/java/org/eclipse/jetty/ant/JettyStopTask.java b/jetty-ant/src/main/java/org/eclipse/jetty/ant/JettyStopTask.java
index 3dfc109e16a..167864df17e 100644
--- a/jetty-ant/src/main/java/org/eclipse/jetty/ant/JettyStopTask.java
+++ b/jetty-ant/src/main/java/org/eclipse/jetty/ant/JettyStopTask.java
@@ -56,6 +56,7 @@ public class JettyStopTask extends Task
/**
* @see org.apache.tools.ant.Task#execute()
*/
+ @Override
public void execute() throws BuildException
{
try
diff --git a/jetty-ant/src/main/java/org/eclipse/jetty/ant/ServerProxyImpl.java b/jetty-ant/src/main/java/org/eclipse/jetty/ant/ServerProxyImpl.java
index 0e03150c5ef..2dd2fdb9ee0 100644
--- a/jetty-ant/src/main/java/org/eclipse/jetty/ant/ServerProxyImpl.java
+++ b/jetty-ant/src/main/java/org/eclipse/jetty/ant/ServerProxyImpl.java
@@ -115,6 +115,7 @@ public class ServerProxyImpl implements ServerProxy
this.awc = awc;
}
+ @Override
public void filesChanged(List changedFileNames)
{
boolean isScanned = false;
@@ -151,6 +152,7 @@ public class ServerProxyImpl implements ServerProxy
}
+ @Override
public void addWebApplication(AntWebAppContext webApp)
{
webApplications.add(webApp);
@@ -242,6 +244,7 @@ public class ServerProxyImpl implements ServerProxy
/**
* @see org.eclipse.jetty.ant.utils.ServerProxy#start()
*/
+ @Override
public void start()
{
try
@@ -289,6 +292,7 @@ public class ServerProxyImpl implements ServerProxy
/**
* @see org.eclipse.jetty.ant.utils.ServerProxy#getProxiedObject()
*/
+ @Override
public Object getProxiedObject()
{
return server;
diff --git a/jetty-ant/src/test/java/org/eclipse/jetty/ant/AntBuild.java b/jetty-ant/src/test/java/org/eclipse/jetty/ant/AntBuild.java
index 02928f4dc8d..919b6323fb4 100644
--- a/jetty-ant/src/test/java/org/eclipse/jetty/ant/AntBuild.java
+++ b/jetty-ant/src/test/java/org/eclipse/jetty/ant/AntBuild.java
@@ -265,6 +265,7 @@ public class AntBuild
this.parser = connector;
}
+ @Override
public void run()
{
String line;
diff --git a/jetty-bom/pom.xml b/jetty-bom/pom.xml
index 69aa8bdd6bd..5321153b47d 100644
--- a/jetty-bom/pom.xml
+++ b/jetty-bom/pom.xml
@@ -172,6 +172,12 @@
10.0.0-SNAPSHOTzip
+
+ org.eclipse.jetty
+ jetty-distribution
+ 9.4.9-SNAPSHOT
+ tar.gz
+ org.eclipse.jetty.fcgifcgi-client
@@ -404,18 +410,6 @@
jetty-xml10.0.0-SNAPSHOT
-
- org.eclipse.jetty
- jetty-distribution
- 9.3.23-SNAPSHOT
- zip
-
-
- org.eclipse.jetty
- jetty-distribution
- 9.3.23-SNAPSHOT
- tar.gz
-
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/DuplexConnectionPool.java b/jetty-client/src/main/java/org/eclipse/jetty/client/DuplexConnectionPool.java
index 62a4c2d112a..5261751a62f 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/DuplexConnectionPool.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/DuplexConnectionPool.java
@@ -155,6 +155,7 @@ public class DuplexConnectionPool extends AbstractConnectionPool implements Swee
return active(connection);
}
+ @Override
public boolean release(Connection connection)
{
boolean closed = isClosed();
@@ -184,6 +185,7 @@ public class DuplexConnectionPool extends AbstractConnectionPool implements Swee
return idleConnections.offerFirst(connection);
}
+ @Override
public boolean remove(Connection connection)
{
return remove(connection, false);
@@ -212,6 +214,7 @@ public class DuplexConnectionPool extends AbstractConnectionPool implements Swee
return removed;
}
+ @Override
public void close()
{
super.close();
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java
index c56a230b7cb..cdbea4365fc 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java
@@ -979,6 +979,8 @@ public class HttpClient extends ContainerLifeCycle
/**
* Gets the http compliance mode for parsing http responses.
* The default http compliance level is {@link HttpCompliance#RFC7230} which is the latest HTTP/1.1 specification
+ *
+ * @return the HttpCompliance instance
*/
public HttpCompliance getHttpCompliance()
{
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
index c0c6e85c42f..1a2a798b224 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
@@ -361,6 +361,7 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest
protected abstract SendFailure send(Connection connection, HttpExchange exchange);
+ @Override
public void newConnection(Promise promise)
{
createConnection(promise);
@@ -376,6 +377,7 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest
return exchanges.remove(exchange);
}
+ @Override
public void close()
{
abort(new AsynchronousCloseException());
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpResponse.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpResponse.java
index 87017e6c3c2..e37e2758225 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpResponse.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpResponse.java
@@ -49,6 +49,7 @@ public class HttpResponse implements Response
return request;
}
+ @Override
public HttpVersion getVersion()
{
return version;
@@ -72,6 +73,7 @@ public class HttpResponse implements Response
return this;
}
+ @Override
public String getReason()
{
return reason;
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java
index 4dbd7acec00..b211ed32574 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java
@@ -263,6 +263,7 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
process();
}
+ @Override
public void abort(Throwable x)
{
failAndClose(x);
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/util/DeferredContentProvider.java b/jetty-client/src/main/java/org/eclipse/jetty/client/util/DeferredContentProvider.java
index c7df58be068..335c2eb0b98 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/util/DeferredContentProvider.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/util/DeferredContentProvider.java
@@ -207,6 +207,7 @@ public class DeferredContentProvider implements AsyncContentProvider, Callback,
* No more content will be added to this content provider
* and notifies the listener that no more content is available.
*/
+ @Override
public void close()
{
if (closed.compareAndSet(false, true))
diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpClientServerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpClientServerTest.java
index 473dd224965..dfbf06db406 100644
--- a/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpClientServerTest.java
+++ b/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpClientServerTest.java
@@ -38,7 +38,7 @@ import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public abstract class AbstractHttpClientServerTest
{
- @Parameterized.Parameters
+ @Parameterized.Parameters(name = "ssl={0}")
public static Collection parameters()
{
return Arrays.asList(new SslContextFactory[]{null}, new SslContextFactory[]{new SslContextFactory()});
diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTLSTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTLSTest.java
index bb3e3ac1151..cf2e355d50e 100644
--- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTLSTest.java
+++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTLSTest.java
@@ -44,6 +44,7 @@ import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.util.thread.ExecutorThreadPool;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.hamcrest.Matchers;
import org.junit.After;
@@ -58,7 +59,7 @@ public class HttpClientTLSTest
private void startServer(SslContextFactory sslContextFactory, Handler handler) throws Exception
{
- QueuedThreadPool serverThreads = new QueuedThreadPool();
+ ExecutorThreadPool serverThreads = new ExecutorThreadPool();
serverThreads.setName("server");
server = new Server(serverThreads);
diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/RoundRobinConnectionPoolTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/RoundRobinConnectionPoolTest.java
index d831f23b676..ac8a1ea9a25 100644
--- a/jetty-client/src/test/java/org/eclipse/jetty/client/RoundRobinConnectionPoolTest.java
+++ b/jetty-client/src/test/java/org/eclipse/jetty/client/RoundRobinConnectionPoolTest.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -45,23 +46,39 @@ public class RoundRobinConnectionPoolTest extends AbstractHttpClientServerTest
@Test
public void testRoundRobin() throws Exception
{
+ AtomicBoolean record = new AtomicBoolean();
List remotePorts = new ArrayList<>();
start(new EmptyServerHandler()
{
@Override
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
- remotePorts.add(request.getRemotePort());
+ if (record.get())
+ remotePorts.add(request.getRemotePort());
}
});
int maxConnections = 3;
client.getTransport().setConnectionPoolFactory(destination -> new RoundRobinConnectionPool(destination, maxConnections, destination));
+ // Prime the connections, so that they are all opened
+ // before we actually test the round robin behavior.
+ String host = "localhost";
+ int port = connector.getLocalPort();
+ for (int i = 0; i < maxConnections; ++i)
+ {
+ ContentResponse response = client.newRequest(host, port)
+ .scheme(scheme)
+ .timeout(5, TimeUnit.SECONDS)
+ .send();
+ Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
+ }
+
+ record.set(true);
int requests = 2 * maxConnections - 1;
for (int i = 0; i < requests; ++i)
{
- ContentResponse response = client.newRequest("localhost", connector.getLocalPort())
+ ContentResponse response = client.newRequest(host, port)
.scheme(scheme)
.timeout(5, TimeUnit.SECONDS)
.send();
@@ -74,7 +91,7 @@ public class RoundRobinConnectionPoolTest extends AbstractHttpClientServerTest
int base = i % maxConnections;
int expected = remotePorts.get(base);
int candidate = remotePorts.get(i);
- Assert.assertThat(expected, Matchers.equalTo(candidate));
+ Assert.assertThat(client.dump() + System.lineSeparator() + remotePorts.toString(), expected, Matchers.equalTo(candidate));
if (i > 0)
Assert.assertThat(remotePorts.get(i - 1), Matchers.not(Matchers.equalTo(candidate)));
}
diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpDestinationOverHTTPTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpDestinationOverHTTPTest.java
index 14d546fff8c..7bf55fbd71b 100644
--- a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpDestinationOverHTTPTest.java
+++ b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpDestinationOverHTTPTest.java
@@ -56,38 +56,43 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
@Test
public void test_FirstAcquire_WithEmptyQueue() throws Exception
{
- HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort()));
- destination.start();
- DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
- Connection connection = connectionPool.acquire();
- if (connection == null)
+ try(HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort())))
{
- // There are no queued requests, so the newly created connection will be idle
- connection = timedPoll(connectionPool.getIdleConnections(), 5, TimeUnit.SECONDS);
+ destination.start();
+ DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
+ Connection connection = connectionPool.acquire();
+ if (connection == null)
+ {
+ // There are no queued requests, so the newly created connection will be idle
+ connection = timedPoll(connectionPool.getIdleConnections(), 5, TimeUnit.SECONDS);
+ }
+ Assert.assertNotNull(connection);
}
- Assert.assertNotNull(connection);
}
@Test
public void test_SecondAcquire_AfterFirstAcquire_WithEmptyQueue_ReturnsSameConnection() throws Exception
{
- HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort()));
- destination.start();
- DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
- Connection connection1 = connectionPool.acquire();
- if (connection1 == null)
+ try(HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort())))
{
- // There are no queued requests, so the newly created connection will be idle
- long start = System.nanoTime();
- while (connection1 == null && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < 5)
- {
- TimeUnit.MILLISECONDS.sleep(50);
- connection1 = connectionPool.getIdleConnections().peek();
- }
- Assert.assertNotNull(connection1);
+ destination.start();
- Connection connection2 = connectionPool.acquire();
- Assert.assertSame(connection1, connection2);
+ DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
+ Connection connection1 = connectionPool.acquire();
+ if (connection1 == null)
+ {
+ // There are no queued requests, so the newly created connection will be idle
+ long start = System.nanoTime();
+ while (connection1 == null && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < 5)
+ {
+ TimeUnit.MILLISECONDS.sleep(50);
+ connection1 = connectionPool.getIdleConnections().peek();
+ }
+ Assert.assertNotNull(connection1);
+
+ Connection connection2 = connectionPool.acquire();
+ Assert.assertSame(connection1, connection2);
+ }
}
}
@@ -120,55 +125,67 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
};
}
};
- destination.start();
- DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
- Connection connection1 = connectionPool.acquire();
+
+ try
+ {
+ destination.start();
+ DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
+ Connection connection1 = connectionPool.acquire();
- // Make sure we entered idleCreated().
- Assert.assertTrue(idleLatch.await(5, TimeUnit.SECONDS));
+ // Make sure we entered idleCreated().
+ Assert.assertTrue(idleLatch.await(5, TimeUnit.SECONDS));
- // There are no available existing connections, so acquire()
- // returns null because we delayed idleCreated() above
- Assert.assertNull(connection1);
+ // There are no available existing connections, so acquire()
+ // returns null because we delayed idleCreated() above
+ Assert.assertNull(connection1);
- // Second attempt also returns null because we delayed idleCreated() above.
- Connection connection2 = connectionPool.acquire();
- Assert.assertNull(connection2);
+ // Second attempt also returns null because we delayed idleCreated() above.
+ Connection connection2 = connectionPool.acquire();
+ Assert.assertNull(connection2);
- latch.countDown();
+ latch.countDown();
- // There must be 2 idle connections.
- Queue idleConnections = connectionPool.getIdleConnections();
- Connection connection = timedPoll(idleConnections, 5, TimeUnit.SECONDS);
- Assert.assertNotNull(connection);
- connection = timedPoll(idleConnections, 5, TimeUnit.SECONDS);
- Assert.assertNotNull(connection);
+ // There must be 2 idle connections.
+ Queue idleConnections = connectionPool.getIdleConnections();
+ Connection connection = timedPoll(idleConnections, 5, TimeUnit.SECONDS);
+ Assert.assertNotNull(connection);
+ connection = timedPoll(idleConnections, 5, TimeUnit.SECONDS);
+ Assert.assertNotNull(connection);
+ }
+ finally
+ {
+ destination.close();
+ }
}
@Test
public void test_Acquire_Process_Release_Acquire_ReturnsSameConnection() throws Exception
{
- HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort()));
- destination.start();
- DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
- HttpConnectionOverHTTP connection1 = (HttpConnectionOverHTTP)connectionPool.acquire();
-
- long start = System.nanoTime();
- while (connection1 == null && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < 5)
+ try(HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort())))
{
- TimeUnit.MILLISECONDS.sleep(50);
- connection1 = (HttpConnectionOverHTTP)connectionPool.getIdleConnections().peek();
+ destination.start();
+ DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
+ HttpConnectionOverHTTP connection1 = (HttpConnectionOverHTTP)connectionPool.acquire();
+
+ Assert.assertNull(connection1);
+
+ long start = System.nanoTime();
+ while (connection1 == null && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < 5)
+ {
+ TimeUnit.MILLISECONDS.sleep(50);
+ connection1 = (HttpConnectionOverHTTP)connectionPool.getIdleConnections().peek();
+ }
+ Assert.assertNotNull(connection1);
+
+ // Acquire the connection to make it active
+ Assert.assertSame("From idle", connection1, connectionPool.acquire());
+
+ destination.process(connection1);
+ destination.release(connection1);
+
+ Connection connection2 = connectionPool.acquire();
+ Assert.assertSame("After release", connection1, connection2);
}
- Assert.assertNotNull(connection1);
-
- // Acquire the connection to make it active
- Assert.assertSame(connection1, connectionPool.acquire());
-
- destination.process(connection1);
- destination.release(connection1);
-
- Connection connection2 = connectionPool.acquire();
- Assert.assertSame(connection1, connection2);
}
@Test
@@ -177,25 +194,27 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
long idleTimeout = 1000;
client.setIdleTimeout(idleTimeout);
- HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort()));
- destination.start();
- DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
- Connection connection1 = connectionPool.acquire();
- if (connection1 == null)
+ try(HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort())))
{
- // There are no queued requests, so the newly created connection will be idle
- long start = System.nanoTime();
- while (connection1 == null && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < 5)
+ destination.start();
+ DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
+ Connection connection1 = connectionPool.acquire();
+ if (connection1 == null)
{
- TimeUnit.MILLISECONDS.sleep(50);
- connection1 = connectionPool.getIdleConnections().peek();
+ // There are no queued requests, so the newly created connection will be idle
+ long start = System.nanoTime();
+ while (connection1 == null && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < 5)
+ {
+ TimeUnit.MILLISECONDS.sleep(50);
+ connection1 = connectionPool.getIdleConnections().peek();
+ }
+ Assert.assertNotNull(connection1);
+
+ TimeUnit.MILLISECONDS.sleep(2 * idleTimeout);
+
+ connection1 = connectionPool.getIdleConnections().poll();
+ Assert.assertNull(connection1);
}
- Assert.assertNotNull(connection1);
-
- TimeUnit.MILLISECONDS.sleep(2 * idleTimeout);
-
- connection1 = connectionPool.getIdleConnections().poll();
- Assert.assertNull(connection1);
}
}
diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesTest.java
index 6c0c912ed7d..e66edf43887 100644
--- a/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesTest.java
+++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesTest.java
@@ -140,6 +140,7 @@ public abstract class SslBytesTest
serverSocket.close();
}
+ @Override
public void run()
{
try
diff --git a/jetty-deploy/src/main/config/modules/global-webapp-common.d/global-webapp-common.xml b/jetty-deploy/src/main/config/modules/global-webapp-common.d/global-webapp-common.xml
new file mode 100644
index 00000000000..5eee32ec2ac
--- /dev/null
+++ b/jetty-deploy/src/main/config/modules/global-webapp-common.d/global-webapp-common.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+ jetty.deploy.webappCommonConfig
+
+ /etc/webapp-common.xml
+
+
+
+
+
+
+
+
diff --git a/jetty-deploy/src/main/config/modules/global-webapp-common.d/webapp-common.xml b/jetty-deploy/src/main/config/modules/global-webapp-common.d/webapp-common.xml
new file mode 100644
index 00000000000..3a056f63569
--- /dev/null
+++ b/jetty-deploy/src/main/config/modules/global-webapp-common.d/webapp-common.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/jetty-deploy/src/main/config/modules/global-webapp-common.mod b/jetty-deploy/src/main/config/modules/global-webapp-common.mod
new file mode 100644
index 00000000000..2785fef3c8c
--- /dev/null
+++ b/jetty-deploy/src/main/config/modules/global-webapp-common.mod
@@ -0,0 +1,17 @@
+[description]
+Enables Deployer to apply common configuration to all webapp deployments
+
+[depend]
+deploy
+
+[xml]
+etc/global-webapp-common.xml
+
+[files]
+basehome:modules/global-webapp-common.d/global-webapp-common.xml|etc/global-webapp-common.xml
+basehome:modules/global-webapp-common.d/webapp-common.xml|etc/webapp-common.xml
+
+[ini-template]
+
+# Location of webapp xml config file to apply after context xml
+# jetty.deploy.webappCommonConfig=${jetty.base}/etc/webapp-common.xml
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/AppLifeCycle.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/AppLifeCycle.java
index b52562af89e..3035dcd4768 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/AppLifeCycle.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/AppLifeCycle.java
@@ -74,6 +74,7 @@ public class AppLifeCycle extends Graph
public static final String STARTED = "started";
public static final String STOPPING = "stopping";
public static final String UNDEPLOYING = "undeploying";
+ public static final String FAILED = "failed";
private Map> lifecyclebindings = new HashMap>();
@@ -97,6 +98,9 @@ public class AppLifeCycle extends Graph
// deployed -> undeployed
addEdge(DEPLOYED,UNDEPLOYING);
addEdge(UNDEPLOYING,UNDEPLOYED);
+
+ // failed (unconnected)
+ addNode(new Node(FAILED));
}
public void addBinding(AppLifeCycle.Binding binding)
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java
index 413ad5cff66..ac5541aede7 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java
@@ -507,6 +507,18 @@ public class DeploymentManager extends ContainerLifeCycle
catch (Throwable t)
{
LOG.warn("Unable to reach node goal: " + nodeName,t);
+ // migrate to FAILED node
+ Node failed = _lifecycle.getNodeByName(AppLifeCycle.FAILED);
+ appentry.setLifeCycleNode(failed);
+ try
+ {
+ _lifecycle.runBindings(failed, appentry.app, this);
+ }
+ catch (Throwable ignore)
+ {
+ // The runBindings failed for 'failed' node
+ LOG.ignore(ignore);
+ }
}
}
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/DebugBinding.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/DebugBinding.java
index e96ffaae5f6..a3db7dba23e 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/DebugBinding.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/DebugBinding.java
@@ -40,11 +40,13 @@ public class DebugBinding implements AppLifeCycle.Binding
_targets=targets;
}
+ @Override
public String[] getBindingTargets()
{
return _targets;
}
+ @Override
public void processBinding(Node node, App app) throws Exception
{
LOG.info("processBinding {} {}",node,app.getContextHandler());
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/DebugListenerBinding.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/DebugListenerBinding.java
index de2ea705de7..cef0ad3ec66 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/DebugListenerBinding.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/DebugListenerBinding.java
@@ -45,6 +45,7 @@ public class DebugListenerBinding extends DebugBinding
return _debugListener;
}
+ @Override
public void processBinding(Node node, App app) throws Exception
{
app.getContextHandler().addEventListener(_debugListener);
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.java
index 730f21d8262..356da974740 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.java
@@ -62,11 +62,13 @@ public class GlobalWebappConfigBinding implements AppLifeCycle.Binding
this._jettyXml = jettyXml;
}
+ @Override
public String[] getBindingTargets()
{
return new String[] { "deploying" };
}
+ @Override
public void processBinding(Node node, App app) throws Exception
{
ContextHandler handler = app.getContextHandler();
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/OrderedGroupBinding.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/OrderedGroupBinding.java
index d06bb9a7ea7..68f42b6df8e 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/OrderedGroupBinding.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/OrderedGroupBinding.java
@@ -63,11 +63,13 @@ public class OrderedGroupBinding implements AppLifeCycle.Binding
}
}
+ @Override
public String[] getBindingTargets()
{
return _bindingTargets;
}
+ @Override
public void processBinding(Node node, App app) throws Exception
{
for ( AppLifeCycle.Binding binding : _orderedBindings )
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardDeployer.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardDeployer.java
index cdf254e046a..f98cadeac85 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardDeployer.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardDeployer.java
@@ -25,12 +25,14 @@ import org.eclipse.jetty.server.handler.ContextHandler;
public class StandardDeployer implements AppLifeCycle.Binding
{
+ @Override
public String[] getBindingTargets()
{
return new String[]
{ "deploying" };
}
+ @Override
public void processBinding(Node node, App app) throws Exception
{
ContextHandler handler = app.getContextHandler();
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardStarter.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardStarter.java
index 5eed00033c2..30403641ae7 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardStarter.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardStarter.java
@@ -22,6 +22,7 @@ import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.AppLifeCycle;
import org.eclipse.jetty.deploy.graph.Node;
import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
public class StandardStarter implements AppLifeCycle.Binding
{
@@ -35,12 +36,17 @@ public class StandardStarter implements AppLifeCycle.Binding
@Override
public void processBinding(Node node, App app) throws Exception
{
+ ContextHandlerCollection contexts = app.getDeploymentManager().getContexts();
+
ContextHandler handler = app.getContextHandler();
-
- // start the handler
- handler.start();
-
- // After starting let the context manage state
- app.getDeploymentManager().getContexts().manage(handler);
+
+ if (contexts.isStarted() && handler.isStopped())
+ {
+ // start the handler manually
+ handler.start();
+
+ // After starting let the context manage state
+ contexts.manage(handler);
+ }
}
}
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/GraphOutputDot.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/GraphOutputDot.java
index d2ea987c8f9..90753a792f9 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/GraphOutputDot.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/GraphOutputDot.java
@@ -50,6 +50,7 @@ public class GraphOutputDot
{
private Collator collator = Collator.getInstance();
+ @Override
public int compare(Node o1, Node o2)
{
if (o1.getName().equals(TOPNODE))
diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCyclePathCollector.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCyclePathCollector.java
index 43fadea8eaf..0555561a29c 100644
--- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCyclePathCollector.java
+++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCyclePathCollector.java
@@ -41,12 +41,14 @@ public class AppLifeCyclePathCollector implements AppLifeCycle.Binding
return actualOrder;
}
+ @Override
public String[] getBindingTargets()
{
return new String[]
{ "*" };
}
+ @Override
public void processBinding(Node node, App app) throws Exception
{
actualOrder.add(node);
diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/MockAppProvider.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/MockAppProvider.java
index e7716d14df3..f50390db610 100644
--- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/MockAppProvider.java
+++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/MockAppProvider.java
@@ -33,6 +33,7 @@ public class MockAppProvider extends AbstractLifeCycle implements AppProvider
private DeploymentManager deployMan;
private File webappsDir;
+ @Override
public void setDeploymentManager(DeploymentManager deploymentManager)
{
this.deployMan = deploymentManager;
@@ -50,6 +51,7 @@ public class MockAppProvider extends AbstractLifeCycle implements AppProvider
this.deployMan.addApp(app);
}
+ @Override
public ContextHandler createContextHandler(App app) throws Exception
{
WebAppContext context = new WebAppContext();
diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java
index cb8c7f4e921..5475af47b48 100644
--- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java
+++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java
@@ -80,6 +80,7 @@ public class ScanningAppProviderRuntimeUpdatesTest
_providers++;
((ScanningAppProvider)provider).addScannerListener(new Scanner.ScanListener()
{
+ @Override
public void scan()
{
_scans.incrementAndGet();
diff --git a/jetty-documentation/src/main/asciidoc/administration/alpn/alpn.adoc b/jetty-documentation/src/main/asciidoc/administration/alpn/alpn.adoc
index c08d26a924a..b369c1b52db 100644
--- a/jetty-documentation/src/main/asciidoc/administration/alpn/alpn.adoc
+++ b/jetty-documentation/src/main/asciidoc/administration/alpn/alpn.adoc
@@ -23,48 +23,40 @@ Application Layer Protocol Negotiation (ALPN) is a TLS extension that allows cli
Any protocol can be negotiated by ALPN within a TLS connection; the protocols that are most commonly negotiated are HTTP/2 and HTTP/1.1.
+Browsers only support HTTP/2 over TLS by negotiating the HTTP/2 protocol via ALPN.
+You need to configure the server to support TLS and ALPN if you want browsers to use
+the HTTP/2 protocol, otherwise they will default to HTTP/1.1.
+
In the Jetty project, ALPN is _used_ in two artifacts: `jetty-alpn-client` and `jetty-alpn-server`, respectively for the client and for the server.
When using Jetty as a standalone server via the Jetty distribution, the `jetty-alpn-server` artifact is automatically included in the server classpath by the Jetty module system.
When using Jetty embedded, the `jetty-alpn-client` and `jetty-alpn-server` artifacts must be included in the classpath, respectively for client and server use cases.
-ALPN may be _provided_ to these two artifacts with the following three options:
+The ALPN implementation is _provided_ to these two artifacts with the following three options:
-* For JDK 9 or later, a provider based on the ALPN APIs present in the JDK
-* For JDK 8 or later, a provider based on the link:#conscrypt[Conscrypt security provider]
* For JDK 8 only, a provider based on modified OpenJDK classes
+** Only works with JDK 8, pure Java implementation
+** Requires the `-Xbootclasspath/p` option on command line
+* For JDK 8 or later, a provider based on the link:#conscrypt[Conscrypt security provider]
+** Works with JDK 8 or later and provides improved performance
+** Binds to the OpenSSL native library shipped by Conscrypt and is therefore only available on the platforms supported by Conscrypt
+* For JDK 9 or later, a provider based on the ALPN APIs present in the JDK
+** Works with JDK 9 or later, pure Java implementation
+** Lower performance than Conscrypt
-The latter, although hosted under the umbrella of the Jetty project, is independent of Jetty (the Servlet Container); you can use it in any other Java network server.
+The first, although hosted under the umbrella of the Jetty project, is independent of Jetty (the Servlet Container); you can use it in any other Java network server.
-Each provider above provides a _service_ implementation; Jetty uses the `ServiceLoader` mechanism to load these service implementations.
-The absence of implementations is an error at startup (see also the link:#alpn-troubleshooting[troubleshooting section]).
+Each provider above provides an ALPN _service_ implementation; Jetty uses the `ServiceLoader` mechanism to load these service implementations.
+At least one valid provider must be present in the server classpath.
+For example, using JDK 8 with the JDK 9 ALPN provider is an _invalid_ combination.
+The absence of valid implementations is an error at startup (see also the link:#alpn-troubleshooting[troubleshooting section]).
+There may be multiple ALPN service providers in the server classpath.
When a new connection is created, an `SSLEngine` instance is associated to it; each `SSLEngine` is passed all service implementations, until one accepts it.
It is therefore possible to have multiple providers active at the same time, for example the JDK 9 provider and the Conscrypt provider, and at runtime the correct one will be chosen by the Jetty runtime.
-[[alpn-jdk9]]
-==== ALPN and JDK 9
-
-When using JDK 9 or later and Jetty as a standalone server via the Jetty distribution, ALPN support is automatically enabled when the `http2` module is enabled.
-This enables transitively the `alpn-9` module which puts the `jetty-alpn-java-server` artifact in the server classpath, providing the ALPN JDK 9 service implementation.
-
-When using JDK 9 or later and Jetty embedded, the ALPN service implementation is provided by the `jetty-alpn-java-client` and `jetty-alpn-java-server` artifacts, respectively for client usage and server usage, and must be added to the classpath.
-
-[[alpn-conscrypt]]
-==== ALPN and Conscrypt
-
-When using JDK 8 or later, you can use the https://conscrypt.org/[Conscrypt] security provider to provide the ALPN service implementation.
-
-Conscrypt binds natively to BoringSSL (a fork of OpenSSL by Google), so ALPN will be supported via the support provided by BoringSSL (bundled together with Conscrypt).
-
-When using Jetty as a standalone server via the Jetty distribution, ALPN is enabled by enabling the `conscrypt` module.
-
-When using Jetty embedded, ALPN is enabled by the `jetty-alpn-conscrypt-client` and `jetty-alpn-conscrypt-server` artifacts, respectively for client usage and server usage.
-In addition, you also need the Conscrypt artifacts, typically the `org.conscrypt:conscrypt-openjdk-uber` artifact.
-All these artifacts must be added to the classpath.
-
[[alpn-openjdk8]]
==== ALPN and OpenJDK 8
@@ -94,6 +86,27 @@ Where `path_to_alpn_boot_jar` is the path on the file system for the `alpn-boot`
Be certain to get the link:#alpn-versions[ALPN boot artifact version that matches the version of your JRE].
+[[alpn-conscrypt]]
+==== ALPN and Conscrypt
+
+When using JDK 8 or later, you can use the https://conscrypt.org/[Conscrypt] security provider to provide the ALPN service implementation.
+
+Conscrypt binds natively to BoringSSL (a fork of OpenSSL by Google), so ALPN will be supported via the support provided by BoringSSL (bundled together with Conscrypt).
+
+When using Jetty as a standalone server via the Jetty distribution, ALPN is enabled by enabling the `conscrypt` module.
+
+When using Jetty embedded, ALPN is enabled by the `jetty-alpn-conscrypt-client` and `jetty-alpn-conscrypt-server` artifacts, respectively for client usage and server usage.
+In addition, you also need the Conscrypt artifacts, typically the `org.conscrypt:conscrypt-openjdk-uber` artifact.
+All these artifacts must be added to the classpath.
+
+[[alpn-jdk9]]
+==== ALPN and JDK 9
+
+When using JDK 9 or later and Jetty as a standalone server via the Jetty distribution, ALPN support is automatically enabled when the `http2` module is enabled.
+This enables transitively the `alpn-9` module which puts the `jetty-alpn-java-server` artifact in the server classpath, providing the ALPN JDK 9 service implementation.
+
+When using JDK 9 or later and Jetty embedded, the ALPN service implementation is provided by the `jetty-alpn-java-client` and `jetty-alpn-java-server` artifacts, respectively for client usage and server usage, and must be added to the classpath.
+
[[alpn-osgi]]
===== Starting in OSGi
diff --git a/jetty-documentation/src/main/asciidoc/administration/alpn/chapter.adoc b/jetty-documentation/src/main/asciidoc/administration/alpn/chapter.adoc
index e7f7b36aba7..490f689ec1a 100644
--- a/jetty-documentation/src/main/asciidoc/administration/alpn/chapter.adoc
+++ b/jetty-documentation/src/main/asciidoc/administration/alpn/chapter.adoc
@@ -19,12 +19,15 @@
[[alpn-chapter]]
== Application Layer Protocol Negotiation (ALPN)
-The development of new web protocols such as HTTP/2 raised the need of protocol negotiation within a Transport Layer Security (TLS) handshake.
-A protocol negotiation called https://tools.ietf.org/html/rfc7301[ALPN] (Application Layer Protocol Negotiation) RFC7301 has been defined to accomplish this.
+The development of new web protocols such as HTTP/2 raised the need of protocol
+negotiation within a Transport Layer Security (TLS) handshake.
+A protocol negotiation called ALPN (Application Layer Protocol Negotiation -
+https://tools.ietf.org/html/rfc7301[RFC7301]) has been defined to accomplish this.
-ALPN has now replaced the older (and now fully deprecated) NPN in the general Web of 2016.
+ALPN has now replaced the older (and now fully deprecated) NPN in the general Web
+as of 2016.
-For those browsers that support HTTP/2, they all now support the ALPN negotiation layers for TLS.
+For those browsers that support HTTP/2, they all now support ALPN.
Starting with Jetty 9.3.0, only ALPN is supported by Jetty.
include::alpn.adoc[]
diff --git a/jetty-documentation/src/main/asciidoc/configuring/contexts/temporary-directories.adoc b/jetty-documentation/src/main/asciidoc/configuring/contexts/temporary-directories.adoc
index a81304b31e5..f9851d47ce5 100644
--- a/jetty-documentation/src/main/asciidoc/configuring/contexts/temporary-directories.adoc
+++ b/jetty-documentation/src/main/asciidoc/configuring/contexts/temporary-directories.adoc
@@ -23,7 +23,7 @@ Jetty itself has no temporary directories, but you can assign a directory for ea
If you do not assign a specific temporary directory, Jetty will create one as needed when your web application starts.
Whether you set the location of the temporary directory - or you let Jetty create one for you - you also have a choice to either keep or delete the temporary directory when the web application stops.
-==== The default temp directory
+==== The Default Temp Directory
By default, Jetty will create a temporary directory for each web application. The name of the directory will be of the form:
@@ -75,12 +75,13 @@ context.setWar("foo.war");
context.setAttribute("org.eclipse.jetty.webapp.basetempdir", "/tmp/foo");
----
-==== Setting a specific temp directory
+==== Setting a Specific Temp Directory
There are several ways to use a particular directory as the temporary directory:
===== Call WebAppContext.setTempDirectory(String dir)
-As before this can be accomplished with an xml file or directly in code. Here's an example of setting the temp directory in xml:
+As before this can be accomplished with an XML file or directly in code.
+Here is an example of setting the temp directory in XML:
[source, xml, subs="{sub-order}"]
----
@@ -93,7 +94,7 @@ As before this can be accomplished with an xml file or directly in code. Here's
----
-Here's an example of doing it with java code:
+And here is an example of doing it with java code:
[source, java, subs="{sub-order}"]
----
@@ -103,8 +104,9 @@ context.setWar("foo.war");
context.setTempDirectory(new File("/some/dir/foo"));
----
-===== Set the javax.servlet.context.tempdir context attribute
-You should set this context attribute with the name of directory you want to use as the temp directory. Again, you can do this in xml:
+===== Setting the javax.servlet.context.tempdir Context Attribute
+You should set this context attribute with the name of directory you want to use as the temp directory.
+Again, you can do this in XML:
[source, xml, subs="{sub-order}"]
----
@@ -139,13 +141,61 @@ Be wary of setting an explicit temp directory if you are likely to change the ja
There is a JVM bug concerning link:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4774421[caching of jar contents.]
____
-==== The "work" directory
+===== Setting the Temp Directory on the Command Line
+You can set the location of the temp directory on the command line when Jetty starts up in two ways.
+First is the most straightforward, simply add it to your command line when starting Jetty.
-Mostly for backward compatibility, from Jetty 9.1.1 onwards, it is possible to create a directory named "work" in the `$\{jetty.base}` directory.
+[source, screen, subs="{sub-order}"]
+----
+java -jar ../start.jar -Djava.io.tmpdir=/path/to/desired/directory
+----
+
+Alternately, this can be defined in a link:#startup-modules[module.]
+The `jvm` module packaged with Jetty is set up to add additional JVM options.
+After enabling the module (using the `--add-to-start=jvm` command), edit the `jvm.ini` file and add the location to the temporary directory.
+You will also need verify the line including the `--exec` command is not commented out, as this is required for Jetty to start a new, forked JVM.
+Below is an example of the standard `jvm.ini` file altered to include a reference to a temp directory.
+
+[source, screen, subs="{sub-order}"]
+....
+# ---------------------------------------
+# Module: jvm
+# A noop module that creates an ini template useful for
+# setting JVM arguments (eg -Xmx )
+# ---------------------------------------
+--module=jvm
+
+## JVM Configuration
+## If JVM args are include in an ini file then --exec is needed
+## to start a new JVM from start.jar with the extra args.
+##
+## If you wish to avoid an extra JVM running, place JVM args
+## on the normal command line and do not use --exec
+--exec
+# -Xmx2000m
+# -Xmn512m
+# -XX:+UseConcMarkSweepGC
+# -XX:ParallelCMSThreads=2
+# -XX:+CMSClassUnloadingEnabled
+# -XX:+UseCMSCompactAtFullCollection
+# -XX:CMSInitiatingOccupancyFraction=80
+# -internal:gc
+# -XX:+PrintGCDateStamps
+# -XX:+PrintGCTimeStamps
+# -XX:+PrintGCDetails
+# -XX:+PrintTenuringDistribution
+# -XX:+PrintCommandLineFlags
+# -XX:+DisableExplicitGC
+-Djava.io.tmpdir=/path/to/desired/directory
+....
+
+==== The "work" Directory
+
+It is possible to create a directory named `work` in the `$\{jetty.base}` directory.
If such a directory is found, it is assumed you want to use it as the parent directory for all of the temporary directories of the webapps in `$\{jetty.base}`.
Moreover, as has historically been the case, these temp directories inside the work directory are not cleaned up when Jetty exits (or more correctly speaking, the `temp` directory corresponding to a context is not cleaned up when that context stops).
-When a work directory is used, the algorithm for generating the name of the context-specific temp directories omits the random digit string.
+When a `work` directory is used, the algorithm for generating the name of the context-specific temp directories omits the random digit string.
This ensures the name of the directory remains consistent across context restarts.
==== Persisting the temp directory
diff --git a/jetty-documentation/src/main/asciidoc/quick-start/introduction/what-version.adoc b/jetty-documentation/src/main/asciidoc/quick-start/introduction/what-version.adoc
index 9d54ce8a082..a14335c1845 100644
--- a/jetty-documentation/src/main/asciidoc/quick-start/introduction/what-version.adoc
+++ b/jetty-documentation/src/main/asciidoc/quick-start/introduction/what-version.adoc
@@ -26,7 +26,7 @@ While many people continue to use older versions of Jetty, we generally recommen
_____
[IMPORTANT]
It is important that only stable releases are used in production environments.
-Versions that have been deprecated or are released as Milestones (M) or Release Candidates (RC) are not suitable for production as they may contain security flaws or incomplete/non-functioning feature sets.
+Versions that have been deprecated or are released as Milestones (M) or Release Candidates (RC) are not suitable for production as they may contain security flaws or incomplete/non-functioning feature sets.
_____
.Jetty Versions
@@ -35,7 +35,7 @@ _____
|Version |Year |Home |JVM |Protocols |Servlet |JSP |Status
|9.4 |2016- |Eclipse |1.8 |HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI |3.1 |2.3 |Stable
|9.3 |2015- |Eclipse |1.8 |HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI |3.1 |2.3 |Stable
-|9.2 |2014- |Eclipse |1.7 |HTTP/1.1 RFC2616, javax.websocket, SPDY v3 |3.1 |2.3 |Stable
+|9.2 |2014- |Eclipse |1.7 |HTTP/1.1 RFC2616, javax.websocket, SPDY v3 |3.1 |2.3 |Deprecated / *End of Life January 2018*
|8 |2009-2014 |Eclipse/Codehaus |1.6 |HTTP/1.1 RFC2616, WebSocket RFC 6455, SPDY v3 |3.0 |2.2 |Deprecated / *End of Life November 2014*
|7 |2008-2014 |Eclipse/Codehaus |1.5 |HTTP/1.1 RFC2616, WebSocket RFC 6455, SPDY v3 |2.5 |2.1 |Deprecated / *End of Life November 2014*
|6 |2006-2010 |Codehaus |1.4-1.5 |HTTP/1.1 RFC2616 |2.5 |2.0 |Deprecated / *End of Life November 2010*
diff --git a/jetty-documentation/src/main/asciidoc/reference/architecture/jetty-classloading.adoc b/jetty-documentation/src/main/asciidoc/reference/architecture/jetty-classloading.adoc
index 641053800ee..071f15314c7 100644
--- a/jetty-documentation/src/main/asciidoc/reference/architecture/jetty-classloading.adoc
+++ b/jetty-documentation/src/main/asciidoc/reference/architecture/jetty-classloading.adoc
@@ -23,10 +23,10 @@ Class loading in a web container is slightly more complex than a normal Java app
The normal configuration is that each web context (web application or WAR file) has its own classloader, which has the system classloader as its parent.
Such a classloader hierarchy is normal in Java, however the servlet specification complicates the hierarchy because it requires the following:
-* Classes contained within WEB-INF/lib or WEB-INF/classes have priority over classes on the parent classloader.
-This is the opposite of the normal behaviour of a Java 2 classloader.
+* Classes contained within `WEB-INF/lib` or `WEB-INF/classes` have priority over classes on the parent classloader.
+This is the opposite of the normal behavior of a Java 2 classloader.
* System classes such as `java.lang.String` are excluded from the webapp priority, and you may not replace them with classes in `WEB-INF/lib` or `WEB-INF/` classes.
-Unfortunately the specification does not clearly state what classes are _System_ classes, and it is unclear if all javax classes should be treated as System classes.
+Unfortunately the specification does not clearly state what classes are _System_ classes, and it is unclear if all `javax` classes should be treated as System classes.
* Server implementation classes like link:{JDURL}/org/eclipse/jetty/server/Server.html[Server] should be hidden from the web application and should not be available in any classloader.
Unfortunately the specification does not state what classes are _Server_ classes, and it is unclear if common libraries like the Xerces parser should be treated as Implementation classes.
@@ -38,6 +38,7 @@ Jetty provides configuration options to control the three webapp class loading i
You can configure webapp classloading by several methods on the link:{JDURL}/org/eclipse/jetty/webapp/WebAppContext.html[WebAppContext].
You can call these methods directly if you are working with the Jetty API, or you can inject methods from a context XML file if you are using the Context Provider (xref:using-context-provider[]).
You CANNOT set these methods from a `jetty-web.xml` file, as it executes after the classloader configuration is set.
+As a note, `jetty-web.xml` uses the webapp classpath and not the classpath of the server.
[[controlling-webapp-classloader-priority]]
===== Controlling Webapp Classloader Priority
@@ -152,7 +153,7 @@ You can do so directly to the API via a context XML file such as the following:
----
...
- ../my/classes,../my/jars/special.jar,../my/jars/other.jar
...
----
@@ -178,8 +179,8 @@ You can also accomplish this in a context xml file.
[[starting-jetty-custom-classloader]]
==== Starting Jetty with a Custom ClassLoader
-If you start a Jetty server using a custom class loader–consider the Jetty classes not being available to the system class loader, only your custom class loader–you may run into class loading issues when the WebAppClassLoader kicks in.
-By default the WebAppClassLoader uses the system class loader as its parent, hence the problem. This is easy to fix, like so:
+If you start a Jetty server using a custom class loader–consider the Jetty classes not being available to the system class loader, only your custom class loader–you may run into class loading issues when the `WebAppClassLoader` kicks in.
+By default the `WebAppClassLoader` uses the system class loader as its parent, hence the problem. This is easy to fix, like so:
[source, java, subs="{sub-order}"]
----
diff --git a/jetty-documentation/src/main/asciidoc/reference/contributing/community.adoc b/jetty-documentation/src/main/asciidoc/reference/contributing/community.adoc
index 58fde530cde..e73a038e53f 100644
--- a/jetty-documentation/src/main/asciidoc/reference/contributing/community.adoc
+++ b/jetty-documentation/src/main/asciidoc/reference/contributing/community.adoc
@@ -50,6 +50,3 @@ Users are always welcome to come join our IRC channels and talk with us, other u
irc.freenode.org - #jetty::
Our primary location, we recommend that if your looking to find folks on IRC you try here.
We also have commit notifications coming to this channel on the bottom and top of the hour.
-irc.codehaus.org - #jetty::
- Our prior location before the move to the eclipse foundation.
- We are idle on here.
diff --git a/jetty-documentation/src/main/asciidoc/reference/jetty-xml/jetty-web-xml-config.adoc b/jetty-documentation/src/main/asciidoc/reference/jetty-xml/jetty-web-xml-config.adoc
index 7f785edc17d..283e9ea8e3c 100644
--- a/jetty-documentation/src/main/asciidoc/reference/jetty-xml/jetty-web-xml-config.adoc
+++ b/jetty-documentation/src/main/asciidoc/reference/jetty-xml/jetty-web-xml-config.adoc
@@ -42,7 +42,7 @@ For a more in-depth look at the syntax, see xref:jetty-xml-syntax[].
____
[CAUTION]
-Make sure you are applying the configuration to an instance of the proper class. `jetty-web.xml` configures an instance of WebAppContext; `jetty.xml` configures an instance of Server.
+Make sure you are applying the configuration to an instance of the proper class. `jetty-web.xml` configures an instance of `WebAppContext`; `jetty.xml` configures an instance of `Server`.
____
[[using-jetty-web-xml]]
@@ -52,10 +52,15 @@ Place the `jetty-web.xml` into your web application's `WEB-INF` folder.
When Jetty deploys a web application, it looks for a file called `WEB-INF/jetty-web.xml` or `WEB-INF/web-jetty.xml` within the web application (or WAR) and applies the configuration found there.
Be aware that `jetty-web.xml` is called _after_ all other configuration has been applied to the web application.
-[[jetty-web-xml-examples]]
-==== `jetty-web.xml` Examples
+____
+[IMPORTANT]
+It is important to note that `jetty-web.xml` files utilize the webapp classpath, not the classpath of the server.
+____
-The distribution contains an example of `jetty-web.xml` inside the WEB-INF folder of the test webapp war (`$JETTY_HOME/webapps/test.war/WEB-INF/jetty-web.xml`).
+[[jetty-web-xml-examples]]
+==== jetty-web.xml Examples
+
+The distribution contains an example of `jetty-web.xml` inside the WEB-INF folder of the `test` webapp WAR (`$JETTY_HOME/demo-base/webapps/test.war/WEB-INF/jetty-web.xml`).
[[additional-jetty-web-xml-resources]]
==== Additional `jetty-web.xml` Resources
diff --git a/jetty-documentation/src/main/asciidoc/reference/troubleshooting/security-reports.adoc b/jetty-documentation/src/main/asciidoc/reference/troubleshooting/security-reports.adoc
index 1c12f5ff1d5..3e071685408 100644
--- a/jetty-documentation/src/main/asciidoc/reference/troubleshooting/security-reports.adoc
+++ b/jetty-documentation/src/main/asciidoc/reference/troubleshooting/security-reports.adoc
@@ -27,11 +27,11 @@ If you would like to report a security issue please follow these link:#security-
[width="99%",cols="11%,19%,14%,9%,14%,14%,19%",options="header",]
|=======================================================================
|yyyy/mm/dd |ID |Exploitable |Severity |Affects |Fixed Version |Comment
-|2016/05/31 |CVE-2016-4800 |high |high |>= 9.3.0, < = 9.3.8 |9.3.9
-|http://www.ocert.org/advisories/ocert-2016-001.html[Alias vulnerability allowing access to protected resources within a webapp on Windows.]
+|2016/05/31 |http://www.ocert.org/advisories/ocert-2016-001.html[CVE-2016-4800] |high |high |>= 9.3.0, < = 9.3.8 |9.3.9
+|Alias vulnerability allowing access to protected resources within a webapp on Windows.
-|2015/02/24 |CVE-2015-2080 |high |high |>=9.2.3 <9.2.9 |9.2.9
-|http://blog.gdssecurity.com/labs/2015/2/25/jetleak-vulnerability-remote-leakage-of-shared-buffers-in-je.html[JetLeak exposure of past buffers during HttpParser error]
+|2015/02/24 |http://blog.gdssecurity.com/labs/2015/2/25/jetleak-vulnerability-remote-leakage-of-shared-buffers-in-je.html[CVE-2015-2080] |high |high |>=9.2.3 <9.2.9 |9.2.9
+|JetLeak exposure of past buffers during HttpParser error
|2013/11/27 |http://en.securitylab.ru/lab/PT-2013-65[PT-2013-65] |medium
|high |>=9.0.0 <9.0.5 |9.0.6
@@ -55,7 +55,7 @@ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367638[Jetty-367638]
around by turning off SSL renegotiation in Jetty. If using JVM > 1.6u19
setAllowRenegotiate(true) may be called on connectors.
-|2009/06/18 |http://jira.codehaus.org/browse/JETTY-1042[Jetty-1042] |low
+|2009/06/18 |Jetty-1042 |low
|high |< = 6.1.18, < = 7.0.0.M4 |6.1.19, 7.0.0.Rc0 |Cookie leak between
requests sharing a connection.
@@ -63,7 +63,7 @@ requests sharing a connection.
|high |< = 6.1.16, < = 7.0.0.M2 a|
5.1.15, 6.1.18, 7.0.0.M2
-http://jira.codehaus.org/browse/JETTY-1004[Jetty-1004]
+Jetty-1004
|View arbitrary disk content in some specific configurations.
@@ -72,7 +72,7 @@ http://jira.codehaus.org/browse/JETTY-1004[Jetty-1004]
|high |medium |6.1.rrc0-6.1.6 a|
6.1.7
-http://jira.codehaus.org/browse/JETTY-386[CERT553235]
+CERT553235
|Static content visible in WEB-INF and past security constraints.
diff --git a/jetty-documentation/src/main/docbkx-stylesheet/html/docbook.xsl b/jetty-documentation/src/main/docbkx-stylesheet/html/docbook.xsl
index 44ebe4d4a1c..6d80ad61e3b 100644
--- a/jetty-documentation/src/main/docbkx-stylesheet/html/docbook.xsl
+++ b/jetty-documentation/src/main/docbkx-stylesheet/html/docbook.xsl
@@ -129,7 +129,7 @@ xmlns:date="http://exslt.org/dates-and-times"
-
-
+ -->
diff --git a/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java b/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java
index d8e6c6915fa..178b73079d0 100644
--- a/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java
+++ b/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java
@@ -916,6 +916,7 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
final AtomicReference exception = new AtomicReference();
Runnable load = new Runnable()
{
+ @Override
public void run ()
{
try
diff --git a/jetty-hazelcast/pom.xml b/jetty-hazelcast/pom.xml
index 092cb847dc7..b184f798e29 100644
--- a/jetty-hazelcast/pom.xml
+++ b/jetty-hazelcast/pom.xml
@@ -12,7 +12,7 @@
Jetty :: Hazelcast Session Manager
- 3.8.2
+ 3.9.3${project.groupId}.hazelcast
diff --git a/jetty-home/pom.xml b/jetty-home/pom.xml
index f682d628cf5..335e481d124 100644
--- a/jetty-home/pom.xml
+++ b/jetty-home/pom.xml
@@ -12,6 +12,7 @@
${basedir}/target/jetty-home
+ ${basedir}/target/jetty-home-sources1.0.3
@@ -150,6 +151,25 @@
${assembly-directory}/lib
+
+ copy-lib-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+ org.eclipse.jetty
+
+ org.eclipse.jetty.orbit,org.eclipse.jetty.http2,org.eclipse.jetty.websocket,org.eclipse.jetty.fcgi,org.eclipse.jetty.toolchain,org.apache.taglibs
+
+
+ jetty-all,apache-jsp,apache-jstl,jetty-start,jetty-spring
+
+ jar
+ sources
+ ${source-assembly-directory}/lib
+
+ copy-lib-websocket-depsgenerate-resources
@@ -163,6 +183,20 @@
${assembly-directory}/lib/websocket
+
+ copy-lib-websocket-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+ javax.websocket,org.eclipse.jetty.websocket
+ javax.websocket-client-api
+ jar
+ sources
+ ${source-assembly-directory}/lib/websocket
+
+ copy-lib-http2-depsgenerate-resources
@@ -176,6 +210,20 @@
${assembly-directory}/lib/http2
+
+ copy-lib-http2-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+ org.eclipse.jetty.http2
+ http2-hpack,http2-common,http2-server
+ jar
+ sources
+ ${source-assembly-directory}/lib/http2
+
+ copy-lib-fcgi-depsgenerate-resources
@@ -188,6 +236,19 @@
${assembly-directory}/lib/fcgi
+
+ copy-lib-fcgi-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+ org.eclipse.jetty.fcgi
+ jar
+ sources
+ ${source-assembly-directory}/lib/fcgi
+
+ copy-lib-spring-depsgenerate-resources
@@ -201,6 +262,20 @@
${assembly-directory}/lib/spring
+
+ copy-lib-spring-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+ org.eclipse.jetty
+ jetty-spring
+ jar
+ sources
+ ${source-assembly-directory}/lib/spring
+
+ copy-servlet-api-depsgenerate-resources
@@ -241,6 +316,20 @@
${assembly-directory}/lib/annotations
+
+ copy-annotations-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+ javax.annotation,org.eclipse.jetty.orbit,org.ow2.asm
+ javax.annotation-api,asm,asm-commons
+ jar
+ sources
+ ${source-assembly-directory}/lib/annotations
+
+ copy-apache-jsp-depsgenerate-resources
@@ -257,6 +346,23 @@
${assembly-directory}/lib/apache-jsp
+
+ copy-apache-jsp-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+
+ org.eclipse.jetty,org.eclipse.jetty.toolchain,org.mortbay.jasper,org.eclipse.jdt
+
+ apache-jsp,apache-el,ecj
+ jar
+ sources
+ true
+ ${source-assembly-directory}/lib/apache-jsp
+
+ copy-apache-jstl-depsgenerate-resources
@@ -271,6 +377,21 @@
${assembly-directory}/lib/apache-jstl
+
+ copy-apache-jstl-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+ org.glassfish.web
+ taglibs-standard-spec,taglibs-standard-impl
+ true
+ jar
+ sources
+ ${source-assembly-directory}/lib/apache-jstl
+
+ copy-jaspi-depsgenerate-resources
@@ -284,6 +405,20 @@
${assembly-directory}/lib/jaspi
+
+ copy-jaspi-src-deps
+ generate-resources
+
+ copy-dependencies
+
+
+ org.eclipse.jetty.orbit
+ javax.security.auth.message
+ jar
+ sources
+ ${source-assembly-directory}/lib/jaspi
+
+ unpack-config-depsgenerate-resources
@@ -322,18 +457,34 @@
org.apache.maven.pluginsmaven-assembly-plugin
-
- src/main/assembly/jetty-assembly.xml
- posixfalse
+ binarypackagesingle
+
+
+ src/main/assembly/jetty-assembly.xml
+
+
+
+
+ sources
+ package
+
+ single
+
+
+
+ src/main/assembly/jetty-source-assembly.xml
+
+ true
+
diff --git a/jetty-home/src/main/assembly/jetty-assembly.xml b/jetty-home/src/main/assembly/jetty-assembly.xml
index c0198eb679b..c843a8cb11c 100644
--- a/jetty-home/src/main/assembly/jetty-assembly.xml
+++ b/jetty-home/src/main/assembly/jetty-assembly.xml
@@ -1,5 +1,5 @@
- assembly
+ binary-assemblytar.gzzip
diff --git a/jetty-home/src/main/assembly/jetty-source-assembly.xml b/jetty-home/src/main/assembly/jetty-source-assembly.xml
new file mode 100644
index 00000000000..4a230690c07
--- /dev/null
+++ b/jetty-home/src/main/assembly/jetty-source-assembly.xml
@@ -0,0 +1,22 @@
+
+ sources
+
+ tar.gz
+ zip
+
+
+
+ ${source-assembly-directory}
+
+
+ **
+
+
+
+
+
diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpExchange.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpExchange.java
index 567365852d4..802b8b3f604 100644
--- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpExchange.java
+++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpExchange.java
@@ -176,6 +176,7 @@ public class JettyHttpExchange extends HttpExchange implements JettyExchange
}
/* ------------------------------------------------------------ */
+ @Override
public void setPrincipal(HttpPrincipal principal)
{
_delegate.setPrincipal(principal);
diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java
index d7d25ebd7f5..eb5f07eca92 100644
--- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java
+++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java
@@ -67,7 +67,7 @@ public class JettyHttpServerProvider extends HttpServerProvider
JettyHttpServer jettyHttpServer = new JettyHttpServer(server, shared);
if (addr != null)
- jettyHttpServer.bind(addr, backlog);
+ jettyHttpServer.bind(addr, backlog);
return jettyHttpServer;
}
diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpsExchange.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpsExchange.java
index c91d5f81f41..b96dee48d05 100644
--- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpsExchange.java
+++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpsExchange.java
@@ -160,6 +160,7 @@ public class JettyHttpsExchange extends HttpsExchange implements JettyExchange
return _delegate.getPrincipal();
}
+ @Override
public void setPrincipal(HttpPrincipal principal)
{
_delegate.setPrincipal(principal);
diff --git a/jetty-http-spi/src/test/java/org/eclipse/jetty/http/spi/TestSPIServer.java b/jetty-http-spi/src/test/java/org/eclipse/jetty/http/spi/TestSPIServer.java
index 7e4d14e151b..fb27dfe0f2c 100644
--- a/jetty-http-spi/src/test/java/org/eclipse/jetty/http/spi/TestSPIServer.java
+++ b/jetty-http-spi/src/test/java/org/eclipse/jetty/http/spi/TestSPIServer.java
@@ -74,6 +74,7 @@ public class TestSPIServer
new HttpHandler()
{
+ @Override
public void handle(HttpExchange exchange) throws IOException
{
Headers responseHeaders = exchange.getResponseHeaders();
@@ -163,6 +164,7 @@ public class TestSPIServer
new HttpHandler()
{
+ @Override
public void handle(HttpExchange exchange) throws IOException
{
Headers responseHeaders = exchange.getResponseHeaders();
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java
index 17e823e1781..29c446065be 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java
@@ -947,11 +947,13 @@ public class HttpFields implements Iterable
int _cursor; // index of next element to return
int _last=-1;
+ @Override
public boolean hasNext()
{
return _cursor != _size;
}
+ @Override
public HttpField next()
{
int i = _cursor;
@@ -961,6 +963,7 @@ public class HttpFields implements Iterable
return _fields[_last=i];
}
+ @Override
public void remove()
{
if (_last<0)
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java
index 4dfcb15348e..3d3a86c96c6 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java
@@ -719,6 +719,7 @@ public class HttpURI
}
/* ------------------------------------------------------------ */
+ @Override
public boolean equals(Object o)
{
if (o==this)
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/MetaData.java b/jetty-http/src/main/java/org/eclipse/jetty/http/MetaData.java
index 3ea3905dc43..75551f76ede 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/MetaData.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/MetaData.java
@@ -123,6 +123,7 @@ public class MetaData implements Iterable
* @return an iterator over the HTTP fields
* @see #getFields()
*/
+ @Override
public Iterator iterator()
{
HttpFields fields = getFields();
@@ -180,6 +181,7 @@ public class MetaData implements Iterable
this(request.getMethod(),new HttpURI(request.getURI()), request.getHttpVersion(), new HttpFields(request.getFields()), request.getContentLength());
}
+ @Override
public void recycle()
{
super.recycle();
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/QuotedQualityCSV.java b/jetty-http/src/main/java/org/eclipse/jetty/http/QuotedQualityCSV.java
index 6f2adfb85e3..4f9ff72ed6c 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/QuotedQualityCSV.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/QuotedQualityCSV.java
@@ -135,6 +135,7 @@ public class QuotedQualityCSV extends QuotedCSV implements Iterable
}
}
+ @Override
public List getValues()
{
if (!_sorted)
diff --git a/jetty-http2/http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java b/jetty-http2/http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java
index 0a301c13b4d..8d48028f9da 100644
--- a/jetty-http2/http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java
+++ b/jetty-http2/http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java
@@ -39,7 +39,6 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Promise;
import org.eclipse.jetty.util.component.LifeCycle;
-import org.eclipse.jetty.util.thread.ReservedThreadExecutor;
import org.eclipse.jetty.util.thread.Scheduler;
public class HTTP2ClientConnectionFactory implements ClientConnectionFactory
@@ -69,36 +68,19 @@ public class HTTP2ClientConnectionFactory implements ClientConnectionFactory
HTTP2ClientSession session = new HTTP2ClientSession(scheduler, endPoint, generator, listener, flowControl);
Parser parser = new Parser(byteBufferPool, session, 4096, 8192);
- ReservedThreadExecutor reservedExecutor = provideReservedThreadExecutor(client, executor);
-
- HTTP2ClientConnection connection = new HTTP2ClientConnection(client, byteBufferPool, reservedExecutor, endPoint,
+ HTTP2ClientConnection connection = new HTTP2ClientConnection(client, byteBufferPool, executor, endPoint,
parser, session, client.getInputBufferSize(), promise, listener);
connection.addListener(connectionListener);
return customize(connection, context);
}
- protected ReservedThreadExecutor provideReservedThreadExecutor(HTTP2Client client, Executor executor)
- {
- synchronized (this)
- {
- ReservedThreadExecutor reservedExecutor = client.getBean(ReservedThreadExecutor.class);
- if (reservedExecutor == null)
- {
- // TODO: see HTTP2Connection.FillableCallback
- reservedExecutor = new ReservedThreadExecutor(executor, 0);
- client.addManaged(reservedExecutor);
- }
- return reservedExecutor;
- }
- }
-
private class HTTP2ClientConnection extends HTTP2Connection implements Callback
{
private final HTTP2Client client;
private final Promise promise;
private final Session.Listener listener;
- private HTTP2ClientConnection(HTTP2Client client, ByteBufferPool byteBufferPool, ReservedThreadExecutor executor, EndPoint endpoint, Parser parser, ISession session, int bufferSize, Promise promise, Session.Listener listener)
+ private HTTP2ClientConnection(HTTP2Client client, ByteBufferPool byteBufferPool, Executor executor, EndPoint endpoint, Parser parser, ISession session, int bufferSize, Promise promise, Session.Listener listener)
{
super(byteBufferPool, executor, endpoint, parser, session, bufferSize);
this.client = client;
diff --git a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/HTTP2Test.java b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/HTTP2Test.java
index b9765b747e7..39a90b9386a 100644
--- a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/HTTP2Test.java
+++ b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/HTTP2Test.java
@@ -46,7 +46,16 @@ import org.eclipse.jetty.http2.api.server.ServerSessionListener;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.GoAwayFrame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
+import org.eclipse.jetty.http2.frames.PingFrame;
+import org.eclipse.jetty.http2.frames.PriorityFrame;
+import org.eclipse.jetty.http2.frames.PushPromiseFrame;
+import org.eclipse.jetty.http2.frames.ResetFrame;
import org.eclipse.jetty.http2.frames.SettingsFrame;
+import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
+import org.eclipse.jetty.http2.parser.ServerParser;
+import org.eclipse.jetty.http2.server.RawHTTP2ServerConnectionFactory;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FuturePromise;
@@ -678,6 +687,70 @@ public class HTTP2Test extends AbstractTest
Assert.assertFalse(failureLatch.await(1, TimeUnit.SECONDS));
}
+ @Test
+ public void testGoAwayRespondedWithGoAway() throws Exception
+ {
+ ServerSessionListener.Adapter serverListener = new ServerSessionListener.Adapter()
+ {
+ @Override
+ public Stream.Listener onNewStream(Stream stream, HeadersFrame frame)
+ {
+ MetaData.Response metaData = new MetaData.Response(HttpVersion.HTTP_2, HttpStatus.OK_200, new HttpFields());
+ HeadersFrame response = new HeadersFrame(stream.getId(), metaData, null, true);
+ stream.headers(response, Callback.NOOP);
+ stream.getSession().close(ErrorCode.NO_ERROR.code, null, Callback.NOOP);
+ return null;
+ }
+ };
+ CountDownLatch goAwayLatch = new CountDownLatch(1);
+ RawHTTP2ServerConnectionFactory connectionFactory = new RawHTTP2ServerConnectionFactory(new HttpConfiguration(), serverListener)
+ {
+ @Override
+ protected ServerParser newServerParser(Connector connector, ServerParser.Listener listener)
+ {
+ return super.newServerParser(connector, new ServerParserListenerWrapper(listener)
+ {
+ @Override
+ public void onGoAway(GoAwayFrame frame)
+ {
+ super.onGoAway(frame);
+ goAwayLatch.countDown();
+ }
+ });
+ }
+ };
+ prepareServer(connectionFactory);
+ server.start();
+
+ prepareClient();
+ client.start();
+
+ CountDownLatch closeLatch = new CountDownLatch(1);
+ Session session = newClient(new Session.Listener.Adapter()
+ {
+ @Override
+ public void onClose(Session session, GoAwayFrame frame)
+ {
+ closeLatch.countDown();
+ }
+ });
+ MetaData.Request metaData = newRequest("GET", new HttpFields());
+ HeadersFrame request = new HeadersFrame(metaData, null, true);
+ CountDownLatch responseLatch = new CountDownLatch(1);
+ session.newStream(request, new Promise.Adapter<>(), new Stream.Listener.Adapter()
+ {
+ @Override
+ public void onHeaders(Stream stream, HeadersFrame frame)
+ {
+ responseLatch.countDown();
+ }
+ });
+
+ Assert.assertTrue(responseLatch.await(5, TimeUnit.SECONDS));
+ Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS));
+ Assert.assertTrue(goAwayLatch.await(5, TimeUnit.SECONDS));
+ }
+
private static void sleep(long time)
{
try
@@ -689,4 +762,80 @@ public class HTTP2Test extends AbstractTest
throw new RuntimeException();
}
}
+
+ private static class ServerParserListenerWrapper implements ServerParser.Listener
+ {
+ private final ServerParser.Listener listener;
+
+ private ServerParserListenerWrapper(ServerParser.Listener listener)
+ {
+ this.listener = listener;
+ }
+
+ @Override
+ public void onPreface()
+ {
+ listener.onPreface();
+ }
+
+ @Override
+ public void onData(DataFrame frame)
+ {
+ listener.onData(frame);
+ }
+
+ @Override
+ public void onHeaders(HeadersFrame frame)
+ {
+ listener.onHeaders(frame);
+ }
+
+ @Override
+ public void onPriority(PriorityFrame frame)
+ {
+ listener.onPriority(frame);
+ }
+
+ @Override
+ public void onReset(ResetFrame frame)
+ {
+ listener.onReset(frame);
+ }
+
+ @Override
+ public void onSettings(SettingsFrame frame)
+ {
+ listener.onSettings(frame);
+ }
+
+ @Override
+ public void onPushPromise(PushPromiseFrame frame)
+ {
+ listener.onPushPromise(frame);
+ }
+
+ @Override
+ public void onPing(PingFrame frame)
+ {
+ listener.onPing(frame);
+ }
+
+ @Override
+ public void onGoAway(GoAwayFrame frame)
+ {
+ listener.onGoAway(frame);
+ }
+
+ @Override
+ public void onWindowUpdate(WindowUpdateFrame frame)
+ {
+ listener.onWindowUpdate(frame);
+ }
+
+ @Override
+ public void onConnectionFailure(int error, String reason)
+ {
+ listener.onConnectionFailure(error, reason);
+ }
+ }
}
diff --git a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/IdleTimeoutTest.java b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/IdleTimeoutTest.java
index a8ea5ba8210..8c7c966ac44 100644
--- a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/IdleTimeoutTest.java
+++ b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/IdleTimeoutTest.java
@@ -603,7 +603,7 @@ public class IdleTimeoutTest extends AbstractTest
{
long idleTimeout = 2000;
// Use a small thread pool to cause request queueing.
- QueuedThreadPool serverExecutor = new QueuedThreadPool(4);
+ QueuedThreadPool serverExecutor = new QueuedThreadPool(5);
serverExecutor.setName("server");
server = new Server(serverExecutor);
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(new HttpConfiguration());
diff --git a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/StreamResetTest.java b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/StreamResetTest.java
index c8a36ed580b..bea64c1946d 100644
--- a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/StreamResetTest.java
+++ b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/StreamResetTest.java
@@ -262,7 +262,7 @@ public class StreamResetTest extends AbstractTest
try
{
// Wait for the reset to happen.
- Assert.assertTrue(resetLatch.await(5, TimeUnit.SECONDS));
+ Assert.assertTrue(resetLatch.await(10, TimeUnit.SECONDS));
}
catch (InterruptedException x)
{
@@ -273,9 +273,9 @@ public class StreamResetTest extends AbstractTest
{
// Write some content after the stream has
// been reset, it should throw an exception.
- for (int i = 0; i < 10; i++)
+ for (int i = 0; i < 100; i++)
{
- Thread.sleep(500);
+ Thread.sleep(100);
response.getOutputStream().write(data);
response.flushBuffer();
}
@@ -304,7 +304,7 @@ public class StreamResetTest extends AbstractTest
}
});
- Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
+ Assert.assertTrue(dataLatch.await(10, TimeUnit.SECONDS));
}
@Test
@@ -425,7 +425,7 @@ public class StreamResetTest extends AbstractTest
public void testClientResetConsumesQueuedRequestWithData() throws Exception
{
// Use a small thread pool.
- QueuedThreadPool serverExecutor = new QueuedThreadPool(4);
+ QueuedThreadPool serverExecutor = new QueuedThreadPool(5);
serverExecutor.setName("server");
serverExecutor.setDetailedDump(true);
server = new Server(serverExecutor);
diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java
index 6375f01ebd8..51f201d71aa 100644
--- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java
+++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayDeque;
import java.util.Queue;
+import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jetty.http2.parser.Parser;
@@ -35,13 +36,16 @@ import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.ExecutionStrategy;
-import org.eclipse.jetty.util.thread.ReservedThreadExecutor;
+import org.eclipse.jetty.util.thread.TryExecutor;
import org.eclipse.jetty.util.thread.strategy.EatWhatYouKill;
public class HTTP2Connection extends AbstractConnection implements WriteFlusher.Listener
{
protected static final Logger LOG = Log.getLogger(HTTP2Connection.class);
-
+
+ // TODO remove this once we are sure EWYK is OK for http2
+ private static final boolean PEC_MODE = Boolean.getBoolean("org.eclipse.jetty.http2.PEC_MODE");
+
private final Queue tasks = new ArrayDeque<>();
private final HTTP2Producer producer = new HTTP2Producer();
private final AtomicLong bytesIn = new AtomicLong();
@@ -51,14 +55,16 @@ public class HTTP2Connection extends AbstractConnection implements WriteFlusher.
private final int bufferSize;
private final ExecutionStrategy strategy;
- public HTTP2Connection(ByteBufferPool byteBufferPool, ReservedThreadExecutor executor, EndPoint endPoint, Parser parser, ISession session, int bufferSize)
+ public HTTP2Connection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, Parser parser, ISession session, int bufferSize)
{
- super(endPoint, executor.getExecutor());
+ super(endPoint, executor);
this.byteBufferPool = byteBufferPool;
this.parser = parser;
this.session = session;
this.bufferSize = bufferSize;
- this.strategy = new EatWhatYouKill(producer, executor.getExecutor(), executor);
+ if (PEC_MODE)
+ executor = new TryExecutor.NoTryExecutor(executor);
+ this.strategy = new EatWhatYouKill(producer, executor);
LifeCycle.start(strategy);
}
@@ -281,9 +287,7 @@ public class HTTP2Connection extends AbstractConnection implements WriteFlusher.
@Override
public InvocationType getInvocationType()
{
- // TODO: see also AbstractHTTP2ServerConnectionFactory.reservedThreads.
- // TODO: it's non blocking here because reservedThreads=0.
- return InvocationType.NON_BLOCKING;
+ return InvocationType.EITHER;
}
}
}
diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java
index add1fdb84d3..4dd88c5f35e 100644
--- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java
+++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java
@@ -24,7 +24,6 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -404,7 +403,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
*
NOT_CLOSED: we move to REMOTELY_CLOSED and queue a disconnect, so
* that the content of the queue is written, and then the connection
* closed. We notify the application after being terminated.
- * See HTTP2Session.ControlEntry#succeeded()
+ * See {@code HTTP2Session.ControlEntry#succeeded()}
*
In all other cases, we do nothing since other methods are already
* performing their actions.
*
@@ -598,14 +597,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
{
if (closed.compareAndSet(current, CloseState.LOCALLY_CLOSED))
{
- byte[] payload = null;
- if (reason != null)
- {
- // Trim the reason to avoid attack vectors.
- reason = reason.substring(0, Math.min(reason.length(), 32));
- payload = reason.getBytes(StandardCharsets.UTF_8);
- }
- GoAwayFrame frame = new GoAwayFrame(lastStreamId.get(), error, payload);
+ GoAwayFrame frame = newGoAwayFrame(error, reason);
control(null, callback, frame);
return true;
}
@@ -622,6 +614,18 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
}
}
+ private GoAwayFrame newGoAwayFrame(int error, String reason)
+ {
+ byte[] payload = null;
+ if (reason != null)
+ {
+ // Trim the reason to avoid attack vectors.
+ reason = reason.substring(0, Math.min(reason.length(), 32));
+ payload = reason.getBytes(StandardCharsets.UTF_8);
+ }
+ return new GoAwayFrame(lastStreamId.get(), error, payload);
+ }
+
@Override
public boolean isClosed()
{
@@ -771,9 +775,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
@Override
public Collection getStreams()
{
- List result = new ArrayList<>();
- result.addAll(streams.values());
- return result;
+ return new ArrayList<>(streams.values());
}
@ManagedAttribute("The number of active streams")
@@ -1156,6 +1158,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
frameBytes -= bytesFlushed;
}
+ @Override
protected boolean generate(ByteBufferPool.Lease lease)
{
bytes = frameBytes = generator.control(lease, frame);
@@ -1251,6 +1254,14 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
}
super.succeeded();
}
+
+ @Override
+ public void failed(Throwable x)
+ {
+ if (frame.getType() == FrameType.DISCONNECT)
+ terminate(new ClosedChannelException());
+ super.failed(x);
+ }
}
private class DataEntry extends HTTP2Flusher.Entry
@@ -1289,6 +1300,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
return dataBytes;
}
+ @Override
protected boolean generate(ByteBufferPool.Lease lease)
{
int dataBytes = getDataBytesRemaining();
@@ -1441,7 +1453,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
private void complete()
{
- control(null, Callback.NOOP, new DisconnectFrame());
+ frames(null, Callback.NOOP, newGoAwayFrame(ErrorCode.NO_ERROR.code, null), new DisconnectFrame());
}
}
diff --git a/jetty-http2/http2-common/src/test/java/org/eclipse/jetty/http2/api/UsageTest.java b/jetty-http2/http2-common/src/test/java/org/eclipse/jetty/http2/api/UsageTest.java
deleted file mode 100644
index 9c113194d85..00000000000
--- a/jetty-http2/http2-common/src/test/java/org/eclipse/jetty/http2/api/UsageTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2018 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.http2.api;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class UsageTest
-{
- @Ignore
- @Test
- public void test() throws Exception
- {
-// HTTP2Client client = new HTTP2Client();
-// client.connect("localhost", 8080, new Promise.Adapter()
-// {
-// @Override
-// public void succeeded(Session session)
-// {
-// session.newStream(new HeadersFrame(info, null, true), new Stream.Listener.Adapter()
-// {
-// @Override
-// public void onData(Stream stream, DataFrame frame)
-// {
-// System.out.println("received frame = " + frame);
-// }
-// }, new Adapter()
-// {
-// @Override
-// public void succeeded(Stream stream)
-// {
-// DataFrame frame = new DataFrame(stream.getId(), ByteBuffer.wrap("HELLO".getBytes(StandardCharsets.UTF_8)), true);
-// stream.data(frame, new Callback.Adapter());
-// }
-// });
-// }
-// });
-
- // KINDA CALLBACK HELL ABOVE.
- // BELOW USING COMPLETABLES:
-
-// client.connect("localhost", 8080).then(session -> session.newStream(...)).then(stream -> stream.data(...));
- }
-}
diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java
index ddcfc8f67ba..516dbcb9234 100644
--- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java
+++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java
@@ -430,6 +430,7 @@ public class HpackContext
return null;
}
+ @Override
public String toString()
{
return String.format("{%s,%d,%s,%x}",isStatic()?"S":"D",_slot,_field,hashCode());
diff --git a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java
index 5eed59ae8f9..31c1ee21d8f 100644
--- a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java
+++ b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.http2.hpack;
import java.nio.ByteBuffer;
+import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.http.BadMessageException;
import org.eclipse.jetty.http.DateGenerator;
@@ -42,7 +43,7 @@ public class HpackTest
{
final static HttpField ServerJetty = new PreEncodedHttpField(HttpHeader.SERVER,"jetty");
final static HttpField XPowerJetty = new PreEncodedHttpField(HttpHeader.X_POWERED_BY,"jetty");
- final static HttpField Date = new PreEncodedHttpField(HttpHeader.DATE,DateGenerator.formatDate(System.currentTimeMillis()));
+ final static HttpField Date = new PreEncodedHttpField(HttpHeader.DATE,DateGenerator.formatDate(TimeUnit.NANOSECONDS.toMillis(System.nanoTime())));
@Test
public void encodeDecodeResponseTest()
diff --git a/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml b/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml
index 73f3e912641..3d1b92e054b 100644
--- a/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml
+++ b/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml
@@ -12,7 +12,6 @@
-
diff --git a/jetty-http2/http2-server/src/main/config/modules/http2.mod b/jetty-http2/http2-server/src/main/config/modules/http2.mod
index 2ffa068ede6..e5def621a6a 100644
--- a/jetty-http2/http2-server/src/main/config/modules/http2.mod
+++ b/jetty-http2/http2-server/src/main/config/modules/http2.mod
@@ -27,7 +27,3 @@ etc/jetty-http2.xml
## Initial session receive window (client to server)
# jetty.http2.initialSessionRecvWindow=1048576
-
-## Reserve threads for high priority tasks (-1 use number of Selectors, 0 no reserved threads)
-# jetty.http2.reservedThreads=-1
-
diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
index a42d5ccd399..b85b3962c3f 100644
--- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
+++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
@@ -35,7 +35,6 @@ import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.component.LifeCycle;
-import org.eclipse.jetty.util.thread.ReservedThreadExecutor;
@ManagedObject
public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConnectionFactory
@@ -49,7 +48,6 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
private int maxHeaderBlockFragment = 0;
private FlowControlStrategy.Factory flowControlStrategyFactory = () -> new BufferingFlowControlStrategy(0.5F);
private long streamIdleTimeout;
- private int reservedThreads;
public AbstractHTTP2ServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration)
{
@@ -143,20 +141,24 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
}
/**
- * @see ReservedThreadExecutor
- * @return The number of reserved threads
+ * @return -1
+ * @deprecated feature removed, no replacement
*/
- @ManagedAttribute("The number of threads reserved for high priority tasks")
+ @Deprecated
public int getReservedThreads()
{
- return reservedThreads;
+ return -1;
}
+ /**
+ * @param threads ignored
+ * @deprecated feature removed, no replacement
+ * @throws UnsupportedOperationException when invoked
+ */
+ @Deprecated
public void setReservedThreads(int threads)
{
- // TODO: see also HTTP2Connection.FillableCallback.
- // TODO: currently disabled since the only value that works is 0.
-// this.reservedThreads = threads;
+ throw new UnsupportedOperationException();
}
public HttpConfiguration getHttpConfiguration()
@@ -183,30 +185,14 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
streamIdleTimeout = endPoint.getIdleTimeout();
session.setStreamIdleTimeout(streamIdleTimeout);
session.setInitialSessionRecvWindow(getInitialSessionRecvWindow());
-
- ReservedThreadExecutor executor = provideReservedThreadExecutor(connector);
ServerParser parser = newServerParser(connector, session);
- HTTP2Connection connection = new HTTP2ServerConnection(connector.getByteBufferPool(), executor,
+ HTTP2Connection connection = new HTTP2ServerConnection(connector.getByteBufferPool(), connector.getExecutor(),
endPoint, httpConfiguration, parser, session, getInputBufferSize(), listener);
connection.addListener(connectionListener);
return configure(connection, connector, endPoint);
}
- protected ReservedThreadExecutor provideReservedThreadExecutor(Connector connector)
- {
- synchronized (this)
- {
- ReservedThreadExecutor executor = getBean(ReservedThreadExecutor.class);
- if (executor == null)
- {
- executor = new ReservedThreadExecutor(connector.getExecutor(), getReservedThreads());
- addManaged(executor);
- }
- return executor;
- }
- }
-
protected abstract ServerSessionListener newSessionListener(Connector connector, EndPoint endPoint);
protected ServerParser newServerParser(Connector connector, ServerParser.Listener listener)
diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java
index cef4a34498b..fb18d564a72 100644
--- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java
+++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Queue;
+import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jetty.http.BadMessageException;
@@ -58,7 +59,6 @@ import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.CountingCallback;
import org.eclipse.jetty.util.TypeUtil;
-import org.eclipse.jetty.util.thread.ReservedThreadExecutor;
public class HTTP2ServerConnection extends HTTP2Connection implements Connection.UpgradeTo
{
@@ -94,7 +94,7 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection
private final HttpConfiguration httpConfig;
private boolean recycleHttpChannels;
- public HTTP2ServerConnection(ByteBufferPool byteBufferPool, ReservedThreadExecutor executor, EndPoint endPoint, HttpConfiguration httpConfig, ServerParser parser, ISession session, int inputBufferSize, ServerSessionListener listener)
+ public HTTP2ServerConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, HttpConfiguration httpConfig, ServerParser parser, ISession session, int inputBufferSize, ServerSessionListener listener)
{
super(byteBufferPool, executor, endPoint, parser, session, inputBufferSize);
this.listener = listener;
diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpChannelOverHTTP2.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpChannelOverHTTP2.java
index 7cb2e6771af..007976d24b6 100644
--- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpChannelOverHTTP2.java
+++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpChannelOverHTTP2.java
@@ -393,10 +393,8 @@ public class HttpChannelOverHTTP2 extends HttpChannel implements Closeable, Writ
public String toString()
{
IStream stream = getStream();
- long streamId = -1;
- if (stream != null)
- streamId = stream.getId();
- return String.format("%s#%d", super.toString(), getStream() == null ? -1 : streamId);
+ long streamId = stream == null ? -1 : stream.getId();
+ return String.format("%s#%d", super.toString(), streamId);
}
private class FailureTask implements Runnable
diff --git a/jetty-infinispan/src/main/java/org/eclipse/jetty/session/infinispan/InfinispanSessionDataStore.java b/jetty-infinispan/src/main/java/org/eclipse/jetty/session/infinispan/InfinispanSessionDataStore.java
index bf11861aa2e..a752e781c22 100644
--- a/jetty-infinispan/src/main/java/org/eclipse/jetty/session/infinispan/InfinispanSessionDataStore.java
+++ b/jetty-infinispan/src/main/java/org/eclipse/jetty/session/infinispan/InfinispanSessionDataStore.java
@@ -89,6 +89,7 @@ public class InfinispanSessionDataStore extends AbstractSessionDataStore
Runnable load = new Runnable()
{
+ @Override
public void run ()
{
try
@@ -269,6 +270,7 @@ public class InfinispanSessionDataStore extends AbstractSessionDataStore
Runnable load = new Runnable()
{
+ @Override
public void run ()
{
try
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteArrayEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteArrayEndPoint.java
index 583cd939173..409da35e8e4 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteArrayEndPoint.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteArrayEndPoint.java
@@ -341,7 +341,8 @@ public class ByteArrayEndPoint extends AbstractEndPoint
{
while (BufferUtil.isEmpty(_out) && !isOutputShutdown())
{
- _hasOutput.await(time,unit);
+ if (!_hasOutput.await(time,unit))
+ return null;
}
b=_out;
_out=BufferUtil.allocate(b.capacity());
@@ -493,6 +494,7 @@ public class ByteArrayEndPoint extends AbstractEndPoint
/**
*
*/
+ @Override
public void reset()
{
try(Locker.Lock lock = _locker.lock())
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/CyclicTimeout.java b/jetty-io/src/main/java/org/eclipse/jetty/io/CyclicTimeout.java
index 9df3d823e80..7eca7e18722 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/CyclicTimeout.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/CyclicTimeout.java
@@ -137,6 +137,7 @@ public abstract class CyclicTimeout implements Destroyable
*
Destroys this CyclicTimeout.
*
After being destroyed, this CyclicTimeout is not used anymore.
*/
+ @Override
public void destroy()
{
Timeout timeout = _timeout.getAndSet(NOT_SET);
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/LeakTrackingByteBufferPool.java b/jetty-io/src/main/java/org/eclipse/jetty/io/LeakTrackingByteBufferPool.java
index 1abfbd33124..1d8f150d0e2 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/LeakTrackingByteBufferPool.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/LeakTrackingByteBufferPool.java
@@ -33,6 +33,7 @@ public class LeakTrackingByteBufferPool extends ContainerLifeCycle implements By
private final LeakDetector leakDetector = new LeakDetector()
{
+ @Override
public String id(ByteBuffer resource)
{
return BufferUtil.toIDString(resource);
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ManagedSelector.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ManagedSelector.java
index c4fa8f42ad5..90adb5c7873 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/ManagedSelector.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ManagedSelector.java
@@ -48,7 +48,6 @@ import org.eclipse.jetty.util.component.DumpableCollection;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.ExecutionStrategy;
-import org.eclipse.jetty.util.thread.ReservedThreadExecutor;
import org.eclipse.jetty.util.thread.Scheduler;
import org.eclipse.jetty.util.thread.strategy.EatWhatYouKill;
@@ -77,7 +76,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
_id = id;
SelectorProducer producer = new SelectorProducer();
Executor executor = selectorManager.getExecutor();
- _strategy = new EatWhatYouKill(producer,executor,_selectorManager.getBean(ReservedThreadExecutor.class));
+ _strategy = new EatWhatYouKill(producer,executor);
addBean(_strategy,true);
setStopTimeout(5000);
}
@@ -136,17 +135,17 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
/**
* Submit an {@link SelectorUpdate} to be acted on between calls to {@link Selector#select()}
- * @param action
+ * @param update The selector update to apply at next wakeup
*/
- public void submit(SelectorUpdate action)
+ public void submit(SelectorUpdate update)
{
if (LOG.isDebugEnabled())
- LOG.debug("Queued change {} on {}", action, this);
+ LOG.debug("Queued change {} on {}", update, this);
Selector selector = null;
synchronized(ManagedSelector.this)
{
- _updates.offer(action);
+ _updates.offer(update);
if (_selecting)
{
@@ -265,15 +264,15 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
{
Selector selector = _selector;
List keys = null;
- List actions = null;
+ List updates = null;
if (selector != null && selector.isOpen())
{
DumpKeys dump = new DumpKeys();
- String actionsAt;
+ String updatesAt;
synchronized(ManagedSelector.this)
{
- actionsAt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now());
- actions = new ArrayList<>(_updates);
+ updatesAt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now());
+ updates = new ArrayList<>(_updates);
_updates.addFirst(dump);
_selecting = false;
}
@@ -282,7 +281,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
String keysAt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now());
if (keys==null)
keys = Collections.singletonList("No dump keys retrieved");
- dumpBeans(out, indent, Arrays.asList(new DumpableCollection("actions @ "+actionsAt, actions),
+ dumpBeans(out, indent, Arrays.asList(new DumpableCollection("updates @ "+updatesAt, updates),
new DumpableCollection("keys @ "+keysAt, keys)));
}
else
@@ -295,7 +294,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
public String toString()
{
Selector selector = _selector;
- return String.format("%s id=%s keys=%d selected=%d actions=%d",
+ return String.format("%s id=%s keys=%d selected=%d updates=%d",
super.toString(),
_id,
selector != null && selector.isOpen() ? selector.keys().size() : -1,
@@ -377,16 +376,16 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
_updateable.clear();
Selector selector;
- int actions;
+ int updates;
synchronized(ManagedSelector.this)
{
- actions = _updates.size();
- _selecting = actions==0;
+ updates = _updates.size();
+ _selecting = updates==0;
selector = _selecting?null:_selector;
}
if (LOG.isDebugEnabled())
- LOG.debug("actions {}",actions);
+ LOG.debug("updates {}",updates);
if (selector != null)
selector.wakeup();
@@ -405,18 +404,18 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
if (LOG.isDebugEnabled())
LOG.debug("Selector {} woken up from select, {}/{} selected", selector, selected, selector.keys().size());
- int actions;
+ int updates;
synchronized(ManagedSelector.this)
{
// finished selecting
_selecting = false;
- actions = _updates.size();
+ updates = _updates.size();
}
_keys = selector.selectedKeys();
_cursor = _keys.iterator();
if (LOG.isDebugEnabled())
- LOG.debug("Selector {} processing {} keys, {} actions", selector, _keys.size(), actions);
+ LOG.debug("Selector {} processing {} keys, {} updates", selector, _keys.size(), updates);
return true;
}
@@ -424,6 +423,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
catch (Throwable x)
{
closeNoExceptions(_selector);
+ _selector = null;
if (isRunning())
LOG.warn(x);
else
@@ -441,7 +441,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
{
Object attachment = key.attachment();
if (LOG.isDebugEnabled())
- LOG.debug("selected {} {} ",key,attachment);
+ LOG.debug("selected {} {} {} ",key.readyOps(),key,attachment);
try
{
if (attachment instanceof Selectable)
@@ -489,19 +489,16 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
{
// Do update keys for only previously selected keys.
// This will update only those keys whose selection did not cause an
- // updateKeys action to be submitted.
+ // updateKeys update to be submitted.
for (SelectionKey key : _keys)
- updateKey(key);
+ {
+ Object attachment = key.attachment();
+ if (attachment instanceof Selectable)
+ ((Selectable)attachment).updateKey();
+ }
_keys.clear();
}
- private void updateKey(SelectionKey key)
- {
- Object attachment = key.attachment();
- if (attachment instanceof Selectable)
- ((Selectable)attachment).updateKey();
- }
-
@Override
public String toString()
{
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/NetworkTrafficListener.java b/jetty-io/src/main/java/org/eclipse/jetty/io/NetworkTrafficListener.java
index 651f1aeceed..be902761551 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/NetworkTrafficListener.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/NetworkTrafficListener.java
@@ -81,18 +81,22 @@ public interface NetworkTrafficListener
*/
public static class Adapter implements NetworkTrafficListener
{
+ @Override
public void opened(Socket socket)
{
}
+ @Override
public void incoming(Socket socket, ByteBuffer bytes)
{
}
+ @Override
public void outgoing(Socket socket, ByteBuffer bytes)
{
}
+ @Override
public void closed(Socket socket)
{
}
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java
index 627d9ac2368..4717da83364 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java
@@ -20,7 +20,6 @@ package org.eclipse.jetty.io;
import java.io.Closeable;
import java.io.IOException;
-import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.nio.channels.SelectableChannel;
@@ -30,6 +29,8 @@ import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Arrays;
import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.IntUnaryOperator;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
@@ -37,11 +38,9 @@ import org.eclipse.jetty.util.component.ContainerLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
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.ThreadPoolBudget;
-import org.eclipse.jetty.util.thread.strategy.EatWhatYouKill;
/**
*
Unlike {@link #decode(char[])}, extra whitespace is ignored.
* @param encoded String to decode.
* @param charEncoding String representing the character encoding
- * used to map the decoded bytes into a String.
+ * used to map the decoded bytes into a String. If null
+ * the platforms default charset is used.
* @return String decoded byte array.
* @throws UnsupportedCharsetException if the encoding is not supported
* @throws IllegalArgumentException if the input is not a valid
* B64 encoding.
*/
+ @SuppressWarnings("DefaultCharset")
public static String decode(String encoded,String charEncoding)
{
byte[] decoded=decode(encoded);
@@ -274,11 +276,13 @@ public class B64Code
*
Unlike {@link #decode(char[])}, extra whitespace is ignored.
* @param encoded String to decode.
* @param charEncoding Character encoding
- * used to map the decoded bytes into a String.
+ * used to map the decoded bytes into a String. If null
+ * the platforms default charset is used.
* @return String decoded byte array.
* @throws IllegalArgumentException if the input is not a valid
* B64 encoding.
*/
+ @SuppressWarnings("DefaultCharset")
public static String decode(String encoded, Charset charEncoding)
{
byte[] decoded=decode(encoded);
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java b/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java
index 37690444674..13c4370f1d9 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java
@@ -85,6 +85,7 @@ public class IO
/*
* @see java.lang.Runnable#run()
*/
+ @Override
public void run()
{
try {
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/InetAddressSet.java b/jetty-util/src/main/java/org/eclipse/jetty/util/InetAddressSet.java
index 367a48c2171..b7ed17ec16c 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/InetAddressSet.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/InetAddressSet.java
@@ -145,6 +145,7 @@ public class InetAddressSet extends AbstractSet implements Set,
_address=address;
}
+ @Override
public boolean test(InetAddress address, byte[] raw)
{
return _address.equals(address);
@@ -195,6 +196,7 @@ public class InetAddressSet extends AbstractSet implements Set,
}
}
+ @Override
public boolean test(InetAddress item, byte[] raw)
{
if (raw.length!=_min.length)
@@ -256,6 +258,7 @@ public class InetAddressSet extends AbstractSet implements Set,
throw new IllegalArgumentException("CIDR bits non zero: "+pattern);
}
+ @Override
public boolean test(InetAddress item, byte[] raw)
{
if (raw.length!=_raw.length)
@@ -301,6 +304,7 @@ public class InetAddressSet extends AbstractSet implements Set,
}
}
+ @Override
public boolean test(InetAddress item, byte[] raw)
{
if (raw.length!=4)
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/JavaVersion.java b/jetty-util/src/main/java/org/eclipse/jetty/util/JavaVersion.java
index dde70e12578..ae9201906c3 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/JavaVersion.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/JavaVersion.java
@@ -38,7 +38,7 @@ public class JavaVersion
private static final String UPDATE = "(?:(?_)(?[0-9]+))?";
private static final String PRE = "(?:-(?
[a-zA-Z0-9]+))?";
private static final String BUILD = "(?:(?\\+)(?[0-9]+))?";
- private static final String OPT = "(?:-(?[-a-zA-Z0-9.]+))?";
+ private static final String OPT = "(?:-(?[-a-zA-Z0-9.~]+))?";
private static final String VSTR_FORMAT = VNUM + UPDATE + PRE + BUILD + OPT;
@@ -214,6 +214,7 @@ public class JavaVersion
return suffix;
}
+ @Override
public String toString()
{
return version;
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStreamParser.java b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStreamParser.java
index 5e2a7f6ebaa..a7455e4e698 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStreamParser.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStreamParser.java
@@ -190,6 +190,7 @@ public class MultiPartInputStreamParser
/**
* @see javax.servlet.http.Part#getContentType()
*/
+ @Override
public String getContentType()
{
return _contentType;
@@ -198,6 +199,7 @@ public class MultiPartInputStreamParser
/**
* @see javax.servlet.http.Part#getHeader(java.lang.String)
*/
+ @Override
public String getHeader(String name)
{
if (name == null)
@@ -208,6 +210,7 @@ public class MultiPartInputStreamParser
/**
* @see javax.servlet.http.Part#getHeaderNames()
*/
+ @Override
public Collection getHeaderNames()
{
return _headers.keySet();
@@ -216,6 +219,7 @@ public class MultiPartInputStreamParser
/**
* @see javax.servlet.http.Part#getHeaders(java.lang.String)
*/
+ @Override
public Collection getHeaders(String name)
{
return _headers.getValues(name);
@@ -224,6 +228,7 @@ public class MultiPartInputStreamParser
/**
* @see javax.servlet.http.Part#getInputStream()
*/
+ @Override
public InputStream getInputStream() throws IOException
{
if (_file != null)
@@ -258,6 +263,7 @@ public class MultiPartInputStreamParser
/**
* @see javax.servlet.http.Part#getName()
*/
+ @Override
public String getName()
{
return _name;
@@ -266,6 +272,7 @@ public class MultiPartInputStreamParser
/**
* @see javax.servlet.http.Part#getSize()
*/
+ @Override
public long getSize()
{
return _size;
@@ -274,6 +281,7 @@ public class MultiPartInputStreamParser
/**
* @see javax.servlet.http.Part#write(java.lang.String)
*/
+ @Override
public void write(String fileName) throws IOException
{
if (_file == null)
@@ -314,6 +322,7 @@ public class MultiPartInputStreamParser
* (ie no longer temporary)
* @see javax.servlet.http.Part#delete()
*/
+ @Override
public void delete() throws IOException
{
if (_file != null && _file.exists())
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/PathWatcher.java b/jetty-util/src/main/java/org/eclipse/jetty/util/PathWatcher.java
index 30114e4d5db..57ba31a30cc 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/PathWatcher.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/PathWatcher.java
@@ -50,6 +50,7 @@ import java.util.Scanner;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
+import java.util.stream.Stream;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
@@ -332,6 +333,7 @@ public class PathWatcher extends AbstractLifeCycle implements Runnable
return path;
}
+ @Override
public boolean test(Path path)
{
if (excludeHidden && isHidden(path))
@@ -1029,35 +1031,36 @@ public class PathWatcher extends AbstractLifeCycle implements Runnable
register(dir,config);
final MultiException me = new MultiException();
- Files.list(dir).forEach(p->
+ try (Stream stream = Files.list( dir))
{
- if (LOG.isDebugEnabled())
- LOG.debug("registerTree? {}",p);
+ stream.forEach( p -> {
+ if ( LOG.isDebugEnabled() )
+ LOG.debug( "registerTree? {}", p );
- try
- {
- if (notify && config.test(p))
- pending.put(p,new PathWatchEvent(p,PathWatchEventType.ADDED,config));
-
- switch(config.handleDir(p))
+ try
{
- case ENTER:
- registerTree(p,config.asSubConfig(p),notify);
- break;
- case WATCH:
- registerDir(p,config);
- break;
- case IGNORE:
- default:
- break;
+ if ( notify && config.test( p ) )
+ pending.put( p, new PathWatchEvent( p, PathWatchEventType.ADDED, config ) );
+
+ switch ( config.handleDir( p ) )
+ {
+ case ENTER:
+ registerTree( p, config.asSubConfig( p ), notify );
+ break;
+ case WATCH:
+ registerDir( p, config );
+ break;
+ case IGNORE:
+ default:
+ break;
+ }
}
- }
- catch(IOException e)
- {
- me.add(e);
- }
- });
-
+ catch ( IOException e )
+ {
+ me.add( e );
+ }
+ } );
+ }
try
{
me.ifExceptionThrow();
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java
index ebe64968afa..aba6e34b229 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
@@ -277,15 +278,17 @@ public class RolloverFileOutputStream extends OutputStream
oldFile = _file;
_file=file;
newFile = _file;
+
+ OutputStream oldOut=_out;
+ if (oldOut!=null)
+ oldOut.close();
+
if (!_append && file.exists())
{
backupFile = new File(file.toString()+"."+_fileBackupFormat.format(new Date(now.toInstant().toEpochMilli())));
- file.renameTo(backupFile);
+ renameFile(file, backupFile);
}
- OutputStream oldOut=_out;
_out=new FileOutputStream(file.toString(),_append);
- if (oldOut!=null)
- oldOut.close();
//if(log.isDebugEnabled())log.debug("Opened "+_file);
}
}
@@ -294,6 +297,26 @@ public class RolloverFileOutputStream extends OutputStream
rollover(oldFile,backupFile,newFile);
}
+ private void renameFile(File src, File dest) throws IOException
+ {
+ // Try old school rename
+ if(!src.renameTo(dest))
+ {
+ try
+ {
+ // Try new move
+ Files.move(src.toPath(), dest.toPath());
+ }
+ catch(IOException e)
+ {
+ // Copy
+ Files.copy(src.toPath(), dest.toPath());
+ // Delete
+ Files.deleteIfExists(src.toPath());
+ }
+ }
+ }
+
/* ------------------------------------------------------------ */
/** This method is called whenever a log file is rolled over
* @param oldFile The original filename or null if this is the first creation
@@ -338,6 +361,7 @@ public class RolloverFileOutputStream extends OutputStream
}
/* ------------------------------------------------------------ */
+ @Override
public void write(int b) throws IOException
{
synchronized(this)
@@ -369,6 +393,7 @@ public class RolloverFileOutputStream extends OutputStream
}
/* ------------------------------------------------------------ */
+ @Override
public void flush() throws IOException
{
synchronized(this)
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/ContainerLifeCycle.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/ContainerLifeCycle.java
index 976613eaa2f..4b6d963969e 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/ContainerLifeCycle.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/ContainerLifeCycle.java
@@ -858,6 +858,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
* @return the list of beans of the given class from the entire managed hierarchy
* @param the Bean type
*/
+ @Override
public Collection getContainedBeans(Class clazz)
{
Set beans = new HashSet<>();
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/FileNoticeLifeCycleListener.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/FileNoticeLifeCycleListener.java
index 9959d9dab82..3c37c833a8d 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/FileNoticeLifeCycleListener.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/FileNoticeLifeCycleListener.java
@@ -52,26 +52,31 @@ public class FileNoticeLifeCycleListener implements LifeCycle.Listener
}
}
+ @Override
public void lifeCycleStarting(LifeCycle event)
{
writeState("STARTING",event);
}
+ @Override
public void lifeCycleStarted(LifeCycle event)
{
writeState("STARTED",event);
}
+ @Override
public void lifeCycleFailure(LifeCycle event, Throwable cause)
{
writeState("FAILED",event);
}
+ @Override
public void lifeCycleStopping(LifeCycle event)
{
writeState("STOPPING",event);
}
+ @Override
public void lifeCycleStopped(LifeCycle event)
{
writeState("STOPPED",event);
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java
index e17c701546f..f27a55a3dff 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java
@@ -228,6 +228,7 @@ public abstract class AbstractLogger implements Logger
}
+ @Override
public void debug(String msg, long arg)
{
if (isDebugEnabled())
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java
index 3b373b57730..4c760dacd2f 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java
@@ -91,6 +91,7 @@ public class JavaUtilLog extends AbstractLogger
{
AccessController.doPrivileged(new PrivilegedAction
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
index 38adf80c7a3..03a3b7e52b4 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
@@ -422,6 +422,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
return httpClient.getBindAddress();
}
+ @Override
public ByteBufferPool getBufferPool()
{
return httpClient.getByteBufferPool();
@@ -527,6 +528,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
return getPolicy().getMaxTextMessageSize();
}
+ @Override
public DecoratedObjectFactory getObjectFactory()
{
return this.containerScope.getObjectFactory();
@@ -537,6 +539,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
return Collections.unmodifiableSet(new HashSet<>(getBeans(WebSocketSession.class)));
}
+ @Override
public WebSocketPolicy getPolicy()
{
return this.containerScope.getPolicy();
@@ -551,6 +554,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
* @return the {@link SslContextFactory} that manages TLS encryption
* @see #WebSocketClient(SslContextFactory)
*/
+ @Override
public SslContextFactory getSslContextFactory()
{
return httpClient.getSslContextFactory();
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java
index 8f128eddb90..f4966cfdcb1 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java
@@ -221,6 +221,7 @@ public class WebSocketRemoteEndpoint implements RemoteEndpoint
*
* @return the InetSocketAddress for the established connection. (or null, if the connection is no longer established)
*/
+ @Override
public InetSocketAddress getInetSocketAddress()
{
if(session.isOpen())
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
index 4b4f3adc9cf..e6a7b68b722 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
@@ -77,9 +77,9 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
WebSocketSessionScope, IncomingFrames, LogicalConnection.Listener, Connection.Listener
{
private static final FrameCallback EMPTY = new FrameCallback.Adapter();
-
+
private final Logger LOG;
-
+
private final WebSocketContainerScope containerScope;
private final WebSocketPolicy policy;
private final AtomicBoolean closed = new AtomicBoolean();
@@ -89,18 +89,18 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
private final AtomicConnectionState connectionState = new AtomicConnectionState();
private final AtomicBoolean closeSent = new AtomicBoolean(false);
private final AtomicBoolean closeNotified = new AtomicBoolean(false);
-
+
/* The websocket endpoint object itself.
* Not declared final, as it can be decorated by other libraries (like CDI)
*/
private Object endpoint;
-
+
// Callbacks
// Endpoint Functions and MessageSinks
protected EndpointFunctions endpointFunctions;
private MessageSink activeMessageSink;
-
+
private ClassLoader classLoader;
private ExtensionFactory extensionFactory;
private BatchMode batchmode = BatchMode.AUTO;
@@ -113,14 +113,14 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
private UpgradeResponse upgradeResponse;
private CompletableFuture openFuture;
private AtomicReference pendingError = new AtomicReference<>();
-
+
public WebSocketSession(WebSocketContainerScope containerScope, URI requestURI, Object endpoint, LogicalConnection connection)
{
Objects.requireNonNull(containerScope, "Container Scope cannot be null");
Objects.requireNonNull(requestURI, "Request URI cannot be null");
-
+
LOG = Log.getLogger(WebSocketSession.class.getName() + "." + connection.getPolicy().getBehavior().name());
-
+
this.classLoader = Thread.currentThread().getContextClassLoader();
this.containerScope = containerScope;
this.requestURI = requestURI;
@@ -131,16 +131,16 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
this.policy = connection.getPolicy();
this.connection.setSession(this);
-
+
addBean(this.connection);
addBean(endpoint);
}
-
+
public EndpointFunctions newEndpointFunctions(Object endpoint)
{
return new CommonEndpointFunctions(endpoint, getPolicy(), this.executor);
}
-
+
public void connect()
{
connectionState.onConnecting();
@@ -155,20 +155,20 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
close(new CloseInfo(statusCode, reason), new DisconnectCallback());
}
-
+
@Override
public void close()
{
/* This is assumed to always be a NORMAL closure, no reason phrase */
close(new CloseInfo(StatusCode.NORMAL), null);
}
-
+
@Override
public void close(CloseStatus closeStatus)
{
close(new CloseInfo(closeStatus.getCode(),closeStatus.getPhrase()), null);
}
-
+
@Override
public void close(int statusCode, String reason)
{
@@ -205,25 +205,25 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
connection.disconnect();
}
-
+
public void dispatch(Runnable runnable)
{
executor.execute(runnable);
}
-
+
@Override
protected void doStart() throws Exception
{
if (LOG.isDebugEnabled())
LOG.debug("starting - {}", this);
-
+
Iterator iter = ServiceLoader.load(RemoteEndpointFactory.class).iterator();
if (iter.hasNext())
remoteEndpointFactory = iter.next();
-
+
if (remoteEndpointFactory == null)
remoteEndpointFactory = this;
-
+
if (LOG.isDebugEnabled())
LOG.debug("Using RemoteEndpointFactory: {}", remoteEndpointFactory);
@@ -247,7 +247,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
addManaged(this.endpointFunctions);
connection.setMaxIdleTimeout(this.policy.getIdleTimeout());
-
+
Throwable fastFail;
synchronized (pendingError)
{
@@ -256,13 +256,13 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
if (fastFail != null)
onError(fastFail);
}
-
+
@Override
protected void doStop() throws Exception
{
if (LOG.isDebugEnabled())
LOG.debug("stopping - {}", this);
-
+
try
{
CloseInfo closeInfo = new CloseInfo(StatusCode.SHUTDOWN, "Shutdown");
@@ -274,7 +274,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
endpointFunctions.onClose(closeInfo);
}
});
-
+
}
catch (Throwable ignore)
{
@@ -282,7 +282,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
}
super.doStop();
}
-
+
@Override
public void dump(Appendable out, String indent) throws IOException
{
@@ -298,7 +298,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
out.append(outgoingHandler.toString()).append(System.lineSeparator());
}
}
-
+
@Override
public boolean equals(Object obj)
{
@@ -328,33 +328,33 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
}
return true;
}
-
+
public ByteBufferPool getBufferPool()
{
return this.connection.getBufferPool();
}
-
+
public ClassLoader getClassLoader()
{
return this.getClass().getClassLoader();
}
-
+
public LogicalConnection getConnection()
{
return connection;
}
-
+
public AtomicConnectionState getConnectionState()
{
return connectionState;
}
-
+
@Override
public WebSocketContainerScope getContainerScope()
{
return this.containerScope;
}
-
+
public Object getEndpoint()
{
Object ret = endpoint;
@@ -364,17 +364,17 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
}
return ret;
}
-
+
public Executor getExecutor()
{
return executor;
}
-
+
public ExtensionFactory getExtensionFactory()
{
return extensionFactory;
}
-
+
/**
* The idle timeout in milliseconds
*/
@@ -383,7 +383,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
return connection.getMaxIdleTimeout();
}
-
+
private Throwable getInvokedCause(Throwable t)
{
if (t instanceof FunctionCallException)
@@ -392,82 +392,82 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
if (cause != null)
return cause;
}
-
+
return t;
}
-
+
@Override
public InetSocketAddress getLocalAddress()
{
return connection.getLocalAddress();
}
-
+
@ManagedAttribute(readonly = true)
public OutgoingFrames getOutgoingHandler()
{
return outgoingHandler;
}
-
+
@Override
public WebSocketPolicy getPolicy()
{
return this.policy;
}
-
+
@Override
public String getProtocolVersion()
{
return protocolVersion;
}
-
+
@Override
public RemoteEndpoint getRemote()
{
if (LOG.isDebugEnabled())
LOG.debug("{}.getRemote()", this.getClass().getSimpleName());
-
+
AtomicConnectionState.State state = connectionState.get();
-
+
if ((state == AtomicConnectionState.State.OPEN) || (state == AtomicConnectionState.State.CONNECTED))
{
return remote;
}
-
+
String err = String.format("RemoteEndpoint unavailable, current state [%s], expecting [%s or %s]",
state.name(), AtomicConnectionState.State.OPEN.name(), AtomicConnectionState.State.CONNECTED.name());
-
+
throw new WebSocketException(err);
}
-
+
@Override
public InetSocketAddress getRemoteAddress()
{
return connection.getRemoteAddress();
}
-
+
public URI getRequestURI()
{
return requestURI;
}
-
+
@Override
public UpgradeRequest getUpgradeRequest()
{
return this.upgradeRequest;
}
-
+
@Override
public UpgradeResponse getUpgradeResponse()
{
return this.upgradeResponse;
}
-
+
@Override
public WebSocketSession getWebSocketSession()
{
return this;
}
-
+
@Override
public int hashCode()
{
@@ -476,7 +476,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
result = (prime * result) + ((connection == null) ? 0 : connection.hashCode());
return result;
}
-
+
/**
* Incoming Raw Frames from Parser (after ExtensionStack)
*/
@@ -495,13 +495,13 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
// For endpoints that want to see raw frames.
// These are immutable.
endpointFunctions.onFrame(frame);
-
+
byte opcode = frame.getOpCode();
switch (opcode)
{
case OpCode.CLOSE:
{
-
+
if (connectionState.onClosing())
{
if (LOG.isDebugEnabled())
@@ -525,17 +525,17 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
if (LOG.isDebugEnabled())
LOG.debug("ConnectionState: {} - Close Frame Received", connectionState);
}
-
+
// let fill/parse continue
callback.succeed();
-
+
return;
}
case OpCode.PING:
{
if (LOG.isDebugEnabled())
LOG.debug("PING: {}", BufferUtil.toDetailString(frame.getPayload()));
-
+
ByteBuffer pongBuf;
if (frame.hasPayload())
{
@@ -547,10 +547,10 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
pongBuf = ByteBuffer.allocate(0);
}
-
+
endpointFunctions.onPing(frame.getPayload());
callback.succeed();
-
+
try
{
getRemote().sendPong(pongBuf);
@@ -566,7 +566,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
if (LOG.isDebugEnabled())
LOG.debug("PONG: {}", BufferUtil.toDetailString(frame.getPayload()));
-
+
endpointFunctions.onPong(frame.getPayload());
callback.succeed();
break;
@@ -586,7 +586,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
endpointFunctions.onContinuation(frame, callback);
if (activeMessageSink != null)
activeMessageSink.accept(frame, callback);
-
+
return;
}
default:
@@ -606,18 +606,18 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
callback.fail(t);
}
-
+
// Unset active MessageSink if this was a fin frame
if (frame.getType().isData() && frame.isFin() && activeMessageSink != null)
activeMessageSink = null;
}
-
+
@Override
public boolean isOpen()
{
return !closed.get() && (this.connectionState.get() == AtomicConnectionState.State.OPEN);
}
-
+
@Override
public boolean isSecure()
{
@@ -625,26 +625,26 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
throw new IllegalStateException("No valid UpgradeRequest yet");
}
-
+
URI requestURI = upgradeRequest.getRequestURI();
-
+
return "wss".equalsIgnoreCase(requestURI.getScheme());
}
-
+
public void notifyClose(CloseInfo closeInfo)
{
if (LOG.isDebugEnabled())
{
LOG.debug("notifyClose({}) closeNotified={} [{}]", closeInfo, closeNotified.get(), getState());
}
-
+
// only notify once
if (closeNotified.compareAndSet(false, true))
{
endpointFunctions.onClose(closeInfo);
}
}
-
+
/**
* Error Event.
*
@@ -665,15 +665,15 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
return;
}
}
-
+
Throwable cause = getInvokedCause(t);
-
+
if (openFuture != null && !openFuture.isDone())
openFuture.completeExceptionally(cause);
-
+
// Forward Errors to User WebSocket Object
endpointFunctions.onError(cause);
-
+
if (cause instanceof NotUtf8Exception)
{
close(new CloseInfo(StatusCode.BAD_PAYLOAD, cause.getMessage()), new DisconnectCallback());
@@ -696,7 +696,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
CloseException ce = (CloseException) cause;
FrameCallback callback = EMPTY;
-
+
// Force disconnect for protocol breaking status codes
switch (ce.getStatusCode())
{
@@ -710,7 +710,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
callback = new DisconnectCallback();
}
}
-
+
close(new CloseInfo(ce.getStatusCode(), ce.getMessage()), callback);
}
else if (cause instanceof WebSocketTimeoutException)
@@ -720,7 +720,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
else
{
LOG.warn("Unhandled Error (closing connection)", cause);
-
+
// Exception on end-user WS-Endpoint.
// Fast-fail & close connection with reason.
int statusCode = StatusCode.SERVER_ERROR;
@@ -731,7 +731,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
close(statusCode, cause.getMessage());
}
}
-
+
/**
* Connection Disconnect Event.
*
@@ -755,7 +755,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
LOG.ignore(t);
}
}
-
+
/**
* Connection Open Event
*
@@ -772,12 +772,13 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
connectionState.onConnecting();
open();
}
-
+
+ @Override
public WebSocketRemoteEndpoint newRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoingFrames, BatchMode batchMode)
{
return new WebSocketRemoteEndpoint(this, outgoingHandler, getBatchMode());
}
-
+
/**
* Open/Activate the session
*/
@@ -785,13 +786,13 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
if (LOG.isDebugEnabled())
LOG.debug("{}.open()", this.getClass().getSimpleName());
-
+
if (remote != null)
{
// already opened
return;
}
-
+
try (ThreadClassLoaderScope scope = new ThreadClassLoaderScope(classLoader))
{
// Upgrade success
@@ -799,23 +800,23 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
if (LOG.isDebugEnabled())
LOG.debug("ConnectionState: Transition to CONNECTED");
-
+
// Connect remote
remote = remoteEndpointFactory.newRemoteEndpoint(connection, outgoingHandler, getBatchMode());
if (LOG.isDebugEnabled())
LOG.debug("{}.open() remote={}", this.getClass().getSimpleName(), remote);
-
+
try
{
// Open WebSocket
endpointFunctions.onOpen(this);
-
+
// Open connection
if (connectionState.onOpen())
{
if (LOG.isDebugEnabled())
LOG.debug("ConnectionState: Transition to OPEN");
-
+
// notify session listeners
try
{
@@ -827,12 +828,12 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
LOG.ignore(t);
}
-
+
if (LOG.isDebugEnabled())
{
LOG.debug("open -> {}", dump());
}
-
+
if (openFuture != null)
{
openFuture.complete(this);
@@ -844,7 +845,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
endpointFunctions.getLog().warn("Error during OPEN", t);
onError(new CloseException(StatusCode.SERVER_ERROR, t));
}
-
+
/* Perform fillInterested outside of onConnected / onOpen.
*
* This is to allow for 2 specific scenarios.
@@ -877,17 +878,17 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
onError(t);
}
}
-
+
public void setExtensionFactory(ExtensionFactory extensionFactory)
{
this.extensionFactory = extensionFactory;
}
-
+
public void setFuture(CompletableFuture fut)
{
this.openFuture = fut;
}
-
+
/**
* Set the timeout in milliseconds
*/
@@ -896,12 +897,12 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
connection.setMaxIdleTimeout(ms);
}
-
+
public void setOutgoingHandler(OutgoingFrames outgoing)
{
this.outgoingHandler = outgoing;
}
-
+
public void setUpgradeRequest(UpgradeRequest request)
{
this.upgradeRequest = request;
@@ -923,7 +924,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
}
}
}
-
+
public void setUpgradeResponse(UpgradeResponse response)
{
this.upgradeResponse = response;
@@ -936,7 +937,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
return connection.suspend();
}
-
+
/**
* @return the default (initial) value for the batching mode.
*/
@@ -944,7 +945,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
{
return this.batchmode;
}
-
+
@Override
public String toString()
{
@@ -975,14 +976,14 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
sb.append(']');
return sb.toString();
}
-
+
public interface Listener
{
@SuppressWarnings("unused")
default void onCreated(WebSocketSession session) { }
void onOpened(WebSocketSession session);
-
+
void onClosed(WebSocketSession session);
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/AbstractExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/AbstractExtension.java
index bed17d7bb9a..23f1c2a9a7a 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/AbstractExtension.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/AbstractExtension.java
@@ -61,6 +61,7 @@ public abstract class AbstractExtension extends AbstractLifeCycle implements Dum
return ContainerLifeCycle.dump(this);
}
+ @Override
public void dump(Appendable out, String indent) throws IOException
{
// incoming
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/BinaryFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/BinaryFrame.java
index d4ab3ae0fbf..28e3fc7102c 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/BinaryFrame.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/BinaryFrame.java
@@ -30,6 +30,7 @@ public class BinaryFrame extends DataFrame
super(OpCode.BINARY);
}
+ @Override
public BinaryFrame setPayload(ByteBuffer buf)
{
super.setPayload(buf);
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/ContinuationFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/ContinuationFrame.java
index 2e4cb8d9131..73f30fd8623 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/ContinuationFrame.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/ContinuationFrame.java
@@ -30,6 +30,7 @@ public class ContinuationFrame extends DataFrame
super(OpCode.CONTINUATION);
}
+ @Override
public ContinuationFrame setPayload(ByteBuffer buf)
{
super.setPayload(buf);
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/ControlFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/ControlFrame.java
index aff5fd548b0..7a9be98f278 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/ControlFrame.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/ControlFrame.java
@@ -35,6 +35,7 @@ public abstract class ControlFrame extends WebSocketFrame
super(opcode);
}
+ @Override
public void assertValid()
{
if (isControlFrame())
@@ -109,6 +110,7 @@ public abstract class ControlFrame extends WebSocketFrame
return true;
}
+ @Override
public boolean isControlFrame()
{
return true;
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/TextFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/TextFrame.java
index f5435ebf6f8..c6746daa146 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/TextFrame.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/TextFrame.java
@@ -45,6 +45,7 @@ public class TextFrame extends DataFrame
return this;
}
+ @Override
public String getPayloadAsUTF8()
{
if (data == null)
diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/NativeWebSocketConfiguration.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/NativeWebSocketConfiguration.java
index 3802402457e..bdfe0816507 100644
--- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/NativeWebSocketConfiguration.java
+++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/NativeWebSocketConfiguration.java
@@ -108,6 +108,7 @@ public class NativeWebSocketConfiguration extends ContainerLifeCycle implements
* @param pathSpec the pathspec to respond on
* @param creator the websocket creator to activate on the provided mapping.
*/
+ @Override
public void addMapping(PathSpec pathSpec, WebSocketCreator creator)
{
WebSocketCreator wsCreator = creator;
diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
index b29da240a92..28e884dfbad 100644
--- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
+++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
@@ -348,6 +348,7 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
return this.executor;
}
+ @Override
public DecoratedObjectFactory getObjectFactory()
{
return objectFactory;
diff --git a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/ServletUpgradeRequest.java b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/ServletUpgradeRequest.java
index f5ed945323c..ca740077693 100644
--- a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/ServletUpgradeRequest.java
+++ b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/ServletUpgradeRequest.java
@@ -406,6 +406,7 @@ public class ServletUpgradeRequest implements UpgradeRequest
/**
* Equivalent to {@link HttpServletRequest#getUserPrincipal()}
*/
+ @Override
public Principal getUserPrincipal()
{
return request.getUserPrincipal();
diff --git a/jetty-websocket/websocket-tests/src/main/java/org/eclipse/jetty/websocket/tests/LocalWebSocketConnection.java b/jetty-websocket/websocket-tests/src/main/java/org/eclipse/jetty/websocket/tests/LocalWebSocketConnection.java
index 3019b77fd2d..a273c6911e7 100644
--- a/jetty-websocket/websocket-tests/src/main/java/org/eclipse/jetty/websocket/tests/LocalWebSocketConnection.java
+++ b/jetty-websocket/websocket-tests/src/main/java/org/eclipse/jetty/websocket/tests/LocalWebSocketConnection.java
@@ -25,7 +25,7 @@ import java.util.concurrent.Executor;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
-import org.eclipse.jetty.util.thread.ExecutorSizedThreadPool;
+import org.eclipse.jetty.util.thread.ExecutorThreadPool;
import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.FrameCallback;
import org.eclipse.jetty.websocket.api.SuspendToken;
@@ -49,7 +49,7 @@ public class LocalWebSocketConnection implements LogicalConnection
{
this("anon",bufferPool);
}
-
+
public LocalWebSocketConnection(URI uri, ByteBufferPool bufferPool)
{
this(uri.toASCIIString(), bufferPool);
@@ -59,7 +59,7 @@ public class LocalWebSocketConnection implements LogicalConnection
{
this.id = id;
this.bufferPool = bufferPool;
- this.executor = new ExecutorSizedThreadPool();
+ this.executor = new ExecutorThreadPool();
this.policy = WebSocketPolicy.newServerPolicy();
}
@@ -86,12 +86,12 @@ public class LocalWebSocketConnection implements LogicalConnection
if (LOG.isDebugEnabled())
LOG.debug("disconnect()");
}
-
+
@Override
public void fillInterested()
{
}
-
+
@Override
public ByteBufferPool getBufferPool()
{
@@ -121,25 +121,25 @@ public class LocalWebSocketConnection implements LogicalConnection
{
return 0;
}
-
+
@Override
public WebSocketPolicy getPolicy()
{
return policy;
}
-
+
@Override
public InetSocketAddress getRemoteAddress()
{
return null;
}
-
+
@Override
public boolean isOpen()
{
return false;
}
-
+
@Override
public void outgoingFrame(Frame frame, FrameCallback callback, BatchMode batchMode)
{
diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/jsr356/endpoints/AbstractStringEndpoint.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/jsr356/endpoints/AbstractStringEndpoint.java
index 99d802cafff..fc08e6f2d52 100644
--- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/jsr356/endpoints/AbstractStringEndpoint.java
+++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/jsr356/endpoints/AbstractStringEndpoint.java
@@ -56,12 +56,12 @@ public abstract class AbstractStringEndpoint extends Endpoint implements Message
assertThat(prefix + " received close code", close.getStatusCode(), Matchers.is(expectedCloseStatusCode));
assertThat(prefix + " received close reason", close.getReason(), reasonMatcher);
}
-
+
public void awaitCloseEvent(String prefix) throws InterruptedException
{
assertTrue(prefix + " onClose event", closeLatch.await(Defaults.CLOSE_EVENT_TIMEOUT_MS, TimeUnit.MILLISECONDS));
}
-
+
@Override
public void onOpen(Session session, EndpointConfig config)
{
@@ -71,7 +71,8 @@ public abstract class AbstractStringEndpoint extends Endpoint implements Message
this.session = session;
this.config = config;
}
-
+
+ @Override
public void onClose(Session session, CloseReason closeReason)
{
if (LOG.isDebugEnabled())
@@ -82,7 +83,8 @@ public abstract class AbstractStringEndpoint extends Endpoint implements Message
this.closeLatch.countDown();
assertTrue("Close only happened once", closeTracked);
}
-
+
+ @Override
public void onError(Session session, Throwable thr)
{
LOG.warn("onError()", thr);
diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml
index a5fecd73e7f..9d0f88794ca 100644
--- a/jetty-xml/pom.xml
+++ b/jetty-xml/pom.xml
@@ -21,6 +21,16 @@
org.eclipse.jetty.xml.*
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ osgi.serviceloader; filter:="(osgi.serviceloader=org.eclipse.jetty.xml.ConfigurationProcessorFactory)";resolution:=optional;cardinality:=multiple, osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)"
+
+
+
diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
index c0dda516c15..4df13d4c263 100644
--- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
+++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
@@ -331,6 +331,7 @@ public class XmlConfiguration
XmlParser.Node _root;
XmlConfiguration _configuration;
+ @Override
public void init(URL url, XmlParser.Node root, XmlConfiguration configuration)
{
_url=url==null?null:url.toString();
@@ -338,6 +339,7 @@ public class XmlConfiguration
_configuration=configuration;
}
+ @Override
public Object configure(Object obj) throws Exception
{
// Check the class of the object
@@ -354,6 +356,7 @@ public class XmlConfiguration
return obj;
}
+ @Override
public Object configure() throws Exception
{
Class> oClass = nodeClass(_root);
diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java
index 9d02e790e0e..576f7dff3d4 100644
--- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java
+++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java
@@ -318,12 +318,14 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException
{
_depth++;
}
/* ------------------------------------------------------------ */
+ @Override
public void endElement(String uri, String localName, String qName) throws SAXException
{
if (_depth == 0)
@@ -356,6 +358,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException
{
String name = null;
@@ -407,6 +410,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void endElement(String uri, String localName, String qName) throws SAXException
{
_context = _context._parent;
@@ -417,6 +421,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void ignorableWhitespace(char buf[], int offset, int len) throws SAXException
{
for (int i = 0; i < _observers.size(); i++)
@@ -425,6 +430,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void characters(char buf[], int offset, int len) throws SAXException
{
_context.add(new String(buf, offset, len));
@@ -434,6 +440,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void warning(SAXParseException ex)
{
LOG.debug(Log.EXCEPTION, ex);
@@ -441,6 +448,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void error(SAXParseException ex) throws SAXException
{
// Save error and continue to report other errors
@@ -451,6 +459,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void fatalError(SAXParseException ex) throws SAXException
{
_error = ex;
@@ -466,6 +475,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public InputSource resolveEntity(String pid, String sid)
{
return XmlParser.this.resolveEntity(pid,sid);
@@ -601,6 +611,7 @@ public class XmlParser
/**
* Get the number of children nodes.
*/
+ @Override
public int size()
{
if (_list != null)
@@ -614,6 +625,7 @@ public class XmlParser
*
* @return Node or String.
*/
+ @Override
public Object get(int i)
{
if (_list != null)
@@ -671,6 +683,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public void clear()
{
if (_list != null)
@@ -699,6 +712,7 @@ public class XmlParser
}
/* ------------------------------------------------------------ */
+ @Override
public synchronized String toString()
{
return toString(true);
@@ -795,6 +809,7 @@ public class XmlParser
Node _node;
/* -------------------------------------------------- */
+ @Override
public boolean hasNext()
{
if (_node != null)
@@ -817,6 +832,7 @@ public class XmlParser
}
/* -------------------------------------------------- */
+ @Override
public Node next()
{
try
@@ -833,6 +849,7 @@ public class XmlParser
}
/* -------------------------------------------------- */
+ @Override
public void remove()
{
throw new UnsupportedOperationException("Not supported");
diff --git a/pom.xml b/pom.xml
index f21f8fc6863..b69b34af535 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,10 +22,13 @@
1.1.3.v201607154.0.04.0.0
- 8.5.24.1
+ 8.5.24.2undefined1.0.0.RC11
+ 6.0
+ 1.20
+ benchmarks
@@ -617,7 +620,7 @@
org.jacocojacoco-maven-plugin
- 0.7.9
+ 0.8.0com.agilejava.docbkx
@@ -891,12 +894,12 @@
org.ow2.asmasm
- 6.0
+ ${asm.version}org.ow2.asmasm-commons
- 6.0
+ ${asm.version}org.eclipse.jetty.orbit
@@ -998,6 +1001,91 @@
+
+
+ jdk10
+
+ 10
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.1-SNAPSHOT
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 2.21.0-SNAPSHOT
+
+
+
+
+
+
+ oss.snapshots
+ OSS Snapshots
+ https://oss.sonatype.org/content/repositories/snapshots
+
+ false
+
+
+ true
+
+
+
+ apache.snapshots
+ https://repository.apache.org/content/repositories/snapshots
+
+ false
+
+
+ true
+
+
+
+
+
+ errorprone
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ true
+ javac-with-errorprone
+ true
+
+ -XepAllErrorsAsWarnings
+ -Xep:OperatorPrecedence:OFF
+
+
+
+
+ org.codehaus.plexus
+ plexus-compiler-javac-errorprone
+ 2.8.2
+
+
+
+ com.google.errorprone
+ error_prone_core
+ 2.2.0
+
+
+
+
+
+
+ jdk8
diff --git a/scripts/git-log-csv.sh b/scripts/git-log-csv.sh
new file mode 100644
index 00000000000..0c6abb37f62
--- /dev/null
+++ b/scripts/git-log-csv.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+git log --date=iso \
+ --pretty=format:"%h%x09%an%x09%ad%x09%s" \
+ $@ > commits.tab.txt
diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AbstractTest.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AbstractTest.java
index ea3843b71c3..2a8e6e10e3f 100644
--- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AbstractTest.java
+++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AbstractTest.java
@@ -18,6 +18,17 @@
package org.eclipse.jetty.http.client;
+import java.lang.management.ManagementFactory;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.servlet.http.HttpServlet;
+
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpClientTransport;
@@ -41,7 +52,6 @@ import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.toolchain.test.OS;
import org.eclipse.jetty.toolchain.test.TestTracker;
import org.eclipse.jetty.unixsocket.UnixSocketConnector;
import org.eclipse.jetty.unixsocket.client.HttpClientTransportOverUnixSockets;
@@ -56,18 +66,6 @@ import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-import javax.servlet.http.HttpServlet;
-
-import java.io.File;
-import java.lang.management.ManagementFactory;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.stream.Collectors;
-
@RunWith(Parameterized.class)
public abstract class AbstractTest
{
@@ -125,7 +123,7 @@ public abstract class AbstractTest
{
if(sockFile == null || !Files.exists( sockFile ))
{
- sockFile = Files.createTempFile(new File("/tmp").toPath(),"unix", ".sock" );
+ sockFile = Files.createTempFile("unix", ".sock" );
Files.delete( sockFile );
}
}
diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AsyncIOServletTest.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AsyncIOServletTest.java
index f2440dcc27c..dfa3842baae 100644
--- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AsyncIOServletTest.java
+++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AsyncIOServletTest.java
@@ -80,6 +80,7 @@ import org.eclipse.jetty.util.log.StacklessLogging;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Assume;
+import org.junit.Ignore;
import org.junit.Test;
import static java.nio.ByteBuffer.wrap;
@@ -138,6 +139,7 @@ public class AsyncIOServletTest extends AbstractTest
throw callScope;
}
+ @Override
protected void stopServer() throws Exception
{
super.stopServer();
@@ -424,6 +426,7 @@ public class AsyncIOServletTest extends AbstractTest
}
@Test
+ @Ignore // TODO fix this test! #2243
public void testAsyncWriteClosed() throws Exception
{
// TODO work out why this test fails for UNIX_SOCKET
@@ -455,7 +458,7 @@ public class AsyncIOServletTest extends AbstractTest
// Wait for the failure to arrive to
// the server while we are about to write.
- sleep(1000);
+ sleep(2000);
out.write(data);
}
@@ -485,8 +488,8 @@ public class AsyncIOServletTest extends AbstractTest
clientLatch.countDown();
});
- assertTrue(errorLatch.await(5, TimeUnit.SECONDS));
- assertTrue(clientLatch.await(5, TimeUnit.SECONDS));
+ assertTrue(errorLatch.await(10, TimeUnit.SECONDS));
+ assertTrue(clientLatch.await(10, TimeUnit.SECONDS));
}
@Test
diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/ConnectionStatisticsTest.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/ConnectionStatisticsTest.java
index ad1939d6a83..dab724e16fe 100644
--- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/ConnectionStatisticsTest.java
+++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/ConnectionStatisticsTest.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.http.client;
import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.servlet.ServletException;
@@ -27,7 +28,9 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.util.BytesContentProvider;
+import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpStatus;
+import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.ConnectionStatistics;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
@@ -47,7 +50,7 @@ public class ConnectionStatisticsTest extends AbstractTest
@Test
public void testConnectionStatistics() throws Exception
{
- Assume.assumeThat(transport, Matchers.isOneOf( Transport.HTTP, Transport.H2C, Transport.H2));
+ Assume.assumeThat(transport, Matchers.isOneOf( Transport.HTTP, Transport.H2C));
start(new AbstractHandler()
{
@@ -59,33 +62,45 @@ public class ConnectionStatisticsTest extends AbstractTest
}
});
+ CountDownLatch closed = new CountDownLatch(2);
+ Connection.Listener closer = new Connection.Listener()
+ {
+ @Override
+ public void onOpened(Connection connection)
+ {
+ }
+
+ @Override
+ public void onClosed(Connection connection)
+ {
+ closed.countDown();
+ }
+ };
+
ConnectionStatistics serverStats = new ConnectionStatistics();
connector.addBean(serverStats);
+ connector.addBean(closer);
serverStats.start();
ConnectionStatistics clientStats = new ConnectionStatistics();
client.addBean(clientStats);
+ client.addBean(closer);
clientStats.start();
+
+ client.setIdleTimeout(1000);
byte[] content = new byte[3072];
long contentLength = content.length;
ContentResponse response = client.newRequest(newURI())
+ .header(HttpHeader.CONNECTION,"close")
.content(new BytesContentProvider(content))
.timeout(5, TimeUnit.SECONDS)
.send();
Assert.assertThat(response.getStatus(), Matchers.equalTo(HttpStatus.OK_200));
- // The bytes have already arrived, but give time to
- // the server to finish to run the response logic.
- Thread.sleep(1000);
-
- // Close all connections.
- stop();
-
- // Give some time to process the stop event.
- Thread.sleep(1000);
-
+ closed.await();
+
Assert.assertThat(serverStats.getConnectionsMax(), Matchers.greaterThan(0L));
Assert.assertThat(serverStats.getReceivedBytes(), Matchers.greaterThan(contentLength));
Assert.assertThat(serverStats.getSentBytes(), Matchers.greaterThan(contentLength));
diff --git a/tests/test-http-client-transport/src/test/resources/jetty-logging.properties b/tests/test-http-client-transport/src/test/resources/jetty-logging.properties
index df14f40cd1b..1047ac8946d 100644
--- a/tests/test-http-client-transport/src/test/resources/jetty-logging.properties
+++ b/tests/test-http-client-transport/src/test/resources/jetty-logging.properties
@@ -4,4 +4,4 @@ org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
#org.eclipse.jetty.http2.LEVEL=DEBUG
#org.eclipse.jetty.http2.hpack.LEVEL=INFO
#org.eclipse.jetty.http2.client.LEVEL=DEBUG
-#org.eclipse.jetty.io.LEVEL=DEBUG
\ No newline at end of file
+#org.eclipse.jetty.io.LEVEL=DEBUG
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorInitializer.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorInitializer.java
new file mode 100644
index 00000000000..b203b3b1802
--- /dev/null
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorInitializer.java
@@ -0,0 +1,38 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2018 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.test;
+
+import java.util.Set;
+
+import javax.servlet.ServletContainerInitializer;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * A SCI that tosses an Error to intentionally to cause issues with the DeploymentManager
+ * @see Issue #1602
+ */
+public class DeploymentErrorInitializer implements ServletContainerInitializer
+{
+ @Override
+ public void onStartup(Set> c, ServletContext ctx) throws ServletException
+ {
+ throw new NoClassDefFoundError("Intentional.Failure");
+ }
+}
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorTest.java
new file mode 100644
index 00000000000..0ddd01175f7
--- /dev/null
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorTest.java
@@ -0,0 +1,424 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2018 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.test;
+
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
+
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.api.ContentResponse;
+import org.eclipse.jetty.deploy.App;
+import org.eclipse.jetty.deploy.AppLifeCycle;
+import org.eclipse.jetty.deploy.DeploymentManager;
+import org.eclipse.jetty.deploy.graph.Node;
+import org.eclipse.jetty.deploy.providers.WebAppProvider;
+import org.eclipse.jetty.http.HttpMethod;
+import org.eclipse.jetty.http.HttpStatus;
+import org.eclipse.jetty.io.RuntimeIOException;
+import org.eclipse.jetty.plus.webapp.EnvConfiguration;
+import org.eclipse.jetty.plus.webapp.PlusConfiguration;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.toolchain.test.FS;
+import org.eclipse.jetty.toolchain.test.IO;
+import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
+import org.eclipse.jetty.util.log.StacklessLogging;
+import org.eclipse.jetty.util.resource.PathResource;
+import org.eclipse.jetty.webapp.AbstractConfiguration;
+import org.eclipse.jetty.webapp.Configuration;
+import org.eclipse.jetty.webapp.Configurations;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.webapp.WebInfConfiguration;
+import org.junit.After;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TestName;
+
+public class DeploymentErrorTest
+{
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Rule
+ public TestName testname = new TestName();
+
+ private StacklessLogging stacklessLogging;
+ private Server server;
+ private DeploymentManager deploymentManager;
+ private ContextHandlerCollection contexts;
+
+ public Path startServer(Consumer docrootSetupConsumer) throws Exception
+ {
+ stacklessLogging = new StacklessLogging(WebAppContext.class, DeploymentManager.class, NoClassDefFoundError.class);
+
+ server = new Server();
+ ServerConnector connector = new ServerConnector(server);
+ connector.setPort(0);
+ server.addConnector(connector);
+
+ // Empty contexts collections
+ contexts = new ContextHandlerCollection();
+
+ // Deployment Manager
+ deploymentManager = new DeploymentManager();
+ deploymentManager.setContexts(contexts);
+ Path testClasses = MavenTestingUtils.getTargetPath("test-classes");
+ System.setProperty("maven.test.classes", testClasses.toAbsolutePath().toString());
+
+ Path docroots = MavenTestingUtils.getTargetTestingPath(DeploymentErrorTest.class, testname.getMethodName());
+ FS.ensureEmpty(docroots);
+
+ if (docrootSetupConsumer != null)
+ {
+ docrootSetupConsumer.accept(docroots);
+ }
+
+ System.setProperty("test.docroots", docroots.toAbsolutePath().toString());
+ WebAppProvider appProvider = new WebAppProvider();
+ appProvider.setMonitoredDirResource(new PathResource(docroots));
+ appProvider.setScanInterval(1);
+ deploymentManager.addAppProvider(appProvider);
+ server.addBean(deploymentManager);
+
+ // Server handlers
+ HandlerCollection handlers = new HandlerCollection();
+ handlers.setHandlers(new Handler[]
+ {contexts, new DefaultHandler()});
+ server.setHandler(handlers);
+
+ // Setup Configurations
+ Configurations.setServerDefault(server)
+ .add("org.eclipse.jetty.plus.webapp.EnvConfiguration",
+ "org.eclipse.jetty.plus.webapp.PlusConfiguration",
+ "org.eclipse.jetty.annotations.AnnotationConfiguration",
+ TrackedConfiguration.class.getName()
+ );
+
+ Configurations configurations = Configuration.ClassList.setServerDefault(server);
+ configurations.add(new EnvConfiguration(), new PlusConfiguration(), new TrackedConfiguration());
+
+// configurations.addAfter(
+// "org.eclipse.jetty.webapp.FragmentConfiguration",
+// "org.eclipse.jetty.plus.webapp.EnvConfiguration",
+// "org.eclipse.jetty.plus.webapp.PlusConfiguration");
+// configurations.addBefore(
+// "org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
+// "org.eclipse.jetty.annotations.AnnotationConfiguration");
+//
+// // Tracking Config
+// configurations.addBefore("org.eclipse.jetty.webapp.WebInfConfiguration",
+// TrackedConfiguration.class.getName());
+
+ server.start();
+ return docroots;
+ }
+
+ @After
+ public void tearDownServer() throws Exception
+ {
+ if (stacklessLogging != null)
+ stacklessLogging.close();
+ server.stop();
+ }
+
+ private void copyBadApp(String sourceXml, Path docroots)
+ {
+ try
+ {
+ File deployErrorSrc = MavenTestingUtils.getTestResourceDir("docroots/deployerror");
+ IO.copy(new File(deployErrorSrc, sourceXml), docroots.resolve("badapp.xml").toFile());
+ File badappDir = new File(deployErrorSrc, "badapp");
+ File badappDest = docroots.resolve("badapp").toFile();
+ FS.ensureDirExists(badappDest);
+ IO.copyDir(badappDir, badappDest);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeIOException(e);
+ }
+ }
+
+ /**
+ * Test of a server startup, where a DeploymentManager has a WebAppProvider pointing
+ * to a directory that already has a webapp that will deploy with an error.
+ * The webapp is a WebAppContext with {@code throwUnavailableOnStartupException=true;}.
+ */
+ @Test
+ public void testInitial_BadApp_UnavailableTrue() throws Exception
+ {
+ expectedException.expect(NoClassDefFoundError.class);
+ startServer(docroots -> copyBadApp("badapp.xml", docroots));
+
+ // The above should have prevented the server from starting.
+ assertThat("server.isRunning", server.isRunning(), is(false));
+ }
+
+ /**
+ * Test of a server startup, where a DeploymentManager has a WebAppProvider pointing
+ * to a directory that already has a webapp that will deploy with an error.
+ * The webapp is a WebAppContext with {@code throwUnavailableOnStartupException=false;}.
+ */
+ @Test
+ public void testInitial_BadApp_UnavailableFalse() throws Exception
+ {
+ startServer(docroots -> copyBadApp("badapp-unavailable-false.xml", docroots));
+
+ List apps = new ArrayList<>();
+ apps.addAll(deploymentManager.getApps());
+ assertThat("Apps tracked", apps.size(), is(1));
+ String contextPath = "/badapp-uaf";
+ App app = findApp(contextPath, apps);
+ ContextHandler context = app.getContextHandler();
+ assertThat("ContextHandler.isStarted", context.isStarted(), is(true));
+ assertThat("ContextHandler.isFailed", context.isFailed(), is(false));
+ assertThat("ContextHandler.isAvailable", context.isAvailable(), is(false));
+ WebAppContext webapp = (WebAppContext) context;
+ TrackedConfiguration trackedConfiguration = null;
+ for (Configuration webappConfig : webapp.getWebAppConfigurations())
+ {
+ if (webappConfig instanceof TrackedConfiguration)
+ trackedConfiguration = (TrackedConfiguration) webappConfig;
+ }
+ assertThat("webapp TrackedConfiguration exists", trackedConfiguration, notNullValue());
+ assertThat("trackedConfig.preConfigureCount", trackedConfiguration.preConfigureCounts.get(contextPath), is(1));
+ assertThat("trackedConfig.configureCount", trackedConfiguration.configureCounts.get(contextPath), is(1));
+ // NOTE: Failure occurs during configure, so postConfigure never runs.
+ assertThat("trackedConfig.postConfigureCount", trackedConfiguration.postConfigureCounts.get(contextPath), nullValue());
+
+ assertHttpState(contextPath, HttpStatus.SERVICE_UNAVAILABLE_503);
+ }
+
+ /**
+ * Test of a server startup, where a DeploymentManager has a WebAppProvider pointing
+ * to a directory that already has no initial webapps that will deploy.
+ * A webapp is added (by filesystem copies) into the monitored docroot.
+ * The webapp will have a deployment error.
+ * The webapp is a WebAppContext with {@code throwUnavailableOnStartupException=true;}.
+ */
+ @Test
+ public void testDelayedAdd_BadApp_UnavailableTrue() throws Exception
+ {
+ Path docroots = startServer(null);
+
+ String contextPath = "/badapp";
+ AppLifeCycleTrackingBinding startTracking = new AppLifeCycleTrackingBinding(contextPath);
+ DeploymentManager deploymentManager = server.getBean(DeploymentManager.class);
+ deploymentManager.addLifeCycleBinding(startTracking);
+
+ copyBadApp("badapp.xml", docroots);
+
+ // Wait for deployment manager to do its thing
+ assertThat("AppLifeCycle.FAILED event occurred", startTracking.failedLatch.await(3, TimeUnit.SECONDS), is(true));
+
+ List apps = new ArrayList<>();
+ apps.addAll(deploymentManager.getApps());
+ assertThat("Apps tracked", apps.size(), is(1));
+ App app = findApp(contextPath, apps);
+ ContextHandler context = app.getContextHandler();
+ assertThat("ContextHandler.isStarted", context.isStarted(), is(false));
+ assertThat("ContextHandler.isFailed", context.isFailed(), is(true));
+ assertThat("ContextHandler.isAvailable", context.isAvailable(), is(false));
+ WebAppContext webapp = (WebAppContext) context;
+ TrackedConfiguration trackedConfiguration = null;
+ for (Configuration webappConfig : webapp.getWebAppConfigurations())
+ {
+ if (webappConfig instanceof TrackedConfiguration)
+ trackedConfiguration = (TrackedConfiguration) webappConfig;
+ }
+ assertThat("webapp TrackedConfiguration exists", trackedConfiguration, notNullValue());
+ assertThat("trackedConfig.preConfigureCount", trackedConfiguration.preConfigureCounts.get(contextPath), is(1));
+ assertThat("trackedConfig.configureCount", trackedConfiguration.configureCounts.get(contextPath), is(1));
+ // NOTE: Failure occurs during configure, so postConfigure never runs.
+ assertThat("trackedConfig.postConfigureCount", trackedConfiguration.postConfigureCounts.get(contextPath), nullValue());
+
+ assertHttpState(contextPath, HttpStatus.NOT_FOUND_404);
+ }
+
+ /**
+ * Test of a server startup, where a DeploymentManager has a WebAppProvider pointing
+ * to a directory that already has no initial webapps that will deploy.
+ * A webapp is added (by filesystem copies) into the monitored docroot.
+ * The webapp will have a deployment error.
+ * The webapp is a WebAppContext with {@code throwUnavailableOnStartupException=false;}.
+ */
+ @Test
+ public void testDelayedAdd_BadApp_UnavailableFalse() throws Exception
+ {
+ Path docroots = startServer(null);
+
+ String contextPath = "/badapp-uaf";
+ AppLifeCycleTrackingBinding startTracking = new AppLifeCycleTrackingBinding(contextPath);
+ DeploymentManager deploymentManager = server.getBean(DeploymentManager.class);
+ deploymentManager.addLifeCycleBinding(startTracking);
+
+ copyBadApp("badapp-unavailable-false.xml", docroots);
+
+ // Wait for deployment manager to do its thing
+ startTracking.startedLatch.await(3, TimeUnit.SECONDS);
+
+ List apps = new ArrayList<>();
+ apps.addAll(deploymentManager.getApps());
+ assertThat("Apps tracked", apps.size(), is(1));
+ App app = findApp(contextPath, apps);
+ ContextHandler context = app.getContextHandler();
+ assertThat("ContextHandler.isStarted", context.isStarted(), is(true));
+ assertThat("ContextHandler.isFailed", context.isFailed(), is(false));
+ assertThat("ContextHandler.isAvailable", context.isAvailable(), is(false));
+ WebAppContext webapp = (WebAppContext) context;
+ TrackedConfiguration trackedConfiguration = null;
+ for (Configuration webappConfig : webapp.getWebAppConfigurations())
+ {
+ if (webappConfig instanceof TrackedConfiguration)
+ trackedConfiguration = (TrackedConfiguration) webappConfig;
+ }
+ assertThat("webapp TrackedConfiguration exists", trackedConfiguration, notNullValue());
+ assertThat("trackedConfig.preConfigureCount", trackedConfiguration.preConfigureCounts.get(contextPath), is(1));
+ assertThat("trackedConfig.configureCount", trackedConfiguration.configureCounts.get(contextPath), is(1));
+ // NOTE: Failure occurs during configure, so postConfigure never runs.
+ assertThat("trackedConfig.postConfigureCount", trackedConfiguration.postConfigureCounts.get(contextPath), nullValue());
+
+ assertHttpState(contextPath, HttpStatus.SERVICE_UNAVAILABLE_503);
+ }
+
+ private void assertHttpState(String contextPath, int expectedStatusCode) throws Exception
+ {
+ URI destURI = server.getURI().resolve(contextPath);
+ HttpClient client = new HttpClient();
+ try
+ {
+ client.start();
+ ContentResponse response = client.newRequest(destURI).method(HttpMethod.GET).send();
+ assertThat("GET Response: " + destURI, response.getStatus(), is(expectedStatusCode));
+ }
+ finally
+ {
+ client.stop();
+ }
+ }
+
+ private App findApp(String contextPath, List apps)
+ {
+ for (App app : apps)
+ {
+ if (contextPath.equals(app.getContextPath()))
+ return app;
+ }
+ return null;
+ }
+
+ public static class TrackedConfiguration extends AbstractConfiguration
+ {
+ public Map preConfigureCounts = new HashMap<>();
+ public Map configureCounts = new HashMap<>();
+ public Map postConfigureCounts = new HashMap<>();
+
+ public TrackedConfiguration()
+ {
+ addDependents(WebInfConfiguration.class);
+ }
+
+ private void incrementCount(WebAppContext context, Map contextCounts)
+ {
+ Integer count = contextCounts.get(context.getContextPath());
+ if (count == null)
+ {
+ count = new Integer(0);
+ }
+ count++;
+ contextCounts.put(context.getContextPath(), count);
+ }
+
+ @Override
+ public void preConfigure(WebAppContext context) throws Exception
+ {
+ incrementCount(context, preConfigureCounts);
+ }
+
+ @Override
+ public void configure(WebAppContext context) throws Exception
+ {
+ incrementCount(context, configureCounts);
+ }
+
+ @Override
+ public void postConfigure(WebAppContext context) throws Exception
+ {
+ incrementCount(context, postConfigureCounts);
+ }
+ }
+
+ public static class AppLifeCycleTrackingBinding implements AppLifeCycle.Binding
+ {
+ public final CountDownLatch startingLatch = new CountDownLatch(1);
+ public final CountDownLatch startedLatch = new CountDownLatch(1);
+ public final CountDownLatch failedLatch = new CountDownLatch(1);
+ private final String expectedContextPath;
+
+ public AppLifeCycleTrackingBinding(String expectedContextPath)
+ {
+ this.expectedContextPath = expectedContextPath;
+ }
+
+ @Override
+ public String[] getBindingTargets()
+ {
+ return new String[]{AppLifeCycle.STARTING, AppLifeCycle.STARTED, AppLifeCycle.FAILED};
+ }
+
+ @Override
+ public void processBinding(Node node, App app)
+ {
+ if (app.getContextPath().equalsIgnoreCase(expectedContextPath))
+ {
+ if (node.getName().equalsIgnoreCase(AppLifeCycle.STARTING))
+ {
+ startingLatch.countDown();
+ }
+ else if (node.getName().equalsIgnoreCase(AppLifeCycle.STARTED))
+ {
+ startedLatch.countDown();
+ }
+ else if (node.getName().equalsIgnoreCase(AppLifeCycle.FAILED))
+ {
+ failedLatch.countDown();
+ }
+ }
+ }
+ }
+}
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DigestPostTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DigestPostTest.java
index 4003f6d26b1..8b6262af098 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DigestPostTest.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DigestPostTest.java
@@ -192,7 +192,7 @@ public class DigestPostTest
int n=result.indexOf("nonce=");
String nonce=result.substring(n+7,result.indexOf('"',n+7));
MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] b= md.digest(String.valueOf(System.currentTimeMillis()).getBytes(org.eclipse.jetty.util.StringUtil.__ISO_8859_1));
+ byte[] b= md.digest(String.valueOf(TimeUnit.NANOSECONDS.toMillis(System.nanoTime())).getBytes(org.eclipse.jetty.util.StringUtil.__ISO_8859_1));
String cnonce=encode(b);
String digest="Digest username=\"testuser\" realm=\"test\" nonce=\""+nonce+"\" uri=\"/test/\" algorithm=MD5 response=\""+
newResponse("POST","/test/",cnonce,"testuser","test","password",nonce,"auth")+
@@ -244,7 +244,7 @@ public class DigestPostTest
int n=result.indexOf("nonce=");
String nonce=result.substring(n+7,result.indexOf('"',n+7));
MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] b= md.digest(String.valueOf(System.currentTimeMillis()).getBytes(StringUtil.__ISO_8859_1));
+ byte[] b= md.digest(String.valueOf(TimeUnit.NANOSECONDS.toMillis(System.nanoTime())).getBytes(StringUtil.__ISO_8859_1));
String cnonce=encode(b);
String digest="Digest username=\"testuser\" realm=\"test\" nonce=\""+nonce+"\" uri=\"/test/\" algorithm=MD5 response=\""+
newResponse("POST","/test/",cnonce,"testuser","test","password",nonce,"auth")+
@@ -329,6 +329,7 @@ public class DigestPostTest
{
private static final long serialVersionUID = 1L;
+ @Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException
{
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java
index 097c96e948e..42a6e2847eb 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java
@@ -706,6 +706,7 @@ public class HttpInputIntegrationTest
}
}
+ @Override
public Socket newSocket(String host, int port) throws IOException
{
SSLSocket socket = __sslContextFactory.newSslSocket();
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/FakeJspServlet.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/FakeJspServlet.java
index 1a346132231..a1cc41eed0a 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/FakeJspServlet.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/FakeJspServlet.java
@@ -34,6 +34,7 @@ public class FakeJspServlet extends HttpServlet
/*
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException
{
String path = req.getServletPath();
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java
index 6200eeee379..d32c13f07f4 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java
@@ -50,6 +50,7 @@ public class RFC2616NIOHttpsTest extends RFC2616BaseTest
return new HttpsSocketImpl();
}
+ @Override
public void test8_2_ExpectInvalid() throws Exception
{
super.test8_2_ExpectInvalid();
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/EchoHandler.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/EchoHandler.java
index 53d65ccb9bf..fe733d95e19 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/EchoHandler.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/EchoHandler.java
@@ -31,6 +31,7 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
public class EchoHandler extends AbstractHandler
{
+ @Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
baseRequest.setHandled(true);
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/JettyDistro.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/JettyDistro.java
index e46d2e81fb9..bb97a970201 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/JettyDistro.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/JettyDistro.java
@@ -316,6 +316,7 @@ public class JettyDistro
// Lets find it.
File subdirs[] = distroUnpackDir.listFiles(new FileFilter()
{
+ @Override
public boolean accept(File path)
{
if (!path.isDirectory())
@@ -839,6 +840,7 @@ public class JettyDistro
this.parser = connector;
}
+ @Override
public void run()
{
String line;
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpSocketImpl.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpSocketImpl.java
index 4e278a64aa0..a81cfeb908e 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpSocketImpl.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpSocketImpl.java
@@ -27,6 +27,7 @@ import java.net.Socket;
*/
public class HttpSocketImpl implements HttpSocket
{
+ @Override
public Socket connect(InetAddress host, int port) throws IOException
{
return new Socket(host,port);
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpsSocketImpl.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpsSocketImpl.java
index 4bea388c129..e7855198bfd 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpsSocketImpl.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpsSocketImpl.java
@@ -49,6 +49,7 @@ public class HttpsSocketImpl implements HttpSocket
@SuppressWarnings("unused")
HostnameVerifier hostnameVerifier = new HostnameVerifier()
{
+ @Override
public boolean verify(String urlHostName, SSLSession session)
{
LOG.warn("Warning: URL Host: " + urlHostName + " vs." + session.getPeerHost());
@@ -72,6 +73,7 @@ public class HttpsSocketImpl implements HttpSocket
}
+ @Override
public Socket connect(InetAddress host, int port) throws IOException
{
SSLSocket sslsock = (SSLSocket)sslfactory.createSocket();
diff --git a/tests/test-integration/src/test/resources/docroots/deployerror/badapp-unavailable-false.xml b/tests/test-integration/src/test/resources/docroots/deployerror/badapp-unavailable-false.xml
new file mode 100644
index 00000000000..162802692d5
--- /dev/null
+++ b/tests/test-integration/src/test/resources/docroots/deployerror/badapp-unavailable-false.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ /badapp-uaf
+ /badapp/
+
+ false
+
+ org.eclipse.jetty.containerInitializerExclusionPattern
+ org.jboss.*
+
+
\ No newline at end of file
diff --git a/tests/test-integration/src/test/resources/docroots/deployerror/badapp.xml b/tests/test-integration/src/test/resources/docroots/deployerror/badapp.xml
new file mode 100644
index 00000000000..529424cc124
--- /dev/null
+++ b/tests/test-integration/src/test/resources/docroots/deployerror/badapp.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ /badapp
+ /badapp/
+
+ true
+
+ org.eclipse.jetty.containerInitializerExclusionPattern
+ org.jboss.*
+
+
\ No newline at end of file
diff --git a/tests/test-integration/src/test/resources/docroots/deployerror/badapp/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer b/tests/test-integration/src/test/resources/docroots/deployerror/badapp/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer
new file mode 100644
index 00000000000..753c0f1b781
--- /dev/null
+++ b/tests/test-integration/src/test/resources/docroots/deployerror/badapp/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer
@@ -0,0 +1 @@
+org.eclipse.jetty.test.DeploymentErrorInitializer
\ No newline at end of file
diff --git a/tests/test-integration/src/test/resources/docroots/deployerror/badapp/WEB-INF/web.xml b/tests/test-integration/src/test/resources/docroots/deployerror/badapp/WEB-INF/web.xml
new file mode 100644
index 00000000000..267fb9d957a
--- /dev/null
+++ b/tests/test-integration/src/test/resources/docroots/deployerror/badapp/WEB-INF/web.xml
@@ -0,0 +1,7 @@
+
+ Intentional Deployment Error WebApp
+
\ No newline at end of file
diff --git a/tests/test-loginservice/src/test/java/org/eclipse/jetty/DataSourceLoginServiceTest.java b/tests/test-loginservice/src/test/java/org/eclipse/jetty/DataSourceLoginServiceTest.java
index 31dabb43aa1..bb39993a75f 100644
--- a/tests/test-loginservice/src/test/java/org/eclipse/jetty/DataSourceLoginServiceTest.java
+++ b/tests/test-loginservice/src/test/java/org/eclipse/jetty/DataSourceLoginServiceTest.java
@@ -149,7 +149,7 @@ public class DataSourceLoginServiceTest
stopClient();
- String newpwd = String.valueOf(System.currentTimeMillis());
+ String newpwd = String.valueOf(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
changePassword("jetty", newpwd);
diff --git a/tests/test-loginservice/src/test/java/org/eclipse/jetty/DatabaseLoginServiceTestServer.java b/tests/test-loginservice/src/test/java/org/eclipse/jetty/DatabaseLoginServiceTestServer.java
index ee01601f219..285b11c4b0a 100644
--- a/tests/test-loginservice/src/test/java/org/eclipse/jetty/DatabaseLoginServiceTestServer.java
+++ b/tests/test-loginservice/src/test/java/org/eclipse/jetty/DatabaseLoginServiceTestServer.java
@@ -110,6 +110,7 @@ public class DatabaseLoginServiceTestServer
_resourcePath = repositoryPath;
}
+ @Override
public void handle(String target, org.eclipse.jetty.server.Request baseRequest,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
diff --git a/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java b/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
index ca49f767af3..145004c28d9 100644
--- a/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
+++ b/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
@@ -50,6 +50,7 @@ public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessi
}
@Test
+ @Override
public void testOrphanedSession() throws Exception
{
super.testOrphanedSession();
diff --git a/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/ProxySerializationTest.java b/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/ProxySerializationTest.java
index 743d2bbca6f..d25d721b5f7 100644
--- a/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/ProxySerializationTest.java
+++ b/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/ProxySerializationTest.java
@@ -58,6 +58,7 @@ public class ProxySerializationTest extends AbstractProxySerializationTest
@Test
+ @Override
public void testProxySerialization() throws Exception
{
super.testProxySerialization();
diff --git a/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java b/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
index a38c738b746..34ee7299903 100644
--- a/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
+++ b/tests/test-sessions/test-file-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
@@ -48,6 +48,7 @@ public class SessionInvalidateCreateScavengeTest extends AbstractSessionInvalida
}
@Test
+ @Override
public void testSessionScavenge() throws Exception
{
super.testSessionScavenge();
diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NonClusteredSessionScavengingTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NonClusteredSessionScavengingTest.java
index 2f50754b7ac..4c3f6778b6a 100644
--- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NonClusteredSessionScavengingTest.java
+++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NonClusteredSessionScavengingTest.java
@@ -39,6 +39,7 @@ public class NonClusteredSessionScavengingTest extends AbstractNonClusteredSessi
}
@Test
+ @Override
public void testNewSession() throws Exception
{
super.testNewSession();
diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
index b794616836a..3ec2eb172b8 100644
--- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
+++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
@@ -32,6 +32,7 @@ public class SessionInvalidateCreateScavengeTest extends AbstractSessionInvalida
}
@Test
+ @Override
public void testSessionScavenge() throws Exception
{
super.testSessionScavenge();
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredLastAccessTimeTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredLastAccessTimeTest.java
index 4ae5d4b95fe..c0f672e3ea5 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredLastAccessTimeTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredLastAccessTimeTest.java
@@ -18,6 +18,8 @@
package org.eclipse.jetty.hazelcast.session;
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.server.session.AbstractClusteredLastAccessTimeTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
import org.junit.After;
@@ -35,7 +37,7 @@ public class ClusteredLastAccessTimeTest
public SessionDataStoreFactory createSessionDataStoreFactory()
{
factory = new HazelcastSessionDataStoreFactory();
- factory.setMapName( Long.toString( System.currentTimeMillis() ) );
+ factory.setMapName( Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) ) );
return factory;
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredOrphanedSessionTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredOrphanedSessionTest.java
index bcdca5689a7..f7eb430e07a 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredOrphanedSessionTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredOrphanedSessionTest.java
@@ -19,6 +19,8 @@
package org.eclipse.jetty.hazelcast.session;
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.server.session.AbstractClusteredOrphanedSessionTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
import org.junit.After;
@@ -39,7 +41,7 @@ public class ClusteredOrphanedSessionTest
public SessionDataStoreFactory createSessionDataStoreFactory()
{
factory = new HazelcastSessionDataStoreFactory();
- factory.setMapName( Long.toString( System.currentTimeMillis() ) );
+ factory.setMapName( Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) ) );
return factory;
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredSessionMigrationTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredSessionMigrationTest.java
index ad594633e03..7303228e950 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredSessionMigrationTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredSessionMigrationTest.java
@@ -19,6 +19,8 @@
package org.eclipse.jetty.hazelcast.session;
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.server.session.AbstractClusteredSessionMigrationTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
import org.junit.After;
@@ -38,7 +40,7 @@ public class ClusteredSessionMigrationTest
public SessionDataStoreFactory createSessionDataStoreFactory()
{
factory = new HazelcastSessionDataStoreFactory();
- factory.setMapName( Long.toString( System.currentTimeMillis() ) );
+ factory.setMapName( Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) ) );
return factory;
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredSessionScavengingTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredSessionScavengingTest.java
index 40a725933ad..5a8079bd015 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredSessionScavengingTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ClusteredSessionScavengingTest.java
@@ -19,6 +19,8 @@
package org.eclipse.jetty.hazelcast.session;
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.server.session.AbstractClusteredSessionScavengingTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
import org.junit.After;
@@ -39,7 +41,7 @@ public class ClusteredSessionScavengingTest
public SessionDataStoreFactory createSessionDataStoreFactory()
{
factory = new HazelcastSessionDataStoreFactory();
- factory.setMapName( Long.toString( System.currentTimeMillis() ) );
+ factory.setMapName( Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) ) );
return factory;
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ModifyMaxInactiveIntervalTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ModifyMaxInactiveIntervalTest.java
index 1dde727c417..17299dabd2b 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ModifyMaxInactiveIntervalTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/ModifyMaxInactiveIntervalTest.java
@@ -19,6 +19,8 @@
package org.eclipse.jetty.hazelcast.session;
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.server.session.AbstractModifyMaxInactiveIntervalTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
import org.junit.After;
@@ -39,7 +41,7 @@ public class ModifyMaxInactiveIntervalTest
public SessionDataStoreFactory createSessionDataStoreFactory()
{
factory = new HazelcastSessionDataStoreFactory();
- factory.setMapName( Long.toString( System.currentTimeMillis() ) );
+ factory.setMapName( Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) ) );
return factory;
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/NonClusteredSessionScavengingTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/NonClusteredSessionScavengingTest.java
index 1fbe3cd78dc..48feedd8641 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/NonClusteredSessionScavengingTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/NonClusteredSessionScavengingTest.java
@@ -25,6 +25,8 @@ import org.junit.After;
import static org.junit.Assert.*;
+import java.util.concurrent.TimeUnit;
+
/**
* NonClusteredSessionScavengingTest
*/
@@ -67,7 +69,7 @@ public class NonClusteredSessionScavengingTest
public SessionDataStoreFactory createSessionDataStoreFactory()
{
factory = new HazelcastSessionDataStoreFactory();
- factory.setMapName( Long.toString( System.currentTimeMillis() ) );
+ factory.setMapName( Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) ) );
return factory;
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/SessionExpiryTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/SessionExpiryTest.java
index 387e6a5407f..25d68ec76d7 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/SessionExpiryTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/SessionExpiryTest.java
@@ -19,6 +19,8 @@
package org.eclipse.jetty.hazelcast.session;
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.server.session.AbstractSessionExpiryTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
import org.junit.After;
@@ -37,7 +39,7 @@ public class SessionExpiryTest
public SessionDataStoreFactory createSessionDataStoreFactory()
{
factory = new HazelcastSessionDataStoreFactory();
- factory.setMapName( Long.toString( System.currentTimeMillis() ) );
+ factory.setMapName( Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) ) );
return factory;
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/SessionInvalidateCreateScavengeTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/SessionInvalidateCreateScavengeTest.java
index a80a3c26d3e..c95fe4b8729 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/SessionInvalidateCreateScavengeTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/SessionInvalidateCreateScavengeTest.java
@@ -19,6 +19,8 @@
package org.eclipse.jetty.hazelcast.session;
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.server.session.AbstractSessionInvalidateCreateScavengeTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
import org.junit.After;
@@ -39,7 +41,7 @@ public class SessionInvalidateCreateScavengeTest
public SessionDataStoreFactory createSessionDataStoreFactory()
{
factory = new HazelcastSessionDataStoreFactory();
- factory.setMapName( Long.toString( System.currentTimeMillis() ) );
+ factory.setMapName( Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) ) );
return factory;
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientLastAccessTimeTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientLastAccessTimeTest.java
index 1e547e49eab..b36945b205b 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientLastAccessTimeTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientLastAccessTimeTest.java
@@ -22,6 +22,9 @@ import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
+
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.hazelcast.session.HazelcastSessionDataStoreFactory;
import org.eclipse.jetty.server.session.AbstractClusteredLastAccessTimeTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
@@ -32,7 +35,7 @@ public class ClientLastAccessTimeTest
extends AbstractClusteredLastAccessTimeTest
{
- private static final String MAP_NAME = Long.toString( System.currentTimeMillis() );
+ private static final String MAP_NAME = Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) );
private HazelcastInstance hazelcastInstance;
@@ -41,7 +44,7 @@ public class ClientLastAccessTimeTest
throws Exception
{
Config config = new Config().addMapConfig( new MapConfig().setName( MAP_NAME ) ) //
- .setInstanceName( "beer" );
+ .setInstanceName( Long.toString( System.currentTimeMillis() ) );
// start Hazelcast instance
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientModifyMaxInactiveIntervalTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientModifyMaxInactiveIntervalTest.java
index 1781e14eee6..df120b05f5d 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientModifyMaxInactiveIntervalTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientModifyMaxInactiveIntervalTest.java
@@ -23,6 +23,9 @@ import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
+
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.hazelcast.session.HazelcastSessionDataStoreFactory;
import org.eclipse.jetty.server.session.AbstractModifyMaxInactiveIntervalTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
@@ -36,7 +39,7 @@ public class ClientModifyMaxInactiveIntervalTest
extends AbstractModifyMaxInactiveIntervalTest
{
- private static final String MAP_NAME = Long.toString( System.currentTimeMillis() );
+ private static final String MAP_NAME = Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) );
private HazelcastInstance hazelcastInstance;
@@ -45,7 +48,7 @@ public class ClientModifyMaxInactiveIntervalTest
throws Exception
{
Config config = new Config().addMapConfig( new MapConfig().setName( MAP_NAME ) ) //
- .setInstanceName( "beer" );
+ .setInstanceName( Long.toString( System.currentTimeMillis() ) );
// start Hazelcast instance
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientNonClusteredSessionScavengingTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientNonClusteredSessionScavengingTest.java
index d4d9935feb7..d555a941662 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientNonClusteredSessionScavengingTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientNonClusteredSessionScavengingTest.java
@@ -31,6 +31,8 @@ import org.junit.Before;
import static org.junit.Assert.*;
+import java.util.concurrent.TimeUnit;
+
public class ClientNonClusteredSessionScavengingTest
extends AbstractNonClusteredSessionScavengingTest
{
@@ -60,7 +62,7 @@ public class ClientNonClusteredSessionScavengingTest
fail( e.getMessage() );
}
}
- private static final String MAP_NAME = Long.toString( System.currentTimeMillis() );
+ private static final String MAP_NAME = Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) );
private HazelcastInstance hazelcastInstance;
@@ -69,7 +71,7 @@ public class ClientNonClusteredSessionScavengingTest
throws Exception
{
Config config = new Config().addMapConfig( new MapConfig().setName( MAP_NAME ) ) //
- .setInstanceName( "beer" );
+ .setInstanceName( Long.toString( System.currentTimeMillis() ) );
// start Hazelcast instance
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientOrphanedSessionTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientOrphanedSessionTest.java
index fca6559a356..4b2ddba9ca2 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientOrphanedSessionTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientOrphanedSessionTest.java
@@ -23,6 +23,9 @@ import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
+
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.hazelcast.session.HazelcastSessionDataStoreFactory;
import org.eclipse.jetty.server.session.AbstractClusteredOrphanedSessionTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
@@ -33,7 +36,7 @@ public class ClientOrphanedSessionTest
extends AbstractClusteredOrphanedSessionTest
{
- private static final String MAP_NAME = Long.toString( System.currentTimeMillis() );
+ private static final String MAP_NAME = Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) );
private HazelcastInstance hazelcastInstance;
@@ -42,7 +45,7 @@ public class ClientOrphanedSessionTest
throws Exception
{
Config config = new Config().addMapConfig( new MapConfig().setName( MAP_NAME ) ) //
- .setInstanceName( "beer" );
+ .setInstanceName( Long.toString( System.currentTimeMillis() ) );
// start Hazelcast instance
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionExpiryTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionExpiryTest.java
index 4cff3cfbf71..63e5ee28e5d 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionExpiryTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionExpiryTest.java
@@ -23,6 +23,9 @@ import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
+
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.hazelcast.session.HazelcastSessionDataStoreFactory;
import org.eclipse.jetty.server.session.AbstractSessionExpiryTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
@@ -33,7 +36,7 @@ public class ClientSessionExpiryTest
extends AbstractSessionExpiryTest
{
- private static final String MAP_NAME = Long.toString( System.currentTimeMillis() );
+ private static final String MAP_NAME = Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) );
private HazelcastInstance hazelcastInstance;
@@ -42,7 +45,7 @@ public class ClientSessionExpiryTest
throws Exception
{
Config config = new Config().addMapConfig( new MapConfig().setName( MAP_NAME ) ) //
- .setInstanceName( "beer" );
+ .setInstanceName( Long.toString( System.currentTimeMillis() ) );
// start Hazelcast instance
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionInvalidateCreateScavengeTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionInvalidateCreateScavengeTest.java
index c80773c93fe..402246b8e5e 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionInvalidateCreateScavengeTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionInvalidateCreateScavengeTest.java
@@ -23,6 +23,9 @@ import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
+
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.hazelcast.session.HazelcastSessionDataStoreFactory;
import org.eclipse.jetty.server.session.AbstractSessionInvalidateCreateScavengeTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
@@ -32,7 +35,7 @@ import org.junit.Before;
public class ClientSessionInvalidateCreateScavengeTest
extends AbstractSessionInvalidateCreateScavengeTest
{
- private static final String MAP_NAME = Long.toString( System.currentTimeMillis() );
+ private static final String MAP_NAME = Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) );
private HazelcastInstance hazelcastInstance;
@@ -41,7 +44,7 @@ public class ClientSessionInvalidateCreateScavengeTest
throws Exception
{
Config config = new Config().addMapConfig( new MapConfig().setName( MAP_NAME ) ) //
- .setInstanceName( "beer" );
+ .setInstanceName( Long.toString( System.currentTimeMillis() ) );
// start Hazelcast instance
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionMigrationTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionMigrationTest.java
index 188f8ea2347..24da1e67372 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionMigrationTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionMigrationTest.java
@@ -23,6 +23,9 @@ import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
+
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.hazelcast.session.HazelcastSessionDataStoreFactory;
import org.eclipse.jetty.server.session.AbstractClusteredSessionMigrationTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
@@ -35,7 +38,7 @@ import org.junit.Before;
public class ClientSessionMigrationTest
extends AbstractClusteredSessionMigrationTest
{
- private static final String MAP_NAME = Long.toString( System.currentTimeMillis() );
+ private static final String MAP_NAME = Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) );
private HazelcastInstance hazelcastInstance;
@@ -44,7 +47,7 @@ public class ClientSessionMigrationTest
throws Exception
{
Config config = new Config().addMapConfig( new MapConfig().setName( MAP_NAME ) ) //
- .setInstanceName( "beer" );
+ .setInstanceName( Long.toString( System.currentTimeMillis() ) );
// start Hazelcast instance
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
}
diff --git a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionScavengingTest.java b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionScavengingTest.java
index d4e2bb47cb1..42f808f9603 100644
--- a/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionScavengingTest.java
+++ b/tests/test-sessions/test-hazelcast-sessions/src/test/java/org/eclipse/jetty/hazelcast/session/client/ClientSessionScavengingTest.java
@@ -23,6 +23,9 @@ import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
+
+import java.util.concurrent.TimeUnit;
+
import org.eclipse.jetty.hazelcast.session.HazelcastSessionDataStoreFactory;
import org.eclipse.jetty.server.session.AbstractClusteredSessionScavengingTest;
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
@@ -33,7 +36,7 @@ public class ClientSessionScavengingTest
extends AbstractClusteredSessionScavengingTest
{
- private static final String MAP_NAME = Long.toString( System.currentTimeMillis() );
+ private static final String MAP_NAME = Long.toString( TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) );
private HazelcastInstance hazelcastInstance;
@@ -42,7 +45,7 @@ public class ClientSessionScavengingTest
throws Exception
{
Config config = new Config().addMapConfig( new MapConfig().setName( MAP_NAME ) ) //
- .setInstanceName( "beer" );
+ .setInstanceName( Long.toString( System.currentTimeMillis() ) );
// start Hazelcast instance
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredInvalidationSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredInvalidationSessionTest.java
index b20946be216..0b2bf8a7867 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredInvalidationSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredInvalidationSessionTest.java
@@ -29,6 +29,7 @@ public class ClusteredInvalidationSessionTest extends AbstractClusteredInvalidat
{
@Test
+ @Override
public void testInvalidation() throws Exception
{
super.testInvalidation();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredLastAccessTimeTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredLastAccessTimeTest.java
index 42810503da7..e2104ff191d 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredLastAccessTimeTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredLastAccessTimeTest.java
@@ -35,6 +35,7 @@ public class ClusteredLastAccessTimeTest extends AbstractClusteredLastAccessTime
return JdbcTestHelper.newSessionDataStoreFactory();
}
@Test
+ @Override
public void testLastAccessTime() throws Exception
{
super.testLastAccessTime();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
index a55ea6c8c45..62f6ed69944 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
@@ -36,6 +36,7 @@ public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessi
}
@Test
+ @Override
public void testOrphanedSession() throws Exception
{
super.testOrphanedSession();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java
index f2d96dbaa8a..3df023019fd 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java
@@ -36,6 +36,7 @@ public class ClusteredSessionMigrationTest extends AbstractClusteredSessionMigra
}
@Test
+ @Override
public void testSessionMigration() throws Exception
{
super.testSessionMigration();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionScavengingTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionScavengingTest.java
index a703034d18b..622567ef4f0 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionScavengingTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionScavengingTest.java
@@ -26,6 +26,7 @@ import org.junit.Test;
*/
public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest
{
+ @Override
public void pause (int scavenge)
{
//Wait a little longer for the scavenging to happen with the JDBCSession handling.
@@ -53,6 +54,7 @@ public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScav
}
@Test
+ @Override
public void testNoScavenging() throws Exception
{
super.testNoScavenging();
@@ -60,6 +62,7 @@ public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScav
@Test
+ @Override
public void testLocalSessionsScavenging() throws Exception
{
super.testLocalSessionsScavenging();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ProxySerializationTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ProxySerializationTest.java
index a87b159bd22..a0193544951 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ProxySerializationTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ProxySerializationTest.java
@@ -53,6 +53,7 @@ public class ProxySerializationTest extends AbstractProxySerializationTest
@Test
+ @Override
public void testProxySerialization() throws Exception
{
super.testProxySerialization();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java
index 65ebd800f5a..b36ef2dfca5 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java
@@ -43,6 +43,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
@Test
+ @Override
public void testSessionExpiry() throws Exception
{
try(StacklessLogging stackless=new StacklessLogging(Log.getLogger("org.eclipse.jetty.server.session")))
@@ -55,6 +56,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
* @see org.eclipse.jetty.server.session.AbstractSessionExpiryTest#testSessionExpiresWithListener()
*/
@Test
+ @Override
public void testSessionExpiresWithListener() throws Exception
{
super.testSessionExpiresWithListener();
@@ -63,6 +65,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
@Test
+ @Override
public void testSessionNotExpired() throws Exception
{
super.testSessionNotExpired();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
index 0547a024d29..7fd213020b3 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionInvalidateCreateScavengeTest.java
@@ -36,6 +36,7 @@ public class SessionInvalidateCreateScavengeTest extends AbstractSessionInvalida
@Test
+ @Override
public void testSessionScavenge() throws Exception
{
super.testSessionScavenge();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
index a84cd46fe6f..51f63d0cd83 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
@@ -42,6 +42,7 @@ public class WebAppObjectInSessionTest extends AbstractWebAppObjectInSessionTest
@Test
+ @Override
public void testWebappObjectInSession() throws Exception
{
super.testWebappObjectInSession();
diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java
index c28f4fede76..b6c5746519e 100644
--- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java
+++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.concurrent.TimeUnit;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -145,7 +146,7 @@ public class AttributeNameTest
if ("init".equals(action))
{
Session session = (Session)request.getSession(true);
- session.setAttribute("a.b.c",System.currentTimeMillis());
+ session.setAttribute("a.b.c",TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
sendResult(session,httpServletResponse.getWriter());
}
diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredLastAccessTimeTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredLastAccessTimeTest.java
index a610d8cd6a0..61f56399038 100644
--- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredLastAccessTimeTest.java
+++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredLastAccessTimeTest.java
@@ -54,6 +54,7 @@ public class ClusteredLastAccessTimeTest extends AbstractClusteredLastAccessTime
@Test
+ @Override
public void testLastAccessTime() throws Exception
{
super.testLastAccessTime();
diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java
index 9229d2b7706..90703de2799 100644
--- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java
+++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java
@@ -55,6 +55,7 @@ public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessi
@Test
+ @Override
public void testOrphanedSession() throws Exception
{
super.testOrphanedSession();
diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredSessionMigrationTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredSessionMigrationTest.java
index 02ad3d7e593..8e55d890f8e 100644
--- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredSessionMigrationTest.java
+++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredSessionMigrationTest.java
@@ -53,6 +53,7 @@ public class ClusteredSessionMigrationTest extends AbstractClusteredSessionMigra
@Test
+ @Override
public void testSessionMigration() throws Exception
{
super.testSessionMigration();
diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionExpiryTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionExpiryTest.java
index cc91b3d69b6..b655f00671e 100644
--- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionExpiryTest.java
+++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionExpiryTest.java
@@ -79,18 +79,21 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
}
@Test
+ @Override
public void testSessionNotExpired() throws Exception
{
super.testSessionNotExpired();
}
@Test
+ @Override
public void testSessionExpiry() throws Exception
{
super.testSessionExpiry();
}
@Test
+ @Override
public void testRequestForSessionWithChangedTimeout() throws Exception
{
super.testRequestForSessionWithChangedTimeout();
diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionInvalidateCreateScavengeTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionInvalidateCreateScavengeTest.java
index 40f00260f85..90a8f579d7c 100644
--- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionInvalidateCreateScavengeTest.java
+++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionInvalidateCreateScavengeTest.java
@@ -53,6 +53,7 @@ public class SessionInvalidateCreateScavengeTest extends AbstractSessionInvalida
@Test
+ @Override
public void testSessionScavenge() throws Exception
{
super.testSessionScavenge();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractModifyMaxInactiveIntervalTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractModifyMaxInactiveIntervalTest.java
index 9ecdd84b057..37a9b37a426 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractModifyMaxInactiveIntervalTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractModifyMaxInactiveIntervalTest.java
@@ -33,7 +33,6 @@ import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.junit.After;
import org.junit.Test;
@@ -45,18 +44,14 @@ import org.junit.Test;
*/
public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTestBase
{
-
-
public static int newMaxInactive = 20;
public static int __scavenge = 1;
-
@Test
public void testReduceMaxInactiveInterval() throws Exception
{
- int oldMaxInactive = 3;
+ int oldMaxInactive = 30;
int newMaxInactive = 1;
- int sleep = (int)(oldMaxInactive * 0.8);
DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory();
cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT);
@@ -83,14 +78,17 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
assertTrue(sessionCookie != null);
//do another request to reduce the maxinactive interval
- Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive+"&wait="+sleep);
+ Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive);
response = request.send();
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
- //do another request using the cookie to ensure the session is still there
+ // Wait for the session to expire
+ Thread.sleep(1500*newMaxInactive);
+
+ //do another request using the cookie to ensure the session is NOT there
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
response = request.send();
- assertEquals(HttpServletResponse.SC_OK,response.getStatus());
+ assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,response.getStatus());
}
finally
@@ -107,11 +105,9 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
@Test
public void testIncreaseMaxInactiveInterval() throws Exception
- {
-
- int oldMaxInactive = 3;
- int newMaxInactive = 5;
- int sleep = (int)(oldMaxInactive * 0.8);
+ {
+ int oldMaxInactive = 1;
+ int newMaxInactive = 10;
DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory();
cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT);
@@ -137,11 +133,14 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
String sessionCookie = response.getHeaders().get("Set-Cookie");
assertTrue(sessionCookie != null);
- //do another request to increase the maxinactive interval, first waiting until the old expiration should have passed
- Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive+"&wait="+sleep);
+ //do another request to increase the maxinactive interval
+ Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive);
response = request.send();
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
+ // wait until the old inactive interval should have expired
+ Thread.sleep(1100*oldMaxInactive);
+
//do another request using the cookie to ensure the session is still there
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
response = request.send();
@@ -411,7 +410,7 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
//wait for longer than the old inactive interval
- Thread.currentThread().sleep(sleep*1000L);
+ Thread.sleep(sleep*1000L);
//do another request using the cookie to ensure the session is still there
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
@@ -503,7 +502,7 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
int wait = (tmp==null?0:Integer.parseInt(tmp));
if (wait >0)
{
- try { Thread.currentThread().sleep(wait*1000);}catch (Exception e) {throw new ServletException(e);}
+ try { Thread.sleep(wait*1000);}catch (Exception e) {throw new ServletException(e);}
}
HttpSession session = request.getSession(false);
if (session == null)
@@ -532,7 +531,7 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
if (interval > 0)
{
- try{Thread.currentThread().sleep(interval*1000);}catch (Exception e) {throw new ServletException(e);}
+ try{Thread.sleep(interval*1000);}catch (Exception e) {throw new ServletException(e);}
}
session = request.getSession(false);
@@ -546,7 +545,10 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
{
HttpSession session = request.getSession(false);
if (session == null)
- throw new ServletException("Session does not exist");
+ {
+ response.sendError(500,"Session does not exist");
+ return;
+ }
String tmp = request.getParameter("val");
int interval = 0;
interval = (tmp==null?0:Integer.parseInt(tmp));
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java
index 5b1463936da..bf3308f631a 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java
@@ -42,6 +42,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -82,6 +83,7 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
accessAttribute = false;
}
+ @Override
public void sessionDestroyed(HttpSessionEvent se)
{
destroyedSessions.add(se.getSession().getId());
@@ -99,6 +101,7 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
}
}
+ @Override
public void sessionCreated(HttpSessionEvent se)
{
createdSessions.add(se.getSession().getId());
@@ -106,6 +109,7 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
};
@Test
+ @Ignore // https://github.com/eclipse/jetty.project/issues/2214
public void testSessionExpiresWithListener() throws Exception
{
String contextPath = "/";
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionInvalidateCreateScavengeTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionInvalidateCreateScavengeTest.java
index d01812730bc..48124a96761 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionInvalidateCreateScavengeTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionInvalidateCreateScavengeTest.java
@@ -59,11 +59,13 @@ public abstract class AbstractSessionInvalidateCreateScavengeTest extends Abstra
{
List destroys = new ArrayList<>();
+ @Override
public void sessionCreated(HttpSessionEvent e)
{
}
+ @Override
public void sessionDestroyed(HttpSessionEvent e)
{
destroys.add(e.getSession().hashCode());
@@ -161,11 +163,13 @@ public abstract class AbstractSessionInvalidateCreateScavengeTest extends Abstra
{
private boolean unbound = false;
+ @Override
public void valueUnbound(HttpSessionBindingEvent event)
{
unbound = true;
}
+ @Override
public void valueBound(HttpSessionBindingEvent event)
{
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/TestSessionDataStore.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/TestSessionDataStore.java
index 007f7c5e332..552f4a63cf4 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/TestSessionDataStore.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/TestSessionDataStore.java
@@ -19,7 +19,6 @@
package org.eclipse.jetty.server.session;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -102,8 +101,6 @@ public class TestSessionDataStore extends AbstractSessionDataStore
set.add(d.getId());
}
return set;
-
- //return Collections.emptySet();
}
}
diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/CreationTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/CreationTest.java
index 63e9213d011..4664be00432 100644
--- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/CreationTest.java
+++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/CreationTest.java
@@ -265,7 +265,7 @@ public class CreationTest
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
//ensure work has finished on the server side
- _synchronizer.await();
+ _synchronizer.await(2*inactivePeriod, TimeUnit.SECONDS);
//check that the sessions exist persisted
assertTrue(contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(_servlet._id));
@@ -370,6 +370,8 @@ public class CreationTest
{
session = request.getSession(false);
assertNotNull(session);
+ assertEquals(_id, session.getId());
+ assertNotNull(session.getAttribute("value"));
assertNull(session.getAttribute("B")); //check we don't see stuff from other context
}
diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/DirtyAttributeTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/DirtyAttributeTest.java
index 6a61867335b..414327c96f2 100644
--- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/DirtyAttributeTest.java
+++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/DirtyAttributeTest.java
@@ -167,6 +167,7 @@ public class DirtyAttributeTest
/**
* @see javax.servlet.http.HttpSessionActivationListener#sessionWillPassivate(javax.servlet.http.HttpSessionEvent)
*/
+ @Override
public void sessionWillPassivate(HttpSessionEvent se)
{
++passivates;
@@ -175,6 +176,7 @@ public class DirtyAttributeTest
/**
* @see javax.servlet.http.HttpSessionActivationListener#sessionDidActivate(javax.servlet.http.HttpSessionEvent)
*/
+ @Override
public void sessionDidActivate(HttpSessionEvent se)
{
++activates;
@@ -204,6 +206,7 @@ public class DirtyAttributeTest
/**
* @see javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)
*/
+ @Override
public void valueBound(HttpSessionBindingEvent event)
{
++binds;
@@ -212,6 +215,7 @@ public class DirtyAttributeTest
/**
* @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
*/
+ @Override
public void valueUnbound(HttpSessionBindingEvent event)
{
++unbinds;
diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/RemoveSessionTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/RemoveSessionTest.java
index d4eafc0f67f..7e1b47f1238 100644
--- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/RemoveSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/RemoveSessionTest.java
@@ -121,6 +121,7 @@ public class RemoveSessionTest
}
public static class TestServlet extends HttpServlet
{
+ @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String action = request.getParameter("action");
@@ -149,11 +150,13 @@ public class RemoveSessionTest
boolean wasCreated;
boolean wasDestroyed;
+ @Override
public void sessionCreated(HttpSessionEvent se)
{
wasCreated = true;
}
+ @Override
public void sessionDestroyed(HttpSessionEvent se)
{
wasDestroyed = true;
diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SameNodeLoadTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SameNodeLoadTest.java
index 824746851e3..ec13b65484c 100644
--- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SameNodeLoadTest.java
+++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SameNodeLoadTest.java
@@ -152,6 +152,7 @@ public class SameNodeLoadTest
}
+ @Override
public void run()
{
try
diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SaveOptimizeTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SaveOptimizeTest.java
index 4265204acd7..4e51832572f 100644
--- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SaveOptimizeTest.java
+++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SaveOptimizeTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.util.concurrent.TimeUnit;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -532,7 +533,7 @@ public class SaveOptimizeTest
{
HttpSession session = request.getSession(false);
assertNotNull(session);
- session.setAttribute("ttt", new Long(System.currentTimeMillis()));
+ session.setAttribute("ttt", new Long(TimeUnit.NANOSECONDS.toMillis(System.nanoTime())));
}
else if ("max".equalsIgnoreCase(action))
{
diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SessionListenerTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SessionListenerTest.java
index 1a037dc59e1..21352f10651 100644
--- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SessionListenerTest.java
+++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/SessionListenerTest.java
@@ -52,11 +52,13 @@ public class SessionListenerTest
boolean unbound = false;
boolean bound = false;
+ @Override
public void valueUnbound(HttpSessionBindingEvent event)
{
unbound = true;
}
+ @Override
public void valueBound(HttpSessionBindingEvent event)
{
bound = true;
diff --git a/tests/test-webapps/test-http2-webapp/pom.xml b/tests/test-webapps/test-http2-webapp/pom.xml
index b4599ad6c5b..4906d0c07f1 100644
--- a/tests/test-webapps/test-http2-webapp/pom.xml
+++ b/tests/test-webapps/test-http2-webapp/pom.xml
@@ -42,6 +42,7 @@
+ org.apache.maven.pluginsmaven-failsafe-plugin
@@ -88,6 +89,7 @@
+ org.apache.maven.pluginsmaven-failsafe-plugin-Xbootclasspath/p:${project.build.directory}/alpn/alpn-boot-${alpn.version}.jar
diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/ChatServlet.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/ChatServlet.java
index 651e75fdf5c..3f3283158a6 100644
--- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/ChatServlet.java
+++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/ChatServlet.java
@@ -46,6 +46,7 @@ public class ChatServlet extends HttpServlet
private long asyncTimeout = 10000;
+ @Override
public void init()
{
String parameter = getServletConfig().getInitParameter("asyncTimeout");
diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Date2Tag.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Date2Tag.java
index 3387a4c1e8a..e377b9c4a97 100644
--- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Date2Tag.java
+++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Date2Tag.java
@@ -36,6 +36,7 @@ public class Date2Tag extends SimpleTagSupport
this.format = value;
}
+ @Override
public void doTag() throws JspException, IOException {
String formatted =
new SimpleDateFormat("long".equals(format)?"EEE 'the' d:MMM:yyyy":"d:MM:yy")
diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DateTag.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DateTag.java
index 21e74516446..c0286c2f2ed 100644
--- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DateTag.java
+++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DateTag.java
@@ -36,19 +36,27 @@ public class DateTag extends BodyTagSupport
BodyContent body;
String tz="GMT";
+ @Override
public void setParent(Tag parent) {this.parent=parent;}
+ @Override
public Tag getParent() {return parent;}
+ @Override
public void setBodyContent(BodyContent content) {body=content;}
+ @Override
public void setPageContext(PageContext pageContext) {}
public void setTz(String value) {tz=value;}
+ @Override
public int doStartTag() throws JspException {return EVAL_BODY_BUFFERED;}
+ @Override
public int doEndTag() throws JspException {return EVAL_PAGE;}
+ @Override
public void doInitBody() throws JspException {}
+ @Override
public int doAfterBody() throws JspException {
try
{
@@ -63,6 +71,7 @@ public class DateTag extends BodyTagSupport
}
}
+ @Override
public void release()
{
body=null;
diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/TagListener.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/TagListener.java
index 2b6d9f0152c..f8204ac0224 100644
--- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/TagListener.java
+++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/TagListener.java
@@ -34,86 +34,103 @@ import javax.servlet.http.HttpSessionListener;
public class TagListener implements HttpSessionListener, HttpSessionAttributeListener, HttpSessionActivationListener, ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener
{
+ @Override
public void attributeAdded(HttpSessionBindingEvent se)
{
//System.err.println("tagListener: attributedAdded "+se);
}
+ @Override
public void attributeRemoved(HttpSessionBindingEvent se)
{
//System.err.println("tagListener: attributeRemoved "+se);
}
+ @Override
public void attributeReplaced(HttpSessionBindingEvent se)
{
//System.err.println("tagListener: attributeReplaced "+se);
}
+ @Override
public void sessionWillPassivate(HttpSessionEvent se)
{
//System.err.println("tagListener: sessionWillPassivate "+se);
}
+ @Override
public void sessionDidActivate(HttpSessionEvent se)
{
//System.err.println("tagListener: sessionDidActivate "+se);
}
+ @Override
public void contextInitialized(ServletContextEvent sce)
{
//System.err.println("tagListener: contextInitialized "+sce);
}
+ @Override
public void contextDestroyed(ServletContextEvent sce)
{
//System.err.println("tagListener: contextDestroyed "+sce);
}
+ @Override
public void attributeAdded(ServletContextAttributeEvent scab)
{
//System.err.println("tagListener: attributeAdded "+scab);
}
+ @Override
public void attributeRemoved(ServletContextAttributeEvent scab)
{
//System.err.println("tagListener: attributeRemoved "+scab);
}
+ @Override
public void attributeReplaced(ServletContextAttributeEvent scab)
{
//System.err.println("tagListener: attributeReplaced "+scab);
}
+ @Override
public void requestDestroyed(ServletRequestEvent sre)
{
//System.err.println("tagListener: requestDestroyed "+sre);
}
+ @Override
public void requestInitialized(ServletRequestEvent sre)
{
//System.err.println("tagListener: requestInitialized "+sre);
}
+ @Override
public void attributeAdded(ServletRequestAttributeEvent srae)
{
//System.err.println("tagListener: attributeAdded "+srae);
}
+ @Override
public void attributeRemoved(ServletRequestAttributeEvent srae)
{
//System.err.println("tagListener: attributeRemoved "+srae);
}
+ @Override
public void attributeReplaced(ServletRequestAttributeEvent srae)
{
//System.err.println("tagListener: attributeReplaced "+srae);
}
+ @Override
public void sessionCreated(HttpSessionEvent se)
{
//System.err.println("tagListener: sessionCreated "+se);
}
+ @Override
public void sessionDestroyed(HttpSessionEvent se)
{
//System.err.println("tagListener: sessionDestroyed "+se);
diff --git a/tests/test-webapps/test-jndi-webapp/src/main/java/com/acme/JNDITest.java b/tests/test-webapps/test-jndi-webapp/src/main/java/com/acme/JNDITest.java
index c27cb8ad870..166ca2cf1e8 100644
--- a/tests/test-webapps/test-jndi-webapp/src/main/java/com/acme/JNDITest.java
+++ b/tests/test-webapps/test-jndi-webapp/src/main/java/com/acme/JNDITest.java
@@ -81,6 +81,7 @@ public class JNDITest extends HttpServlet
}
+ @Override
public void init(ServletConfig config) throws ServletException
{
super.init(config);
@@ -105,12 +106,14 @@ public class JNDITest extends HttpServlet
/* ------------------------------------------------------------ */
+ @Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
}
/* ------------------------------------------------------------ */
+ @Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String mailTo = request.getParameter("mailto");
@@ -154,6 +157,7 @@ public class JNDITest extends HttpServlet
+ @Override
public void destroy ()
{
}
diff --git a/tests/test-webapps/test-mock-resources/src/main/java/com/acme/MockDataSource.java b/tests/test-webapps/test-mock-resources/src/main/java/com/acme/MockDataSource.java
index f7a26c1c6a8..8c85947792a 100644
--- a/tests/test-webapps/test-mock-resources/src/main/java/com/acme/MockDataSource.java
+++ b/tests/test-webapps/test-mock-resources/src/main/java/com/acme/MockDataSource.java
@@ -36,6 +36,7 @@ public class MockDataSource implements DataSource
/**
* NOTE: JDK7+ new feature
*/
+ @Override
public Logger getParentLogger()
{
return null;
@@ -44,6 +45,7 @@ public class MockDataSource implements DataSource
/**
* @see javax.sql.DataSource#getConnection()
*/
+ @Override
public Connection getConnection() throws SQLException
{
return null;
@@ -52,6 +54,7 @@ public class MockDataSource implements DataSource
/**
* @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
*/
+ @Override
public Connection getConnection(String username, String password)
throws SQLException
{
@@ -61,6 +64,7 @@ public class MockDataSource implements DataSource
/**
* @see javax.sql.DataSource#getLogWriter()
*/
+ @Override
public PrintWriter getLogWriter() throws SQLException
{
return null;
@@ -69,6 +73,7 @@ public class MockDataSource implements DataSource
/**
* @see javax.sql.DataSource#getLoginTimeout()
*/
+ @Override
public int getLoginTimeout() throws SQLException
{
return 0;
@@ -77,6 +82,7 @@ public class MockDataSource implements DataSource
/**
* @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter)
*/
+ @Override
public void setLogWriter(PrintWriter out) throws SQLException
{
}
@@ -84,15 +90,18 @@ public class MockDataSource implements DataSource
/**
* @see javax.sql.DataSource#setLoginTimeout(int)
*/
+ @Override
public void setLoginTimeout(int seconds) throws SQLException
{
}
+ @Override
public boolean isWrapperFor(Class> iface) throws SQLException
{
return false;
}
+ @Override
public T unwrap(Class iface) throws SQLException
{
return null;
diff --git a/tests/test-webapps/test-mock-resources/src/main/java/com/acme/MockUserTransaction.java b/tests/test-webapps/test-mock-resources/src/main/java/com/acme/MockUserTransaction.java
index 4adfb794250..6721d275815 100644
--- a/tests/test-webapps/test-mock-resources/src/main/java/com/acme/MockUserTransaction.java
+++ b/tests/test-webapps/test-mock-resources/src/main/java/com/acme/MockUserTransaction.java
@@ -36,6 +36,7 @@ public class MockUserTransaction implements UserTransaction
/**
* @see javax.transaction.UserTransaction#begin()
*/
+ @Override
public void begin() throws NotSupportedException, SystemException
{
}
@@ -43,6 +44,7 @@ public class MockUserTransaction implements UserTransaction
/**
* @see javax.transaction.UserTransaction#commit()
*/
+ @Override
public void commit() throws HeuristicMixedException,
HeuristicRollbackException, IllegalStateException,
RollbackException, SecurityException, SystemException
@@ -52,6 +54,7 @@ public class MockUserTransaction implements UserTransaction
/**
* @see javax.transaction.UserTransaction#getStatus()
*/
+ @Override
public int getStatus() throws SystemException
{
return 0;
@@ -60,6 +63,7 @@ public class MockUserTransaction implements UserTransaction
/**
* @see javax.transaction.UserTransaction#rollback()
*/
+ @Override
public void rollback() throws IllegalStateException, SecurityException,
SystemException
{
@@ -68,6 +72,7 @@ public class MockUserTransaction implements UserTransaction
/**
* @see javax.transaction.UserTransaction#setRollbackOnly()
*/
+ @Override
public void setRollbackOnly() throws IllegalStateException, SystemException
{
}
@@ -75,6 +80,7 @@ public class MockUserTransaction implements UserTransaction
/**
* @see javax.transaction.UserTransaction#setTransactionTimeout(int)
*/
+ @Override
public void setTransactionTimeout(int arg0) throws SystemException
{
}
diff --git a/tests/test-webapps/test-servlet-spec/test-container-initializer/src/main/java/com/acme/initializer/FooInitializer.java b/tests/test-webapps/test-servlet-spec/test-container-initializer/src/main/java/com/acme/initializer/FooInitializer.java
index 19c6a065ae0..11aec5063b3 100644
--- a/tests/test-webapps/test-servlet-spec/test-container-initializer/src/main/java/com/acme/initializer/FooInitializer.java
+++ b/tests/test-webapps/test-servlet-spec/test-container-initializer/src/main/java/com/acme/initializer/FooInitializer.java
@@ -92,6 +92,7 @@ public class FooInitializer implements ServletContainerInitializer
}
}
+ @Override
public void onStartup(Set> classes, ServletContext context)
{
context.setAttribute("com.acme.Foo", new ArrayList(classes));
diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotatedListener.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotatedListener.java
index 159b921c361..acbeba73d51 100644
--- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotatedListener.java
+++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotatedListener.java
@@ -43,86 +43,103 @@ public class AnnotatedListener implements HttpSessionListener, HttpSessionAttri
@Resource(mappedName="maxAmount")
private Double maxAmount;
+ @Override
public void attributeAdded(HttpSessionBindingEvent se)
{
// System.err.println("attributedAdded "+se);
}
+ @Override
public void attributeRemoved(HttpSessionBindingEvent se)
{
// System.err.println("attributeRemoved "+se);
}
+ @Override
public void attributeReplaced(HttpSessionBindingEvent se)
{
// System.err.println("attributeReplaced "+se);
}
+ @Override
public void sessionWillPassivate(HttpSessionEvent se)
{
// System.err.println("sessionWillPassivate "+se);
}
+ @Override
public void sessionDidActivate(HttpSessionEvent se)
{
// System.err.println("sessionDidActivate "+se);
}
+ @Override
public void contextInitialized(ServletContextEvent sce)
{
sce.getServletContext().setAttribute("com.acme.AnnotationTest.sclInjectWebListenerTest", Boolean.valueOf(maxAmount!=null));
}
+ @Override
public void contextDestroyed(ServletContextEvent sce)
{
// System.err.println("contextDestroyed "+sce);
}
+ @Override
public void attributeAdded(ServletContextAttributeEvent scab)
{
// System.err.println("attributeAdded "+scab);
}
+ @Override
public void attributeRemoved(ServletContextAttributeEvent scab)
{
// System.err.println("attributeRemoved "+scab);
}
+ @Override
public void attributeReplaced(ServletContextAttributeEvent scab)
{
// System.err.println("attributeReplaced "+scab);
}
+ @Override
public void requestDestroyed(ServletRequestEvent sre)
{
// System.err.println("requestDestroyed "+sre);
}
+ @Override
public void requestInitialized(ServletRequestEvent sre)
{
// System.err.println("requestInitialized "+sre);
}
+ @Override
public void attributeAdded(ServletRequestAttributeEvent srae)
{
// System.err.println("attributeAdded "+srae);
}
+ @Override
public void attributeRemoved(ServletRequestAttributeEvent srae)
{
// System.err.println("attributeRemoved "+srae);
}
+ @Override
public void attributeReplaced(ServletRequestAttributeEvent srae)
{
// System.err.println("attributeReplaced "+srae);
}
+ @Override
public void sessionCreated(HttpSessionEvent se)
{
// System.err.println("sessionCreated "+se);
}
+ @Override
public void sessionDestroyed(HttpSessionEvent se)
{
// System.err.println("sessionDestroyed "+se);
diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotationTest.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotationTest.java
index f28e04f8a64..21355401674 100644
--- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotationTest.java
+++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotationTest.java
@@ -167,6 +167,7 @@ public class AnnotationTest extends HttpServlet
{
}
+ @Override
public void init(ServletConfig config) throws ServletException
{
super.init(config);
@@ -176,12 +177,14 @@ public class AnnotationTest extends HttpServlet
/* ------------------------------------------------------------ */
+ @Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
}
/* ------------------------------------------------------------ */
+ @Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try
diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AsyncListenerServlet.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AsyncListenerServlet.java
index 3cae0a81391..86e1b3eb43b 100644
--- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AsyncListenerServlet.java
+++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AsyncListenerServlet.java
@@ -90,6 +90,7 @@ public class AsyncListenerServlet extends HttpServlet
}
+ @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java
index 4fb60cc1ea4..8c351b77f85 100644
--- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java
+++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java
@@ -45,6 +45,7 @@ public class MultiPartTest extends HttpServlet
private ServletConfig config;
+ @Override
public void init(ServletConfig config) throws ServletException
{
super.init(config);
@@ -54,6 +55,7 @@ public class MultiPartTest extends HttpServlet
/* ------------------------------------------------------------ */
+ @Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
@@ -95,6 +97,7 @@ public class MultiPartTest extends HttpServlet
}
/* ------------------------------------------------------------ */
+ @Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try
diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/RoleAnnotationTest.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/RoleAnnotationTest.java
index 93dacf0f337..75b916805ff 100644
--- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/RoleAnnotationTest.java
+++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/RoleAnnotationTest.java
@@ -42,6 +42,7 @@ public class RoleAnnotationTest extends HttpServlet
{
private ServletConfig _config;
+ @Override
public void init(ServletConfig config) throws ServletException
{
super.init(config);
@@ -51,12 +52,14 @@ public class RoleAnnotationTest extends HttpServlet
/* ------------------------------------------------------------ */
+ @Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
}
/* ------------------------------------------------------------ */
+ @Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try
diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/SecuredServlet.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/SecuredServlet.java
index 81972a60ceb..766cd709e21 100644
--- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/SecuredServlet.java
+++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/SecuredServlet.java
@@ -35,6 +35,7 @@ public class SecuredServlet extends HttpServlet
{
+ @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/TestListener.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/TestListener.java
index ceabd966b41..eb48aa0f218 100644
--- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/TestListener.java
+++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/TestListener.java
@@ -84,31 +84,37 @@ public class TestListener implements HttpSessionListener, HttpSessionAttributeL
+ @Override
public void attributeAdded(HttpSessionBindingEvent se)
{
// System.err.println("attributedAdded "+se);
}
+ @Override
public void attributeRemoved(HttpSessionBindingEvent se)
{
// System.err.println("attributeRemoved "+se);
}
+ @Override
public void attributeReplaced(HttpSessionBindingEvent se)
{
// System.err.println("attributeReplaced "+se);
}
+ @Override
public void sessionWillPassivate(HttpSessionEvent se)
{
// System.err.println("sessionWillPassivate "+se);
}
+ @Override
public void sessionDidActivate(HttpSessionEvent se)
{
// System.err.println("sessionDidActivate "+se);
}
+ @Override
public void contextInitialized(ServletContextEvent sce)
{
sce.getServletContext().setAttribute("com.acme.AnnotationTest.sclInjectTest", Boolean.valueOf(maxAmount != null));
@@ -156,56 +162,67 @@ public class TestListener implements HttpSessionListener, HttpSessionAttributeL
}
}
+ @Override
public void contextDestroyed(ServletContextEvent sce)
{
// System.err.println("contextDestroyed "+sce);
}
+ @Override
public void attributeAdded(ServletContextAttributeEvent scab)
{
// System.err.println("attributeAdded "+scab);
}
+ @Override
public void attributeRemoved(ServletContextAttributeEvent scab)
{
// System.err.println("attributeRemoved "+scab);
}
+ @Override
public void attributeReplaced(ServletContextAttributeEvent scab)
{
// System.err.println("attributeReplaced "+scab);
}
+ @Override
public void requestDestroyed(ServletRequestEvent sre)
{
// System.err.println("requestDestroyed "+sre);
}
+ @Override
public void requestInitialized(ServletRequestEvent sre)
{
// System.err.println("requestInitialized "+sre);
}
+ @Override
public void attributeAdded(ServletRequestAttributeEvent srae)
{
// System.err.println("attributeAdded "+srae);
}
+ @Override
public void attributeRemoved(ServletRequestAttributeEvent srae)
{
// System.err.println("attributeRemoved "+srae);
}
+ @Override
public void attributeReplaced(ServletRequestAttributeEvent srae)
{
// System.err.println("attributeReplaced "+srae);
}
+ @Override
public void sessionCreated(HttpSessionEvent se)
{
// System.err.println("sessionCreated "+se);
}
+ @Override
public void sessionDestroyed(HttpSessionEvent se)
{
// System.err.println("sessionDestroyed "+se);
diff --git a/tests/test-webapps/test-servlet-spec/test-web-fragment/src/main/java/com/acme/fragment/FragmentServlet.java b/tests/test-webapps/test-servlet-spec/test-web-fragment/src/main/java/com/acme/fragment/FragmentServlet.java
index 03fabd6eb34..d15624d7ed3 100644
--- a/tests/test-webapps/test-servlet-spec/test-web-fragment/src/main/java/com/acme/fragment/FragmentServlet.java
+++ b/tests/test-webapps/test-servlet-spec/test-web-fragment/src/main/java/com/acme/fragment/FragmentServlet.java
@@ -38,6 +38,7 @@ public class FragmentServlet extends HttpServlet
private ServletConfig config;
+ @Override
public void init(ServletConfig config) throws ServletException
{
super.init(config);
@@ -47,12 +48,14 @@ public class FragmentServlet extends HttpServlet
/* ------------------------------------------------------------ */
+ @Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
}
/* ------------------------------------------------------------ */
+ @Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try
diff --git a/tests/test-webapps/test-webapp-rfc2616/src/main/java/org/eclipse/jetty/tests/webapp/HttpMethodsServlet.java b/tests/test-webapps/test-webapp-rfc2616/src/main/java/org/eclipse/jetty/tests/webapp/HttpMethodsServlet.java
index b7ea90ae787..f77c2de6514 100644
--- a/tests/test-webapps/test-webapp-rfc2616/src/main/java/org/eclipse/jetty/tests/webapp/HttpMethodsServlet.java
+++ b/tests/test-webapps/test-webapp-rfc2616/src/main/java/org/eclipse/jetty/tests/webapp/HttpMethodsServlet.java
@@ -48,6 +48,7 @@ public class HttpMethodsServlet extends HttpServlet
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
+ @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
/* do nothing */
@@ -57,6 +58,7 @@ public class HttpMethodsServlet extends HttpServlet
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
+ @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
/* do nothing */
@@ -65,6 +67,7 @@ public class HttpMethodsServlet extends HttpServlet
/**
* @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)
*/
+ @Override
protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
/* do nothing */
@@ -73,6 +76,7 @@ public class HttpMethodsServlet extends HttpServlet
/**
* @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)
*/
+ @Override
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
/* do nothing */
@@ -81,6 +85,7 @@ public class HttpMethodsServlet extends HttpServlet
/**
* @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)
*/
+ @Override
protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
/* do nothing */
@@ -89,6 +94,7 @@ public class HttpMethodsServlet extends HttpServlet
/**
* @see HttpServlet#doTrace(HttpServletRequest, HttpServletResponse)
*/
+ @Override
protected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.addHeader("Content-Type","message/http");