diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_40.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_40.mod index bee4693e8ac..45bbad75c9f 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_40.mod +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_40.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar:lib/alpn/alpn-boot-7.0.0.v20140317.jar +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar [exec] -Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_45.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_45.mod index bee4693e8ac..45bbad75c9f 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_45.mod +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_45.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar:lib/alpn/alpn-boot-7.0.0.v20140317.jar +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar [exec] -Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_51.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_51.mod index bee4693e8ac..45bbad75c9f 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_51.mod +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_51.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar:lib/alpn/alpn-boot-7.0.0.v20140317.jar +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar [exec] -Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_55.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_55.mod index bee4693e8ac..45bbad75c9f 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_55.mod +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_55.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar:lib/alpn/alpn-boot-7.0.0.v20140317.jar +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar [exec] -Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0.mod index 4089153ac14..65e6cb3c4db 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0.mod +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.0.0.v20140317/alpn-boot-8.0.0.v20140317.jar:lib/alpn/alpn-boot-8.0.0.v20140317.jar +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.0.0.v20140317/alpn-boot-8.0.0.v20140317.jar|lib/alpn/alpn-boot-8.0.0.v20140317.jar [exec] -Xbootclasspath/p:lib/alpn/alpn-boot-8.0.0.v20140317.jar diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_05.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_05.mod index 4089153ac14..65e6cb3c4db 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_05.mod +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_05.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.0.0.v20140317/alpn-boot-8.0.0.v20140317.jar:lib/alpn/alpn-boot-8.0.0.v20140317.jar +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.0.0.v20140317/alpn-boot-8.0.0.v20140317.jar|lib/alpn/alpn-boot-8.0.0.v20140317.jar [exec] -Xbootclasspath/p:lib/alpn/alpn-boot-8.0.0.v20140317.jar diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationDecorator.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationDecorator.java index c6b9cd5d3ed..e87ce1fd885 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationDecorator.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationDecorator.java @@ -28,12 +28,17 @@ import org.eclipse.jetty.webapp.WebAppContext; */ public class AnnotationDecorator implements Decorator { - AnnotationIntrospector _introspector = new AnnotationIntrospector(); + protected AnnotationIntrospector _introspector = new AnnotationIntrospector(); /** * @param context */ public AnnotationDecorator(WebAppContext context) + { + registerHandlers(context); + } + + public void registerHandlers (WebAppContext context) { _introspector.registerHandler(new ResourceAnnotationHandler(context)); _introspector.registerHandler(new ResourcesAnnotationHandler(context)); diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java index 1a1459a45a0..8b732d4d2b3 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java @@ -24,13 +24,13 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.http.HttpServletRequest; -import org.eclipse.jetty.server.session.AbstractSession; +import org.eclipse.jetty.server.session.MemSession; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ -public class NoSqlSession extends AbstractSession +public class NoSqlSession extends MemSession { private final static Logger __log = Log.getLogger("org.eclipse.jetty.server.session"); diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java index 424a98869e8..09bb4ccdbd0 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java @@ -60,12 +60,12 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor { try { - registerVisitor("env-entry", getClass().getDeclaredMethod("visitEnvEntry", __signature)); - registerVisitor("resource-ref", getClass().getDeclaredMethod("visitResourceRef", __signature)); - registerVisitor("resource-env-ref", getClass().getDeclaredMethod("visitResourceEnvRef", __signature)); - registerVisitor("message-destination-ref", getClass().getDeclaredMethod("visitMessageDestinationRef", __signature)); - registerVisitor("post-construct", getClass().getDeclaredMethod("visitPostConstruct", __signature)); - registerVisitor("pre-destroy", getClass().getDeclaredMethod("visitPreDestroy", __signature)); + registerVisitor("env-entry", getClass().getMethod("visitEnvEntry", __signature)); + registerVisitor("resource-ref", getClass().getMethod("visitResourceRef", __signature)); + registerVisitor("resource-env-ref", getClass().getMethod("visitResourceEnvRef", __signature)); + registerVisitor("message-destination-ref", getClass().getMethod("visitMessageDestinationRef", __signature)); + registerVisitor("post-construct", getClass().getMethod("visitPostConstruct", __signature)); + registerVisitor("pre-destroy", getClass().getMethod("visitPreDestroy", __signature)); } catch (Exception e) { diff --git a/jetty-quickstart/pom.xml b/jetty-quickstart/pom.xml index 94f7a1d7a9e..2a08a0b9a12 100644 --- a/jetty-quickstart/pom.xml +++ b/jetty-quickstart/pom.xml @@ -41,11 +41,13 @@ org.eclipse.jetty.tests test-mock-resources ${project.version} + test org.eclipse.jetty.orbit javax.mail.glassfish 1.4.1.v201005082020 + test org.eclipse.jetty diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureDescriptorProcessor.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureDescriptorProcessor.java index 627277e2ebf..d49bc0c3c29 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureDescriptorProcessor.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureDescriptorProcessor.java @@ -45,11 +45,11 @@ public class PreconfigureDescriptorProcessor extends IterativeDescriptorProcesso _showOrigin=LOG.isDebugEnabled(); try { - registerVisitor("env-entry", getClass().getDeclaredMethod("saveSnippet", __signature)); - registerVisitor("resource-ref", getClass().getDeclaredMethod("saveSnippet", __signature)); - registerVisitor("resource-env-ref", getClass().getDeclaredMethod("saveSnippet", __signature)); - registerVisitor("message-destination-ref", getClass().getDeclaredMethod("saveSnippet", __signature)); - registerVisitor("data-source", getClass().getDeclaredMethod("saveSnippet", __signature)); + registerVisitor("env-entry", getClass().getMethod("saveSnippet", __signature)); + registerVisitor("resource-ref", getClass().getMethod("saveSnippet", __signature)); + registerVisitor("resource-env-ref", getClass().getMethod("saveSnippet", __signature)); + registerVisitor("message-destination-ref", getClass().getMethod("saveSnippet", __signature)); + registerVisitor("data-source", getClass().getMethod("saveSnippet", __signature)); } catch (Exception e) { diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorProcessor.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorProcessor.java index 7e5a6c849b9..f63d2381a3f 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorProcessor.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorProcessor.java @@ -51,7 +51,7 @@ public class QuickStartDescriptorProcessor extends IterativeDescriptorProcessor { try { - registerVisitor("context-param", this.getClass().getDeclaredMethod("visitContextParam", __signature)); + registerVisitor("context-param", this.getClass().getMethod("visitContextParam", __signature)); } catch (Exception e) { diff --git a/jetty-server/src/main/config/modules/resources.mod b/jetty-server/src/main/config/modules/resources.mod index b3a4d2d74f6..8647d81325b 100644 --- a/jetty-server/src/main/config/modules/resources.mod +++ b/jetty-server/src/main/config/modules/resources.mod @@ -3,7 +3,7 @@ # [lib] -resources +resources/ [files] resources/ diff --git a/jetty-server/src/main/config/modules/ssl.mod b/jetty-server/src/main/config/modules/ssl.mod index c8270951a68..449f58104fb 100644 --- a/jetty-server/src/main/config/modules/ssl.mod +++ b/jetty-server/src/main/config/modules/ssl.mod @@ -9,7 +9,7 @@ server etc/jetty-ssl.xml [files] -http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore:etc/keystore +http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore|etc/keystore [ini-template] ## SSL Keystore Configuration diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java index cb1479f54a0..809d9d98923 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java @@ -21,8 +21,6 @@ package org.eclipse.jetty.server.session; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -54,7 +52,6 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI private String _clusterId; // ID without any node (ie "worker") id appended private String _nodeId; // ID of session with node(ie "worker") id appended private final AbstractSessionManager _manager; - private final Map _attributes=new HashMap(); private boolean _idChanged; private final long _created; private long _cookieSet; @@ -139,53 +136,21 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI } /* ------------------------------------------------------------- */ - public Map getAttributeMap() - { - return _attributes; - } + public abstract Map getAttributeMap(); + + + + /* ------------------------------------------------------------ */ - @Override - public Object getAttribute(String name) - { - synchronized (this) - { - checkValid(); - return _attributes.get(name); - } - } + public abstract int getAttributes(); + + + /* ------------------------------------------------------------ */ - public int getAttributes() - { - synchronized (this) - { - checkValid(); - return _attributes.size(); - } - } - - /* ------------------------------------------------------------ */ - @SuppressWarnings({ "unchecked" }) - @Override - public Enumeration getAttributeNames() - { - synchronized (this) - { - checkValid(); - List names=_attributes==null?Collections.EMPTY_LIST:new ArrayList(_attributes.keySet()); - return Collections.enumeration(names); - } - } - - /* ------------------------------------------------------------ */ - public Set getNames() - { - synchronized (this) - { - return new HashSet(_attributes.keySet()); - } - } + public abstract Set getNames(); + /* ------------------------------------------------------------- */ public long getCookieSetTime() @@ -272,25 +237,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI return getAttribute(name); } - /* ------------------------------------------------------------- */ - /** - * @deprecated As of Version 2.2, this method is replaced by - * {@link #getAttributeNames} - */ - @Deprecated - @Override - public String[] getValueNames() throws IllegalStateException - { - synchronized(this) - { - checkValid(); - if (_attributes==null) - return new String[0]; - String[] a=new String[_attributes.size()]; - return (String[])_attributes.keySet().toArray(a); - } - } - + /* ------------------------------------------------------------ */ public void renewId(HttpServletRequest request) @@ -403,34 +350,8 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI } /* ------------------------------------------------------------- */ - public void clearAttributes() - { - while (_attributes!=null && _attributes.size()>0) - { - ArrayList keys; - synchronized(this) - { - keys=new ArrayList(_attributes.keySet()); - } - - Iterator iter=keys.iterator(); - while (iter.hasNext()) - { - String key=(String)iter.next(); - - Object value; - synchronized(this) - { - value=doPutOrRemove(key,null); - } - unbindValue(key,value); - - _manager.doSessionAttributeListeners(this,key,value,null); - } - } - if (_attributes!=null) - _attributes.clear(); - } + public abstract void clearAttributes(); + /* ------------------------------------------------------------- */ public boolean isIdChanged() @@ -476,18 +397,65 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI { removeAttribute(name); } + + /* ------------------------------------------------------------ */ + @SuppressWarnings({ "unchecked" }) + @Override + public Enumeration getAttributeNames() + { + synchronized (this) + { + checkValid(); + return doGetAttributeNames(); + } + } + + /* ------------------------------------------------------------- */ + /** + * @deprecated As of Version 2.2, this method is replaced by + * {@link #getAttributeNames} + */ + @Deprecated + @Override + public String[] getValueNames() throws IllegalStateException + { + synchronized(this) + { + checkValid(); + Enumeration anames = doGetAttributeNames(); + if (anames == null) + return new String[0]; + ArrayList names = new ArrayList(); + while (anames.hasMoreElements()) + names.add(anames.nextElement()); + return names.toArray(new String[names.size()]); + } + } + /* ------------------------------------------------------------ */ - protected Object doPutOrRemove(String name, Object value) - { - return value==null?_attributes.remove(name):_attributes.put(name,value); - } + public abstract Object doPutOrRemove(String name, Object value); + /* ------------------------------------------------------------ */ - protected Object doGet(String name) + public abstract Object doGet(String name); + + + /* ------------------------------------------------------------ */ + public abstract Enumeration doGetAttributeNames(); + + + /* ------------------------------------------------------------ */ + @Override + public Object getAttribute(String name) { - return _attributes.get(name); + synchronized (this) + { + checkValid(); + return doGet(name); + } } + /* ------------------------------------------------------------ */ @Override @@ -571,12 +539,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI _manager.doSessionAttributeListeners(this,name,oldValue,newValue); } } - - /* ------------------------------------------------------------ */ - protected void addAttributes(Map map) - { - _attributes.putAll(map); - } + /* ------------------------------------------------------------- */ public void setIdChanged(boolean changed) @@ -653,7 +616,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI synchronized(this) { HttpSessionEvent event = new HttpSessionEvent(this); - for (Iterator iter = _attributes.values().iterator(); iter.hasNext();) + for (Iterator iter = getAttributeMap().values().iterator(); iter.hasNext();) { Object value = iter.next(); if (value instanceof HttpSessionActivationListener) @@ -671,7 +634,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI synchronized(this) { HttpSessionEvent event = new HttpSessionEvent(this); - for (Iterator iter = _attributes.values().iterator(); iter.hasNext();) + for (Iterator iter = getAttributeMap().values().iterator(); iter.hasNext();) { Object value = iter.next(); if (value instanceof HttpSessionActivationListener) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java index dc599cc5dc2..d36e4277e49 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java @@ -34,7 +34,7 @@ import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -public class HashedSession extends AbstractSession +public class HashedSession extends MemSession { private static final Logger LOG = Log.getLogger(HashedSession.class); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java index 4b6804669b8..dbe95335dae 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java @@ -88,7 +88,7 @@ public class JDBCSessionManager extends AbstractSessionManager * * Session instance. */ - public class Session extends AbstractSession + public class Session extends MemSession { private static final long serialVersionUID = 5208464051134226143L; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/MemSession.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/MemSession.java new file mode 100644 index 00000000000..72dbea8fa8a --- /dev/null +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/MemSession.java @@ -0,0 +1,146 @@ +// +// ======================================================================== +// Copyright (c) 1995-2014 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.server.session; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + + +/** + * MemSession + * + * A session whose data is kept in memory + */ +public class MemSession extends AbstractSession +{ + + private final Map _attributes=new HashMap(); + + protected MemSession(AbstractSessionManager abstractSessionManager, HttpServletRequest request) + { + super(abstractSessionManager, request); + } + + public MemSession(AbstractSessionManager abstractSessionManager, long created, long accessed, String clusterId) + { + super(abstractSessionManager, created, accessed, clusterId); + } + + + /* ------------------------------------------------------------- */ + @Override + public Map getAttributeMap() + { + return _attributes; + } + + + /* ------------------------------------------------------------ */ + @Override + public int getAttributes() + { + synchronized (this) + { + checkValid(); + return _attributes.size(); + } + } + + /* ------------------------------------------------------------ */ + @SuppressWarnings({ "unchecked" }) + @Override + public Enumeration doGetAttributeNames() + { + List names=_attributes==null?Collections.EMPTY_LIST:new ArrayList(_attributes.keySet()); + return Collections.enumeration(names); + } + + + /* ------------------------------------------------------------ */ + @Override + public Set getNames() + { + synchronized (this) + { + return new HashSet(_attributes.keySet()); + } + } + + + /* ------------------------------------------------------------- */ + @Override + public void clearAttributes() + { + while (_attributes!=null && _attributes.size()>0) + { + ArrayList keys; + synchronized(this) + { + keys=new ArrayList(_attributes.keySet()); + } + + Iterator iter=keys.iterator(); + while (iter.hasNext()) + { + String key=(String)iter.next(); + + Object value; + synchronized(this) + { + value=doPutOrRemove(key,null); + } + unbindValue(key,value); + + ((AbstractSessionManager)getSessionManager()).doSessionAttributeListeners(this,key,value,null); + } + } + if (_attributes!=null) + _attributes.clear(); + } + + /* ------------------------------------------------------------ */ + public void addAttributes(Map map) + { + _attributes.putAll(map); + } + + /* ------------------------------------------------------------ */ + @Override + public Object doPutOrRemove(String name, Object value) + { + return value==null?_attributes.remove(name):_attributes.put(name,value); + } + + /* ------------------------------------------------------------ */ + @Override + public Object doGet(String name) + { + return _attributes.get(name); + } + +} diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionCookieTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionCookieTest.java index 94e92ead7ee..8f3813ba84e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionCookieTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionCookieTest.java @@ -21,6 +21,10 @@ package org.eclipse.jetty.server.session; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Enumeration; +import java.util.Map; +import java.util.Set; + import javax.servlet.SessionCookieConfig; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; @@ -50,6 +54,96 @@ public class SessionCookieTest super(abstractSessionManager, created, accessed, clusterId); } + /** + * @see javax.servlet.http.HttpSession#getAttribute(java.lang.String) + */ + @Override + public Object getAttribute(String name) + { + return null; + } + + /** + * @see javax.servlet.http.HttpSession#getAttributeNames() + */ + @Override + public Enumeration getAttributeNames() + { + return null; + } + + /** + * @see javax.servlet.http.HttpSession#getValueNames() + */ + @Override + public String[] getValueNames() + { + return null; + } + + /** + * @see org.eclipse.jetty.server.session.AbstractSession#getAttributeMap() + */ + @Override + public Map getAttributeMap() + { + return null; + } + + /** + * @see org.eclipse.jetty.server.session.AbstractSession#getAttributes() + */ + @Override + public int getAttributes() + { + return 0; + } + + /** + * @see org.eclipse.jetty.server.session.AbstractSession#getNames() + */ + @Override + public Set getNames() + { + return null; + } + + /** + * @see org.eclipse.jetty.server.session.AbstractSession#clearAttributes() + */ + @Override + public void clearAttributes() + { + + } + + /** + * @see org.eclipse.jetty.server.session.AbstractSession#doPutOrRemove(java.lang.String, java.lang.Object) + */ + @Override + public Object doPutOrRemove(String name, Object value) + { + return null; + } + + /** + * @see org.eclipse.jetty.server.session.AbstractSession#doGet(java.lang.String) + */ + @Override + public Object doGet(String name) + { + return null; + } + + /** + * @see org.eclipse.jetty.server.session.AbstractSession#doGetAttributeNames() + */ + @Override + public Enumeration doGetAttributeNames() + { + return null; + } + } public class MockSessionIdManager extends AbstractSessionIdManager diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java index 792307cfe3d..c3787395d38 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java @@ -38,7 +38,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpContent; +import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpFields; +import org.eclipse.jetty.http.HttpGenerator.CachedHttpField; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.MimeTypes; @@ -136,6 +138,9 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory private static final Logger LOG = Log.getLogger(DefaultServlet.class); private static final long serialVersionUID = 4930458713846881193L; + + private static final CachedHttpField ACCEPT_RANGES = new CachedHttpField(HttpHeader.ACCEPT_RANGES, "bytes"); + private ServletContext _servletContext; private ContextHandler _contextHandler; @@ -155,7 +160,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory private String[] _welcomes; private Resource _stylesheet; private boolean _useFileMappedBuffer=false; - private String _cacheControl; + private HttpField _cacheControl; private String _relativeResourceBase; private ServletHandler _servletHandler; private ServletHolder _defaultHolder; @@ -228,8 +233,10 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory LOG.debug(e); } - _cacheControl=getInitParameter("cacheControl"); - + String cc=getInitParameter("cacheControl"); + if (cc!=null) + _cacheControl=new CachedHttpField(HttpHeader.CACHE_CONTROL, cc); + String resourceCache = getInitParameter("resourceCache"); int max_cache_size=getInitInt("maxCacheSize", -2); int max_cached_file_size=getInitInt("maxCachedFileSize", -2); @@ -1062,10 +1069,10 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory protected void writeOptionHeaders(HttpFields fields) { if (_acceptRanges) - fields.put(HttpHeader.ACCEPT_RANGES,"bytes"); + fields.put(ACCEPT_RANGES); if (_cacheControl!=null) - fields.put(HttpHeader.CACHE_CONTROL,_cacheControl); + fields.put(_cacheControl); } /* ------------------------------------------------------------ */ @@ -1075,7 +1082,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory response.setHeader(HttpHeader.ACCEPT_RANGES.asString(),"bytes"); if (_cacheControl!=null) - response.setHeader(HttpHeader.CACHE_CONTROL.asString(),_cacheControl); + response.setHeader(HttpHeader.CACHE_CONTROL.asString(),_cacheControl.getValue()); } /* ------------------------------------------------------------ */ diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java index b9e6ccac88e..6808c439e83 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java @@ -373,16 +373,14 @@ public abstract class AbstractCompressedStream extends ServletOutputStream @Override public void setWriteListener(WriteListener writeListener) { - // TODO 3.1 Auto-generated method stub - + throw new UnsupportedOperationException("Use AsyncGzipFilter"); } @Override public boolean isReady() { - // TODO 3.1 Auto-generated method stub - return false; + throw new UnsupportedOperationException("Use AsyncGzipFilter"); } /** diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_04.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_04.mod index 3d1312b2dd0..007570b6757 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_04.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_04.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar:lib/npn/npn-boot-1.1.0.v20120525.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar|lib/npn/npn-boot-1.1.0.v20120525.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.0.v20120525.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_05.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_05.mod index 3d1312b2dd0..007570b6757 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_05.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_05.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar:lib/npn/npn-boot-1.1.0.v20120525.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar|lib/npn/npn-boot-1.1.0.v20120525.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.0.v20120525.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_06.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_06.mod index 8ae3b1c61dd..868a7a77fcb 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_06.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_06.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar:lib/npn/npn-boot-1.1.1.v20121030.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar|lib/npn/npn-boot-1.1.1.v20121030.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.1.v20121030.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_07.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_07.mod index 8ae3b1c61dd..868a7a77fcb 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_07.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_07.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar:lib/npn/npn-boot-1.1.1.v20121030.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar|lib/npn/npn-boot-1.1.1.v20121030.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.1.v20121030.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_09.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_09.mod index b4415d2160d..20c1db27bd5 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_09.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_09.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_10.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_10.mod index b4415d2160d..20c1db27bd5 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_10.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_10.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_11.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_11.mod index b4415d2160d..20c1db27bd5 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_11.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_11.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_13.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_13.mod index c557a7cef6f..1645a52dba0 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_13.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_13.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.4.v20130313/npn-boot-1.1.4.v20130313.jar:lib/npn/npn-boot-1.1.4.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.4.v20130313/npn-boot-1.1.4.v20130313.jar|lib/npn/npn-boot-1.1.4.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.4.v20130313.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_15.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_15.mod index 98ddbe7445e..73bc09007eb 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_15.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_15.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_17.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_17.mod index 98ddbe7445e..73bc09007eb 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_17.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_17.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_21.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_21.mod index 98ddbe7445e..73bc09007eb 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_21.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_21.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_25.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_25.mod index 98ddbe7445e..73bc09007eb 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_25.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_25.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_40.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_40.mod index a7e47a538a7..465e6f034b6 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_40.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_40.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_45.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_45.mod index a7e47a538a7..465e6f034b6 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_45.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_45.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_51.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_51.mod index a7e47a538a7..465e6f034b6 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_51.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_51.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_55.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_55.mod index f886df82ede..639c70e3ffd 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_55.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_55.mod @@ -2,7 +2,7 @@ protonego-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.7.v20140316/npn-boot-1.1.7.v20140316.jar:lib/npn/npn-boot-1.1.7.v20140316.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.7.v20140316/npn-boot-1.1.7.v20140316.jar|lib/npn/npn-boot-1.1.7.v20140316.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.7.v20140316.jar diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/FileArg.java b/jetty-start/src/main/java/org/eclipse/jetty/start/FileArg.java index b4515fa3106..281fe6bad1a 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/FileArg.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/FileArg.java @@ -23,21 +23,25 @@ public class FileArg public String uri; public String location; - public FileArg(String uriLocation) + public FileArg(final String uriLocation) { - String parts[] = uriLocation.split(":",3); - if (parts.length == 3) + String parts[] = uriLocation.split("\\|",3); + if (parts.length > 2) { - if (!"http".equalsIgnoreCase(parts[0])) - { - throw new IllegalArgumentException("Download only supports http protocol"); - } - if (!parts[1].startsWith("//")) - { - throw new IllegalArgumentException("Download URI invalid: " + uriLocation); - } - this.uri = String.format("%s:%s",parts[0],parts[1]); - this.location = parts[2]; + StringBuilder err = new StringBuilder(); + final String LN = System.lineSeparator(); + err.append("Unrecognized [file] argument: ").append(uriLocation); + err.append(LN).append("Valid Syntaxes: "); + err.append(LN).append(" - eg: resources/"); + err.append(LN).append(" or - eg: /var/run/jetty.pid"); + err.append(LN).append(" or | - eg: http://machine/my.conf|resources/my.conf"); + err.append(LN).append(" or | - eg: http://machine/glob.dat|/opt/run/glob.dat"); + throw new IllegalArgumentException(err.toString()); + } + if (parts.length == 2) + { + this.uri = parts[0]; + this.location = parts[1]; } else { diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 38311462968..8859cff7d2e 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -375,15 +375,15 @@ public class Main // Find any named ini file and check it follows the convention Path start_ini = baseHome.getBasePath("start.ini"); String short_start_ini = baseHome.toShortForm(start_ini); - Path ini = start_d.resolve(name + ".ini"); - String short_ini = baseHome.toShortForm(ini); + Path startd_ini = start_d.resolve(name + ".ini"); + String short_startd_ini = baseHome.toShortForm(startd_ini); StartIni module_ini = null; - if (FS.exists(ini)) + if (FS.exists(startd_ini)) { - module_ini = new StartIni(ini); + module_ini = new StartIni(startd_ini); if (module_ini.getLineMatches(Pattern.compile("--module=(.*, *)*" + name)).size() == 0) { - StartLog.warn("ERROR: %s is not enabled in %s!",name,short_ini); + StartLog.warn("ERROR: %s is not enabled in %s!",name,short_startd_ini); return; } } @@ -392,7 +392,7 @@ public class Main boolean has_ini_lines = module.getInitialise().size() > 0; // If it is not enabled or is transitive with ini template lines or toplevel and doesn't exist - if (!module.isEnabled() || (transitive && has_ini_lines) || (topLevel && !FS.exists(ini) && !appendStartIni)) + if (!module.isEnabled() || (transitive && has_ini_lines) || (topLevel && !FS.exists(startd_ini) && !appendStartIni)) { // File BufferedWriter BufferedWriter writer = null; @@ -412,9 +412,9 @@ public class Main // Create the directory if needed FS.ensureDirectoryExists(start_d); FS.ensureDirectoryWritable(start_d); - source = short_ini; + source = short_startd_ini; StartLog.info("%-15s initialised in %s (created)",name,source); - writer = Files.newBufferedWriter(ini,StandardCharsets.UTF_8,StandardOpenOption.CREATE_NEW,StandardOpenOption.WRITE); + writer = Files.newBufferedWriter(startd_ini,StandardCharsets.UTF_8,StandardOpenOption.CREATE_NEW,StandardOpenOption.WRITE); out = new PrintWriter(writer); } @@ -463,9 +463,9 @@ public class Main } } } - else if (FS.exists(ini)) + else if (FS.exists(startd_ini)) { - StartLog.info("%-15s initialised in %s",name,short_ini); + StartLog.info("%-15s initialised in %s",name,short_startd_ini); } else { @@ -475,7 +475,8 @@ public class Main // Also list other places this module is enabled for (String source : module.getSources()) { - if (!short_ini.equals(source)) + StartLog.debug("also enabled in: %s",source); + if (!short_start_ini.equals(source)) { StartLog.info("%-15s enabled in %s",name,baseHome.toShortForm(source)); } diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Props.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Props.java index f760f6e8e20..7d35aaaf4c8 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Props.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Props.java @@ -23,12 +23,12 @@ import static org.eclipse.jetty.start.UsageException.*; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Stack; +import java.util.TreeMap; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -98,7 +98,7 @@ public final class Props implements Iterable return l; } - private Map props = new HashMap<>(); + private Map props = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); private List sysPropTracking = new ArrayList<>(); public void addAll(Props other) @@ -114,7 +114,7 @@ public final class Props implements Iterable * @param arg the argument to parse for a potential property * @param source the source for this argument (to track origin of property from) */ - public void addPossibleProperty(String arg, String source) + public boolean addPossibleProperty(String arg, String source) { // Start property (syntax similar to System property) if (arg.startsWith("-D")) @@ -125,15 +125,14 @@ public final class Props implements Iterable case 2: setSystemProperty(assign[0],assign[1]); setProperty(assign[0],assign[1],source); - break; + return true; case 1: setSystemProperty(assign[0],""); setProperty(assign[0],"",source); - break; + return true; default: - break; + return false; } - return; } // Is this a raw property declaration? @@ -144,10 +143,11 @@ public final class Props implements Iterable String value = arg.substring(idx + 1); setProperty(key,value,source); - return; + return true; } // All other strings are ignored + return false; } public String cleanReference(String property) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/RawArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/RawArgs.java new file mode 100644 index 00000000000..6464a35d17d --- /dev/null +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/RawArgs.java @@ -0,0 +1,97 @@ +// +// ======================================================================== +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.jetty.start.RawArgs.Entry; + +public class RawArgs implements Iterable +{ + public class Entry + { + private String line; + private String origin; + + private Entry(String line, String origin) + { + this.line = line; + this.origin = origin; + } + + public String getLine() + { + return line; + } + + public String getOrigin() + { + return origin; + } + + public boolean startsWith(String val) + { + return line.startsWith(val); + } + } + + /** + * All of the args, in argument order + */ + private List args = new ArrayList<>(); + + public void addAll(List lines, Path sourceFile) + { + String source = sourceFile.toAbsolutePath().toString(); + for (String line : lines) + { + addArg(line,source); + } + } + + public void addArg(final String rawline, final String source) + { + if (rawline == null) + { + return; + } + + String line = rawline.trim(); + if (line.length() == 0) + { + return; + } + + args.add(new Entry(line,source)); + } + + @Override + public Iterator iterator() + { + return args.iterator(); + } + + public int size() + { + return args.size(); + } +} diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java index d1e6623ad02..43df38122a6 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java @@ -639,9 +639,9 @@ public class StartArgs while (iter.hasPrevious()) { ConfigSource source = iter.previous(); - for (String arg : source.getArgs()) + for (RawArgs.Entry arg : source.getArgs()) { - parse(arg,source.getId()); + parse(arg.getLine(),arg.getOrigin()); } } } diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartLog.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartLog.java index 963433c65e8..e7acfa13c14 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartLog.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartLog.java @@ -96,9 +96,9 @@ public class StartLog String logFileName = cmdLineSource.getProperty("start-log-file"); - for (String arg : cmdLineSource.getArgs()) + for (RawArgs.Entry arg : cmdLineSource.getArgs()) { - if ("--debug".equals(arg)) + if ("--debug".equals(arg.getLine())) { debug = true; continue; @@ -106,14 +106,14 @@ public class StartLog if (arg.startsWith("--start-log-file")) { - logFileName = Props.getValue(arg); + logFileName = Props.getValue(arg.getLine()); continue; } } if (logFileName != null) { - Path logfile = baseHome.getBasePath(logFileName); + Path logfile = baseHome.getPath(logFileName); initLogFile(logfile); } } diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java b/jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java index 61f9f643f13..934158f1acb 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java @@ -23,8 +23,6 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Path; -import java.util.Arrays; -import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -32,6 +30,7 @@ import org.eclipse.jetty.start.BaseHome; import org.eclipse.jetty.start.FS; import org.eclipse.jetty.start.Props; import org.eclipse.jetty.start.Props.Prop; +import org.eclipse.jetty.start.RawArgs; import org.eclipse.jetty.start.UsageException; /** @@ -42,17 +41,18 @@ public class CommandLineConfigSource implements ConfigSource public static final String ORIGIN_INTERNAL_FALLBACK = ""; public static final String ORIGIN_CMD_LINE = ""; - private final List args; + private final RawArgs args; private final Props props; private final Path homePath; private final Path basePath; public CommandLineConfigSource(String rawargs[]) { - this.args = Arrays.asList(rawargs); + this.args = new RawArgs(); this.props = new Props(); - for (String arg : args) + for (String arg : rawargs) { + this.args.addArg(arg,ORIGIN_CMD_LINE); this.props.addPossibleProperty(arg,ORIGIN_CMD_LINE); } @@ -179,7 +179,7 @@ public class CommandLineConfigSource implements ConfigSource } @Override - public List getArgs() + public RawArgs getArgs() { return args; } diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/config/ConfigSource.java b/jetty-start/src/main/java/org/eclipse/jetty/start/config/ConfigSource.java index 47abc1745db..ba81a2a6c98 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/config/ConfigSource.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/config/ConfigSource.java @@ -18,9 +18,8 @@ package org.eclipse.jetty.start.config; -import java.util.List; - import org.eclipse.jetty.start.Props; +import org.eclipse.jetty.start.RawArgs; /** * A Configuration Source @@ -57,7 +56,7 @@ public interface ConfigSource * * @return the list of Arguments for this ConfigSource */ - public List getArgs(); + public RawArgs getArgs(); /** * The properties for this ConfigSource diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/config/ConfigSources.java b/jetty-start/src/main/java/org/eclipse/jetty/start/config/ConfigSources.java index 4eb3713ccc2..7bd3780357d 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/config/ConfigSources.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/config/ConfigSources.java @@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.jetty.start.FS; import org.eclipse.jetty.start.Props; +import org.eclipse.jetty.start.RawArgs; import org.eclipse.jetty.start.Props.Prop; import org.eclipse.jetty.start.UsageException; @@ -67,11 +68,11 @@ public class ConfigSources implements Iterable updateProps(); // look for --include-jetty-dir entries - for (String arg : source.getArgs()) + for (RawArgs.Entry arg : source.getArgs()) { if (arg.startsWith("--include-jetty-dir")) { - String ref = getValue(arg); + String ref = getValue(arg.getLine()); String dirName = props.expand(ref); Path dir = FS.toPath(dirName); DirConfigSource dirsource = new DirConfigSource(ref,dir,sourceWeight.incrementAndGet(),true); diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/config/DirConfigSource.java b/jetty-start/src/main/java/org/eclipse/jetty/start/config/DirConfigSource.java index 9befbe8d987..589905c9ef5 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/config/DirConfigSource.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/config/DirConfigSource.java @@ -33,6 +33,7 @@ import org.eclipse.jetty.start.FS; import org.eclipse.jetty.start.NaturalSort; import org.eclipse.jetty.start.PathMatchers; import org.eclipse.jetty.start.Props; +import org.eclipse.jetty.start.RawArgs; import org.eclipse.jetty.start.UsageException; import org.eclipse.jetty.start.Props.Prop; import org.eclipse.jetty.start.StartIni; @@ -71,7 +72,7 @@ public class DirConfigSource implements ConfigSource private final String id; private final Path dir; private final int weight; - private final List args; + private final RawArgs args; private final Props props; /** @@ -95,7 +96,7 @@ public class DirConfigSource implements ConfigSource this.weight = weight; this.props = new Props(); - this.args = new ArrayList<>(); + this.args = new RawArgs(); if (canHaveArgs) { @@ -103,7 +104,7 @@ public class DirConfigSource implements ConfigSource if (FS.canReadFile(iniFile)) { StartIni ini = new StartIni(iniFile); - args.addAll(ini.getLines()); + args.addAll(ini.getLines(),iniFile); parseAllArgs(ini.getLines(),iniFile.toString()); } @@ -138,7 +139,7 @@ public class DirConfigSource implements ConfigSource { StartLog.debug("Reading %s/start.d/%s - %s",id,diniFile.getFileName(),diniFile); StartIni ini = new StartIni(diniFile); - args.addAll(ini.getLines()); + args.addAll(ini.getLines(),diniFile); parseAllArgs(ini.getLines(),diniFile.toString()); } } @@ -194,7 +195,7 @@ public class DirConfigSource implements ConfigSource } @Override - public List getArgs() + public RawArgs getArgs() { return args; } diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt index 7f818effcb3..0817b46738c 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt @@ -98,6 +98,7 @@ Module Management: modules. This may download a file from the network if the module provides a URL. + Startup / Shutdown Command Line: -------------------------------- @@ -120,44 +121,26 @@ Properties: Jetty server has stopped. If not specified, the stopper will wait indefinitely. Use in conjunction with the --stop option. + Advanced Commands: ------------------ - --download=: - Advanced usage, If the file does not exist at the given - location, download it from the given http URI. - Note: location is always relative to ${jetty.base} - --lib= Add arbitrary classpath entries to the the server classpath. + + --include-jetty-dir= + Include an extra jetty directory to use as a source + for configuration details. This directory behaves similarly + to ${jetty.base} but sits at a layer between ${jetty.base} + and ${jetty.home}. This allows for some complex hierarchies + of configuration details. -System Properties: ------------------- - - These are set with a command line like "java -Dname=value ..." and are - accessible via the java.lang.System#getProperty(String) API. - Some key system properties are: - - org.eclipse.jetty.util.log.class=[class] - A Low Level Jetty Logger Implementation to use - (default: org.eclipse.jetty.util.log.Slf4jLog) - - [name|hierarchy].LEVEL=[loglevel] - Change loglevel for the stderr and javautil Loggers. Slf4j - and other loggers must be separately configured for debug. - For example: Dorg.eclipse.jetty.LEVEL=DEBUG - (default: INFO) - - org.eclipse.jetty.util.log.IGNORED=[boolean] - Ignored exceptions are logged, independent of DEBUG settings - (default: false) - - org.eclipse.jetty.util.log.SOURCE=[boolean] - The source location of logs is logged in the stderr Logger. - (default: false) - - com.sun.management.jmxremote - Enable remote JMX management in Sun JVMS. + --download=| + Advanced usage, If the file does not exist at the given + location, download it from the given http URI. + Notes: location is always relative to ${jetty.base}. + you might need to escape the slash "\|" to use + this on some environments. Properties: @@ -180,6 +163,18 @@ Properties: Defaults: --------- - A ${jetty.base}/start.ini file and/or ${jetty.base|/start.d/*.ini files may be - used to specify default arguments to start.jar. In case of a conflict between - the command line, and ini files, the command line will win. + Command line arguments can come from any jetty configuration directory + (except ${jetty.home}), such as ${jetty.base} and any added jetty directories + (see --include-jetty-dir=). + The contents of /start.ini and /start.d/*.ini are all used + to build up your command line arguments. + In case of a conflict, the resolution of who wins, will look like this. + + 1) + 2) ${jetty.base}/start.ini + 3) ${jetty.base}/start.d/*.ini + 4) /start.ini + 5) /start.d/*.ini + +For more information on startup, see the online documentation at + http://www.eclipse.org/jetty/documentation/ diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java index ced1889b5c8..1d2e8ba1d01 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java @@ -124,7 +124,7 @@ public class ConfigurationAssert { if (darg.uri != null) { - actualDownloads.add(String.format("%s:%s",darg.uri,darg.location)); + actualDownloads.add(String.format("%s|%s",darg.uri,darg.location)); } } assertContainsUnordered("Downloads",expectedDownloads,actualDownloads); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/FileArgTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/FileArgTest.java new file mode 100644 index 00000000000..e35657c49f3 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/FileArgTest.java @@ -0,0 +1,100 @@ +// +// ======================================================================== +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start; + +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class FileArgTest +{ + @SuppressWarnings("serial") + private static class UseCases extends ArrayList + { + public void add(String rawfileref, String expectedUri, String expectedLocation) + { + this.add(new String[] { rawfileref, expectedUri, expectedLocation }); + } + } + + @Parameters(name = "{0}") + public static List data() + { + UseCases data = new UseCases(); + data.add("resource",null,"resource"); + data.add("lib/logging",null,"lib/logging"); + + // -- URI with relative location -- + data.add("http://machine.com/my.conf|resources/my.conf","http://machine.com/my.conf","resources/my.conf"); + data.add("http://machine.com:8080/my.conf|resources/my.conf","http://machine.com:8080/my.conf","resources/my.conf"); + data.add("https://machine.com:8080/my.conf|resources/my.conf","https://machine.com:8080/my.conf","resources/my.conf"); + // Windows URI (drive mapped) + data.add("file:///Z:/share/my.conf|resources/my.conf","file:///Z:/share/my.conf","resources/my.conf"); + // Windows URI (network share) + data.add("file:////nas/share/my.conf|resources/my.conf","file:////nas/share/my.conf","resources/my.conf"); + + // -- URI with absolute location -- + data.add("http://machine.com/db.dat|/var/run/db.dat","http://machine.com/db.dat","/var/run/db.dat"); + data.add("http://machine.com:8080/b/db.dat|/var/run/db.dat","http://machine.com:8080/b/db.dat","/var/run/db.dat"); + data.add("https://machine.com:8080/c/db.dat|/var/run/db.dat","https://machine.com:8080/c/db.dat","/var/run/db.dat"); + // Windows URI (drive mapped) to drive mapped output + data.add("file:///Z:/share/my.conf|C:/db/db.dat","file:///Z:/share/my.conf","C:/db/db.dat"); + data.add("file:///Z:/share/my.conf|C:\\db\\db.dat","file:///Z:/share/my.conf","C:\\db\\db.dat"); + // Windows URI (drive mapped) to network share output + data.add("file:///Z:/share/my.conf|\\\\nas\\apps\\db\\db.dat","file:///Z:/share/my.conf","\\\\nas\\apps\\db\\db.dat"); + // Windows URI (network share) to drive mapped output + data.add("file:////nas/share/my.conf|C:/db/db.dat","file:////nas/share/my.conf","C:/db/db.dat"); + data.add("file:////nas/share/my.conf|C:\\db\\db.dat","file:////nas/share/my.conf","C:\\db\\db.dat"); + // Windows URI (network share) to network share output + data.add("file:////nas/share/my.conf|\\\\nas\\apps\\db\\db.dat","file:////nas/share/my.conf","\\\\nas\\apps\\db\\db.dat"); + return data; + } + + @Parameter(value = 0) + public String rawFileRef; + @Parameter(value = 1) + public String expectedUri; + @Parameter(value = 2) + public String expectedLocation; + + @Test + public void testFileArg() + { + FileArg arg = new FileArg(rawFileRef); + if (expectedUri == null) + { + assertThat("URI",arg.uri,nullValue()); + } + else + { + assertThat("URI",arg.uri,is(expectedUri)); + } + assertThat("Location",arg.location,is(expectedLocation)); + } + +} diff --git a/jetty-start/src/test/resources/usecases/assert-enable-spdy.txt b/jetty-start/src/test/resources/usecases/assert-enable-spdy.txt index 6b0cc7b5bf5..b097f5d12f4 100644 --- a/jetty-start/src/test/resources/usecases/assert-enable-spdy.txt +++ b/jetty-start/src/test/resources/usecases/assert-enable-spdy.txt @@ -31,7 +31,7 @@ PROP|jetty.truststore.password=sundae PROP|java.version=1.7.0_21 # The Downloads -DOWNLOAD|http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +DOWNLOAD|http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar # The Bootlib BOOTLIB|-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/assert-logging.txt b/jetty-start/src/test/resources/usecases/assert-logging.txt index b566172b271..c83dc2c7b96 100644 --- a/jetty-start/src/test/resources/usecases/assert-logging.txt +++ b/jetty-start/src/test/resources/usecases/assert-logging.txt @@ -1,5 +1,4 @@ # The XMLs we expect (order is important) -XML|${jetty.home}/etc/jetty-logging.xml XML|${jetty.home}/etc/jetty.xml XML|${jetty.home}/etc/jetty-http.xml @@ -23,4 +22,11 @@ PROP|jetty.port=9090 # Other File References FILE|logs/ -FILE|resources/ \ No newline at end of file +FILE|resources/ + +# Downloads +DOWNLOAD|http://central.maven.org/maven2/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.jar|lib/logging/slf4j-api-1.6.6.jar +DOWNLOAD|http://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.0.7/logback-core-1.0.7.jar|lib/logging/logback-core-1.0.7.jar +DOWNLOAD|http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.0.7/logback-classic-1.0.7.jar|lib/logging/logback-classic-1.0.7.jar +DOWNLOAD|https://raw.githubusercontent.com/jetty-project/logging-modules/master/logback/logback.xml|resources/logback.xml +DOWNLOAD|https://raw.githubusercontent.com/jetty-project/logging-modules/master/logback/jetty-logging.properties|resources/jetty-logging.properties diff --git a/jetty-start/src/test/resources/usecases/base.logging/modules/logging.mod b/jetty-start/src/test/resources/usecases/base.logging/modules/logging.mod new file mode 100644 index 00000000000..e2d24ce6454 --- /dev/null +++ b/jetty-start/src/test/resources/usecases/base.logging/modules/logging.mod @@ -0,0 +1,20 @@ +# +# Jetty with logback logging +# + +[depend] +resources + +[files] +logs/ +resources/ +http://central.maven.org/maven2/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.jar|lib/logging/slf4j-api-1.6.6.jar +http://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.0.7/logback-core-1.0.7.jar|lib/logging/logback-core-1.0.7.jar +http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.0.7/logback-classic-1.0.7.jar|lib/logging/logback-classic-1.0.7.jar +https://raw.githubusercontent.com/jetty-project/logging-modules/master/logback/logback.xml|resources/logback.xml +https://raw.githubusercontent.com/jetty-project/logging-modules/master/logback/jetty-logging.properties|resources/jetty-logging.properties + +[lib] +lib/logging/**.jar +resources/ + diff --git a/jetty-start/src/test/resources/usecases/base.logging/resources/jetty-logging.properties b/jetty-start/src/test/resources/usecases/base.logging/resources/jetty-logging.properties new file mode 100644 index 00000000000..5cb8291a815 --- /dev/null +++ b/jetty-start/src/test/resources/usecases/base.logging/resources/jetty-logging.properties @@ -0,0 +1,2 @@ +# Configure Jetty for SLf4j Logging +org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_04.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_04.mod index 14bed1bc864..a6778222464 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_04.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_04.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar:lib/npn/npn-boot-1.1.0.v20120525.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar|lib/npn/npn-boot-1.1.0.v20120525.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.0.v20120525.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_05.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_05.mod index 14bed1bc864..a6778222464 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_05.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_05.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar:lib/npn/npn-boot-1.1.0.v20120525.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar|lib/npn/npn-boot-1.1.0.v20120525.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.0.v20120525.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_06.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_06.mod index 9ca93c3fd81..bb6b64bf1f1 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_06.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_06.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar:lib/npn/npn-boot-1.1.1.v20121030.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar|lib/npn/npn-boot-1.1.1.v20121030.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.1.v20121030.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_07.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_07.mod index 9ca93c3fd81..bb6b64bf1f1 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_07.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_07.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar:lib/npn/npn-boot-1.1.1.v20121030.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar|lib/npn/npn-boot-1.1.1.v20121030.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.1.v20121030.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_09.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_09.mod index 2a286fc595e..c488457f14e 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_09.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_09.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_10.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_10.mod index 2a286fc595e..c488457f14e 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_10.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_10.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_11.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_11.mod index 2a286fc595e..c488457f14e 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_11.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_11.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_13.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_13.mod index 0af092a8da6..0264d724869 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_13.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_13.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.4.v20130313/npn-boot-1.1.4.v20130313.jar:lib/npn/npn-boot-1.1.4.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.4.v20130313/npn-boot-1.1.4.v20130313.jar|lib/npn/npn-boot-1.1.4.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.4.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_15.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_15.mod index 572d69fbce4..d2d09ea2d68 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_15.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_15.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_17.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_17.mod index 572d69fbce4..d2d09ea2d68 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_17.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_17.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_21.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_21.mod index 572d69fbce4..d2d09ea2d68 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_21.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_21.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_25.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_25.mod index 572d69fbce4..d2d09ea2d68 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_25.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_25.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_40.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_40.mod index 78b7f7c8dea..909bebf5f70 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_40.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_40.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_45.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_45.mod index 78b7f7c8dea..909bebf5f70 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_45.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_45.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_51.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_51.mod index 78b7f7c8dea..909bebf5f70 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_51.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_51.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_55.mod b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_55.mod index 02c2fbdf0b5..6f6b4250803 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_55.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn/npn-1.7.0_55.mod @@ -2,7 +2,7 @@ npn-boot [files] -http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.7.v20140316/npn-boot-1.1.7.v20140316.jar:lib/npn/npn-boot-1.1.7.v20140316.jar +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.7.v20140316/npn-boot-1.1.7.v20140316.jar|lib/npn/npn-boot-1.1.7.v20140316.jar [exec] -Xbootclasspath/p:lib/npn/npn-boot-1.1.7.v20140316.jar diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 639d1088a5d..65ce9b18682 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -25,7 +25,7 @@ - javax.servlet.*;version="[2.6.0,3.2)",org.slf4j;version="[1.5,2.0)";resolution:=optional,org.slf4j.impl;version="[1.5,2.0)";resolution:=optional,* + javax.servlet.*;version="[2.6.0,3.2)",org.slf4j;version="[1.6,2.0)";resolution:=optional,org.slf4j.impl;version="[1.6,2.0)";resolution:=optional,* diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java b/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java index c969f949111..3085a68735d 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java @@ -22,6 +22,8 @@ import java.io.Closeable; import java.io.IOException; import java.io.InterruptedIOException; import java.util.concurrent.CancellationException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; @@ -66,6 +68,15 @@ public class SharedBlockingCallback return "SUCCEEDED"; } }; + + private static Throwable FAILED = new Throwable() + { + @Override + public String toString() + { + return "FAILED"; + } + }; final Blocker _blocker; @@ -148,7 +159,10 @@ public class SharedBlockingCallback { if (_state == null) { - _state = cause; + // TODO remove when feedback received on 435322 + if (cause==null) + LOG.warn("null failed cause (please report stack trace) ",new Throwable()); + _state = cause==null?FAILED:cause; _complete.signalAll(); } else if (_state == IDLE) @@ -176,7 +190,16 @@ public class SharedBlockingCallback try { while (_state == null) - _complete.await(); + { + // TODO remove this debug timout! + // This is here to help debug 435322, + if (!_complete.await(10,TimeUnit.MINUTES)) + { + IOException x = new IOException("DEBUG timeout"); + LOG.warn("Blocked too long (please report!!!) "+this, x); + _state=x; + } + } if (_state == SUCCEEDED) return; diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java index ad7bbd77723..de6c181d4fe 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java @@ -81,25 +81,25 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor { try { - registerVisitor("context-param", this.getClass().getDeclaredMethod("visitContextParam", __signature)); - registerVisitor("display-name", this.getClass().getDeclaredMethod("visitDisplayName", __signature)); - registerVisitor("servlet", this.getClass().getDeclaredMethod("visitServlet", __signature)); - registerVisitor("servlet-mapping", this.getClass().getDeclaredMethod("visitServletMapping", __signature)); - registerVisitor("session-config", this.getClass().getDeclaredMethod("visitSessionConfig", __signature)); - registerVisitor("mime-mapping", this.getClass().getDeclaredMethod("visitMimeMapping", __signature)); - registerVisitor("welcome-file-list", this.getClass().getDeclaredMethod("visitWelcomeFileList", __signature)); - registerVisitor("locale-encoding-mapping-list", this.getClass().getDeclaredMethod("visitLocaleEncodingList", __signature)); - registerVisitor("error-page", this.getClass().getDeclaredMethod("visitErrorPage", __signature)); - registerVisitor("taglib", this.getClass().getDeclaredMethod("visitTagLib", __signature)); - registerVisitor("jsp-config", this.getClass().getDeclaredMethod("visitJspConfig", __signature)); - registerVisitor("security-constraint", this.getClass().getDeclaredMethod("visitSecurityConstraint", __signature)); - registerVisitor("login-config", this.getClass().getDeclaredMethod("visitLoginConfig", __signature)); - registerVisitor("security-role", this.getClass().getDeclaredMethod("visitSecurityRole", __signature)); - registerVisitor("filter", this.getClass().getDeclaredMethod("visitFilter", __signature)); - registerVisitor("filter-mapping", this.getClass().getDeclaredMethod("visitFilterMapping", __signature)); - registerVisitor("listener", this.getClass().getDeclaredMethod("visitListener", __signature)); - registerVisitor("distributable", this.getClass().getDeclaredMethod("visitDistributable", __signature)); - registerVisitor("deny-uncovered-http-methods", this.getClass().getDeclaredMethod("visitDenyUncoveredHttpMethods", __signature)); + registerVisitor("context-param", this.getClass().getMethod("visitContextParam", __signature)); + registerVisitor("display-name", this.getClass().getMethod("visitDisplayName", __signature)); + registerVisitor("servlet", this.getClass().getMethod("visitServlet", __signature)); + registerVisitor("servlet-mapping", this.getClass().getMethod("visitServletMapping", __signature)); + registerVisitor("session-config", this.getClass().getMethod("visitSessionConfig", __signature)); + registerVisitor("mime-mapping", this.getClass().getMethod("visitMimeMapping", __signature)); + registerVisitor("welcome-file-list", this.getClass().getMethod("visitWelcomeFileList", __signature)); + registerVisitor("locale-encoding-mapping-list", this.getClass().getMethod("visitLocaleEncodingList", __signature)); + registerVisitor("error-page", this.getClass().getMethod("visitErrorPage", __signature)); + registerVisitor("taglib", this.getClass().getMethod("visitTagLib", __signature)); + registerVisitor("jsp-config", this.getClass().getMethod("visitJspConfig", __signature)); + registerVisitor("security-constraint", this.getClass().getMethod("visitSecurityConstraint", __signature)); + registerVisitor("login-config", this.getClass().getMethod("visitLoginConfig", __signature)); + registerVisitor("security-role", this.getClass().getMethod("visitSecurityRole", __signature)); + registerVisitor("filter", this.getClass().getMethod("visitFilter", __signature)); + registerVisitor("filter-mapping", this.getClass().getMethod("visitFilterMapping", __signature)); + registerVisitor("listener", this.getClass().getMethod("visitListener", __signature)); + registerVisitor("distributable", this.getClass().getMethod("visitDistributable", __signature)); + registerVisitor("deny-uncovered-http-methods", this.getClass().getMethod("visitDenyUncoveredHttpMethods", __signature)); } catch (Exception e) { @@ -205,7 +205,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitDisplayName(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitDisplayName(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Servlet Spec 3.0 p. 74 Ignore from web-fragments if (!(descriptor instanceof FragmentDescriptor)) @@ -221,7 +221,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitServlet(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitServlet(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String id = node.getAttribute("id"); @@ -638,7 +638,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitServletMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitServletMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Servlet Spec 3.0, p74 //servlet-mappings are always additive, whether from web xml descriptors (web.xml/web-default.xml/web-override.xml) or web-fragments. @@ -685,7 +685,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitSessionConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitSessionConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { XmlParser.Node tNode = node.get("session-timeout"); if (tNode != null) @@ -1014,7 +1014,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitMimeMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitMimeMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String extension = node.getString("extension", false, true); if (extension != null && extension.startsWith(".")) @@ -1061,7 +1061,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitWelcomeFileList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitWelcomeFileList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { switch (context.getMetaData().getOrigin("welcome-file-list")) { @@ -1110,7 +1110,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitLocaleEncodingList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitLocaleEncodingList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { Iterator iter = node.iterator("locale-encoding-mapping"); while (iter.hasNext()) @@ -1161,7 +1161,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitErrorPage(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitErrorPage(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String error = node.getString("error-code", false, true); int code=0; @@ -1226,7 +1226,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param context * @param node */ - protected void addWelcomeFiles(WebAppContext context, XmlParser.Node node) + public void addWelcomeFiles(WebAppContext context, XmlParser.Node node) { Iterator iter = node.iterator("welcome-file"); while (iter.hasNext()) @@ -1246,7 +1246,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node * @param context */ - protected ServletMapping addServletMapping (String servletName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) + public ServletMapping addServletMapping (String servletName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) { ServletMapping mapping = new ServletMapping(); mapping.setServletName(servletName); @@ -1271,7 +1271,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node * @param context */ - protected void addFilterMapping (String filterName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) + public void addFilterMapping (String filterName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) { FilterMapping mapping = new FilterMapping(); mapping.setFilterName(filterName); @@ -1317,7 +1317,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitTagLib(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitTagLib(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Additive across web.xml and web-fragment.xml String uri = node.getString("taglib-uri", false, true); @@ -1343,7 +1343,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitJspConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitJspConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Additive across web.xml and web-fragment.xml JspConfig config = (JspConfig)context.getServletContext().getJspConfigDescriptor(); @@ -1432,7 +1432,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitSecurityConstraint(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitSecurityConstraint(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { Constraint scBase = new Constraint(); @@ -1547,7 +1547,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node * @throws Exception */ - protected void visitLoginConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception + public void visitLoginConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception { //ServletSpec 3.0 p74 says elements present 0/1 time if specified in web.xml take //precendece over any web-fragment. If not specified in web.xml, then if specified @@ -1716,7 +1716,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged XmlParser.Node roleNode = node.get("role-name"); @@ -1730,7 +1730,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitFilter(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitFilter(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String name = node.getString("filter-name", false, true); FilterHolder holder = _filterHolderMap.get(name); @@ -1866,7 +1866,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitFilterMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitFilterMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Servlet Spec 3.0, p74 //filter-mappings are always additive, whether from web xml descriptors (web.xml/web-default.xml/web-override.xml) or web-fragments. @@ -1910,7 +1910,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitListener(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitListener(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String className = node.getString("listener-class", false, true); EventListener listener = null; @@ -1956,7 +1956,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitDistributable(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitDistributable(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { // the element has no content, so its simple presence // indicates that the webapp is distributable... @@ -1974,7 +1974,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitDenyUncoveredHttpMethods(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitDenyUncoveredHttpMethods(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { ((ConstraintAware)context.getSecurityHandler()).setDenyUncoveredHttpMethods(true); } @@ -1987,7 +1987,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @throws InstantiationException * @throws IllegalAccessException */ - protected EventListener newListenerInstance(WebAppContext context,Class clazz) throws Exception + public EventListener newListenerInstance(WebAppContext context,Class clazz) throws Exception { ListenerHolder h = context.getServletHandler().newListenerHolder(Source.DESCRIPTOR); EventListener l = context.getServletContext().createInstance(clazz); @@ -2001,7 +2001,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param p * @return the normalized pattern */ - protected String normalizePattern(String p) + public String normalizePattern(String p) { if (p != null && p.length() > 0 && !p.startsWith("/") && !p.startsWith("*")) return "/" + p; return p; diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java index 6e9186ebd06..2ae1cae451f 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java @@ -20,6 +20,9 @@ package org.eclipse.jetty.webapp; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.lang.instrument.ClassFileTransformer; +import java.lang.instrument.IllegalClassFormatException; import java.net.URL; import java.net.URLClassLoader; import java.security.CodeSource; @@ -32,7 +35,9 @@ import java.util.List; import java.util.Locale; import java.util.Set; import java.util.StringTokenizer; +import java.util.concurrent.CopyOnWriteArrayList; +import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -66,6 +71,7 @@ public class WebAppClassLoader extends URLClassLoader private final ClassLoader _parent; private final Set _extensions=new HashSet(); private String _name=String.valueOf(hashCode()); + private final List _transformers = new CopyOnWriteArrayList<>(); /* ------------------------------------------------------------ */ /** The Context in which the classloader operates. @@ -295,6 +301,7 @@ public class WebAppClassLoader extends URLClassLoader } /* ------------------------------------------------------------ */ + @Override public PermissionCollection getPermissions(CodeSource cs) { PermissionCollection permissions=_context.getPermissions(); @@ -303,6 +310,7 @@ public class WebAppClassLoader extends URLClassLoader } /* ------------------------------------------------------------ */ + @Override public Enumeration getResources(String name) throws IOException { boolean system_class=_context.isSystemClass(name); @@ -336,6 +344,7 @@ public class WebAppClassLoader extends URLClassLoader * should one be present. This is non-standard and it is recommended * to not rely on this behavior */ + @Override public URL getResource(String name) { URL url= null; @@ -439,19 +448,85 @@ public class WebAppClassLoader extends URLClassLoader if (c == null && _parent!=null && !tried_parent && !server_class ) c= _parent.loadClass(name); - if (c == null) + if (c == null && ex!=null) throw ex; if (resolve) resolveClass(c); if (LOG.isDebugEnabled()) - LOG.debug("loaded " + c+ " from "+c.getClassLoader()); + LOG.debug("loaded {} from {}",c,c==null?null:c.getClassLoader()); return c; } /* ------------------------------------------------------------ */ + public void addClassFileTransformer(ClassFileTransformer transformer) + { + _transformers.add(transformer); + } + + /* ------------------------------------------------------------ */ + public boolean removeClassFileTransformer(ClassFileTransformer transformer) + { + return _transformers.remove(transformer); + } + + /* ------------------------------------------------------------ */ + @Override + protected Class findClass(final String name) throws ClassNotFoundException + { + Class clazz=null; + + if (_transformers.isEmpty()) + clazz = super.findClass(name); + else + { + String path = name.replace('.', '/').concat(".class"); + URL url = getResource(path); + if (url==null) + throw new ClassNotFoundException(name); + + InputStream content=null; + try + { + content = url.openStream(); + byte[] bytes =IO.readBytes(content); + + for (ClassFileTransformer transformer : _transformers) + bytes=transformer.transform(this,name,null,null,bytes); + + clazz=defineClass(name,bytes,0,bytes.length); + } + catch (IOException e) + { + throw new ClassNotFoundException(name,e); + } + catch (IllegalClassFormatException e) + { + throw new ClassNotFoundException(name,e); + } + finally + { + if (content!=null) + { + try + { + content.close(); + } + catch (IOException e) + { + throw new ClassNotFoundException(name,e); + } + } + } + } + + return clazz; + } + + /* ------------------------------------------------------------ */ + @Override public String toString() { return "WebAppClassLoader=" + _name+"@"+Long.toHexString(hashCode()); diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index bb8ca17a5ee..c2eec1e1977 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -1210,24 +1210,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL catch (IOException e){LOG.warn(Log.EXCEPTION,e);} } - if (dir!=null && !dir.exists()) - { - dir.mkdir(); - dir.deleteOnExit(); - } - - if (dir!=null && ( !dir.exists() || !dir.isDirectory() || !dir.canWrite())) - throw new IllegalArgumentException("Bad temp directory: "+dir); - - try - { - if (dir!=null) - dir=dir.getCanonicalFile(); - } - catch(Exception e) - { - LOG.warn(e); - } _tmpDir=dir; setAttribute(TEMPDIR,_tmpDir); } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java index 1dc3d12fd92..1e4096c19cb 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java @@ -360,7 +360,7 @@ public class WebInfConfiguration extends AbstractConfiguration context.setTempDirectory(tmpDir); } - private void configureTempDirectory (File dir, WebAppContext context) + public void configureTempDirectory (File dir, WebAppContext context) { if (dir == null) throw new IllegalArgumentException("Null temp dir"); diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java index d61ebd3d428..4ca4fc77b32 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java @@ -19,15 +19,21 @@ package org.eclipse.jetty.webapp; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import java.lang.instrument.ClassFileTransformer; +import java.lang.instrument.IllegalClassFormatException; import java.net.URL; +import java.security.ProtectionDomain; import java.util.ArrayList; import java.util.Enumeration; +import java.util.Iterator; import java.util.List; import org.eclipse.jetty.util.resource.Resource; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -86,6 +92,54 @@ public class WebAppClassLoaderTest assertTrue(true); } } + + @Test + public void testClassFileTranslations() throws Exception + { + final List results=new ArrayList(); + + _loader.addClassFileTransformer(new ClassFileTransformer() + { + public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) + throws IllegalClassFormatException + { + results.add(loader); + byte[] b = new byte[classfileBuffer.length]; + for (int i=0;i classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) + throws IllegalClassFormatException + { + results.add(className); + byte[] b = new byte[classfileBuffer.length]; + for (int i=0;i iter = results.iterator(); + assertEquals(_loader,iter.next()); + assertEquals("org.acme.webapp.ClassInJarA",iter.next()); + assertEquals(_loader,iter.next()); + assertEquals("org.acme.webapp.ClassInJarB",iter.next()); + assertEquals(_loader,iter.next()); + assertEquals("org.acme.other.ClassInClassesC",iter.next()); + assertFalse(iter.hasNext()); + + } @Test public void testExposedClass() throws Exception diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/DecoderReaderTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/DecoderReaderTest.java index d65e9d5ab61..441e8a60a80 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/DecoderReaderTest.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/DecoderReaderTest.java @@ -20,8 +20,6 @@ package org.eclipse.jetty.websocket.jsr356; import static org.hamcrest.Matchers.*; -import org.junit.Ignore; - import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -59,7 +57,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -@Ignore public class DecoderReaderTest { public static class Quotes @@ -262,8 +259,8 @@ public class DecoderReaderTest client.connectToServer(quoter,server.getWsUri()); qserver.awaitConnect(); qserver.writeQuotes("quotes-ben.txt"); - qserver.close(); quoter.messageQueue.awaitEventCount(1,1000,TimeUnit.MILLISECONDS); + qserver.close(); quoter.awaitClose(); Quotes quotes = quoter.messageQueue.poll(); Assert.assertThat("Quotes Author",quotes.author,is("Benjamin Franklin")); @@ -280,8 +277,8 @@ public class DecoderReaderTest qserver.awaitConnect(); qserver.writeQuotes("quotes-ben.txt"); qserver.writeQuotes("quotes-twain.txt"); - qserver.close(); quoter.messageQueue.awaitEventCount(2,1000,TimeUnit.MILLISECONDS); + qserver.close(); quoter.awaitClose(); Quotes quotes = quoter.messageQueue.poll(); Assert.assertThat("Quotes Author",quotes.author,is("Benjamin Franklin")); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java index 8a78de9ec53..339d4776ba2 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java @@ -144,7 +144,6 @@ public class ConfiguratorTest @Override public String getNegotiatedSubprotocol(List supported, List requested) { - LOG.warn(new Throwable()); String seen = QuoteUtil.join(requested,","); seenProtocols.compareAndSet(null,seen); return super.getNegotiatedSubprotocol(supported,requested); diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/BadNetworkTest.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/BadNetworkTest.java index 19b740a7e19..102e76416a3 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/BadNetworkTest.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/BadNetworkTest.java @@ -27,11 +27,10 @@ import org.eclipse.jetty.toolchain.test.TestTracker; import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.common.test.BlockheadServer; -import org.eclipse.jetty.websocket.common.test.LeakTrackingBufferPool; import org.eclipse.jetty.websocket.common.test.BlockheadServer.ServerConnection; +import org.eclipse.jetty.websocket.common.test.LeakTrackingBufferPool; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -104,7 +103,6 @@ public class BadNetworkTest wsocket.assertCloseCode(StatusCode.NO_CLOSE); } - @Ignore("Idle timeout not working yet") @Test public void testAbruptServerClose() throws Exception { diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java index 5b41986c2f8..1bc082eb759 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java @@ -18,10 +18,7 @@ package org.eclipse.jetty.websocket.client; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.*; import java.io.IOException; import java.net.ConnectException; @@ -40,12 +37,11 @@ import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.UpgradeException; import org.eclipse.jetty.websocket.common.AcceptHash; import org.eclipse.jetty.websocket.common.test.BlockheadServer; -import org.eclipse.jetty.websocket.common.test.LeakTrackingBufferPool; import org.eclipse.jetty.websocket.common.test.BlockheadServer.ServerConnection; +import org.eclipse.jetty.websocket.common.test.LeakTrackingBufferPool; import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -311,7 +307,6 @@ public class ClientConnectTest } @Test - @Ignore("Opened bug 399525") public void testConnectionNotAccepted() throws Exception { JettyTrackingSocket wsocket = new JettyTrackingSocket(); @@ -329,7 +324,6 @@ public class ClientConnectTest } catch (ExecutionException e) { - // FIXME: Connect Timeout Error? assertExpectedError(e,wsocket,UpgradeException.class); // Possible Passing Path (active session wait timeout) wsocket.assertNotOpened(); diff --git a/jetty-websocket/websocket-client/src/test/resources/jetty-logging.properties b/jetty-websocket/websocket-client/src/test/resources/jetty-logging.properties index 826f50f1cad..9668b131052 100644 --- a/jetty-websocket/websocket-client/src/test/resources/jetty-logging.properties +++ b/jetty-websocket/websocket-client/src/test/resources/jetty-logging.properties @@ -7,7 +7,7 @@ org.eclipse.jetty.LEVEL=WARN # org.eclipse.jetty.io.FillInterest.LEVEL=DEBUG # org.eclipse.jetty.io.AbstractConnection.LEVEL=DEBUG # org.eclipse.jetty.websocket.LEVEL=WARN -org.eclipse.jetty.websocket.LEVEL=DEBUG +# org.eclipse.jetty.websocket.LEVEL=DEBUG # org.eclipse.jetty.websocket.client.LEVEL=DEBUG # org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.LEVEL=DEBUG # org.eclipse.jetty.websocket.common.io.IOState.LEVEL=DEBUG diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateTest.java deleted file mode 100644 index d30557ebaa1..00000000000 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateTest.java +++ /dev/null @@ -1,78 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.common.extensions.compress; - -import java.nio.ByteBuffer; -import java.util.zip.Deflater; - -import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.common.util.Hex; -import org.junit.Ignore; -import org.junit.Test; - -public class DeflateTest -{ - private int bufSize = 8 * 1024; - - public String deflate(String inputHex, Deflater deflater, int flushMode) - { - byte uncompressed[] = Hex.asByteArray(inputHex); - deflater.reset(); - deflater.setInput(uncompressed,0,uncompressed.length); - if (flushMode != Deflater.SYNC_FLUSH) - deflater.finish(); - - ByteBuffer out = ByteBuffer.allocate(bufSize); - byte buf[] = new byte[64]; - - int len = deflater.deflate(buf,0,buf.length,flushMode); - out.put(buf,0,len); - - out.flip(); - return Hex.asHex(out); - } - - @Test - @Ignore("noisy") - public void deflateAllTypes() - { - int levels[] = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - boolean nowraps[] = new boolean[] { true, false }; - int strategies[] = new int[] { Deflater.DEFAULT_STRATEGY, Deflater.FILTERED, Deflater.HUFFMAN_ONLY }; - int flushmodes[] = new int[] { Deflater.NO_FLUSH, Deflater.SYNC_FLUSH, Deflater.FULL_FLUSH }; - - String inputHex = Hex.asHex(StringUtil.getUtf8Bytes("time:")); - for (int level : levels) - { - for (boolean nowrap : nowraps) - { - Deflater deflater = new Deflater(level,nowrap); - for (int strategy : strategies) - { - deflater.setStrategy(strategy); - for (int flushmode : flushmodes) - { - String result = deflate(inputHex,deflater,flushmode); - System.out.printf("%d | %b | %d | %d | \"%s\"%n",level,nowrap,strategy,flushmode,result); - } - } - } - } - } -} diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/FragmentExtensionTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/FragmentExtensionTest.java index be15bac9a25..7ba8dcd62ae 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/FragmentExtensionTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/FragmentExtensionTest.java @@ -31,10 +31,8 @@ import org.eclipse.jetty.websocket.server.helper.EchoServlet; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; -@Ignore("Bug 395444") public class FragmentExtensionTest { private static SimpleServletServer server; diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/IdentityExtensionTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/IdentityExtensionTest.java index 5c127130832..17c311cfb6b 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/IdentityExtensionTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/IdentityExtensionTest.java @@ -31,10 +31,8 @@ import org.eclipse.jetty.websocket.server.helper.EchoServlet; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; -@Ignore("Bug 395444") public class IdentityExtensionTest { private static SimpleServletServer server; diff --git a/pom.xml b/pom.xml index d5bf1d02369..ab3b0596fbd 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ http://www.eclipse.org/jetty UTF-8 1.1 - 1.6.1 + 1.6.6 1.2 1.1.0.v20120525 1.0.0 @@ -261,12 +261,18 @@ -showversion -Xmx1g -Xms1g -XX:+PrintGCDetails false - + --> + + java.io.tmpdir + ${project.build.directory} + + diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index d20923c6263..2d41a6607a6 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.1.1-SNAPSHOT + 9.2.0-SNAPSHOT test-mongodb-sessions Jetty Tests :: Sessions :: Mongo