diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index e1c282e74db..baf31b1f902 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -276,6 +276,11 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector _endp.shutdownOutput(); } + public void dispatch() + { + _endp.asyncDispatch(); + } + public void asyncDispatch() { _endp.asyncDispatch(); diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index e93d75c3656..fb442e3963d 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -103,6 +103,16 @@ ${assembly-directory}/webapps test.war + + org.eclipse.jetty.spdy + spdy-jetty-http-webapp + ${project.version} + war + true + ** + ${assembly-directory}/webapps + spdy.war + org.eclipse.jetty jetty-start @@ -124,12 +134,24 @@ org.eclipse.jetty - org.eclipse.jetty.orbit + org.eclipse.jetty.orbit,org.eclipse.jetty.spdy jetty-all,jetty-start,jetty-monitor,jetty-jsp jar ${assembly-directory}/lib + + copy-lib-spdy-deps + generate-resources + + copy-dependencies + + + org.eclipse.jetty.spdy + jar + ${assembly-directory}/lib/spdy + + copy-orbit-servlet-api-deps generate-resources @@ -222,7 +244,7 @@ unpack-dependencies - org.eclipse.jetty + org.eclipse.jetty,org.eclipse.jetty.spdy config false META-INF/** @@ -398,6 +420,27 @@ jetty-overlay-deployer ${project.version} + + org.eclipse.jetty.spdy + spdy-core + ${project.version} + + + org.eclipse.jetty.spdy + spdy-jetty + ${project.version} + + + org.eclipse.jetty.spdy + spdy-jetty-http + ${project.version} + + + org.eclipse.jetty.spdy + spdy-jetty-http-webapp + ${project.version} + war + org.eclipse.jetty.aggregate jetty-all diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/AsyncEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/AsyncEndPoint.java index 992ad7a195a..5a58160ec35 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/AsyncEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/AsyncEndPoint.java @@ -19,7 +19,14 @@ public interface AsyncEndPoint extends ConnectedEndPoint { /* ------------------------------------------------------------ */ /** - * Dispatch the endpoint to a thread to attend to it. + * Dispatch the endpoint if it is not already dispatched + * + */ + public void dispatch(); + + /* ------------------------------------------------------------ */ + /** + * Dispatch the endpoint. If it is already dispatched, schedule a redispatch * */ public void asyncDispatch(); diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java index 3a72cd2c1c9..828e38e3fcb 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java @@ -280,24 +280,17 @@ public class ChannelEndPoint implements EndPoint if (buf instanceof NIOBuffer) { final NIOBuffer nbuf = (NIOBuffer)buf; - final ByteBuffer bbuf=nbuf.getByteBuffer(); - - //noinspection SynchronizationOnLocalVariableOrMethodParameter - synchronized(bbuf) + final ByteBuffer bbuf=nbuf.getByteBuffer().asReadOnlyBuffer(); + try { - try - { - bbuf.position(buffer.getIndex()); - bbuf.limit(buffer.putIndex()); - len=_channel.write(bbuf); - } - finally - { - if (len>0) - buffer.skip(len); - bbuf.position(0); - bbuf.limit(bbuf.capacity()); - } + bbuf.position(buffer.getIndex()); + bbuf.limit(buffer.putIndex()); + len=_channel.write(bbuf); + } + finally + { + if (len>0) + buffer.skip(len); } } else if (buf instanceof RandomAccessFileBuffer) @@ -363,46 +356,29 @@ public class ChannelEndPoint implements EndPoint synchronized(this) { - // We must sync because buffers may be shared (eg nbuf1 is likely to be cached content). - //noinspection SynchronizationOnLocalVariableOrMethodParameter - synchronized(bbuf0) + // Adjust position indexs of buf0 and buf1 + bbuf0=bbuf0.asReadOnlyBuffer(); + bbuf0.position(header.getIndex()); + bbuf0.limit(header.putIndex()); + bbuf1=bbuf1.asReadOnlyBuffer(); + bbuf1.position(buffer.getIndex()); + bbuf1.limit(buffer.putIndex()); + + _gather2[0]=bbuf0; + _gather2[1]=bbuf1; + + // do the gathering write. + length=(int)((GatheringByteChannel)_channel).write(_gather2); + + int hl=header.length(); + if (length>hl) { - //noinspection SynchronizationOnLocalVariableOrMethodParameter - synchronized(bbuf1) - { - try - { - // Adjust position indexs of buf0 and buf1 - bbuf0.position(header.getIndex()); - bbuf0.limit(header.putIndex()); - bbuf1.position(buffer.getIndex()); - bbuf1.limit(buffer.putIndex()); - - _gather2[0]=bbuf0; - _gather2[1]=bbuf1; - - // do the gathering write. - length=(int)((GatheringByteChannel)_channel).write(_gather2); - - int hl=header.length(); - if (length>hl) - { - header.clear(); - buffer.skip(length-hl); - } - else if (length>0) - { - header.skip(length); - } - } - finally - { - bbuf0.position(0); - bbuf1.position(0); - bbuf0.limit(bbuf0.capacity()); - bbuf1.limit(bbuf1.capacity()); - } - } + header.clear(); + buffer.skip(length-hl); + } + else if (length>0) + { + header.skip(length); } } return length; diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java index b24ebd8d0d9..8db704b15d5 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @@ -208,11 +208,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo { synchronized(this) { - if (_dispatched) - { - throw new IllegalStateException("dispatched"); - } - else + if (!_dispatched) { _dispatched = true; boolean dispatched = _manager.dispatch(_handler); diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java index 41fa232af1e..b4e9791b165 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java @@ -412,7 +412,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection // If we are reading into the temp buffer and it has some content, then we should be dispatched. if (toFill==_unwrapBuf && _unwrapBuf.hasContent() && !_connection.isSuspended()) - _aEndp.asyncDispatch(); + _aEndp.dispatch(); } finally { @@ -721,6 +721,11 @@ public class SslConnection extends AbstractConnection implements AsyncConnection process(null, null); } + public void dispatch() + { + _aEndp.dispatch(); + } + public void asyncDispatch() { _aEndp.asyncDispatch(); diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java index e4eab9e057f..5fb218df2d5 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java @@ -245,21 +245,37 @@ public class MongoSessionManager extends NoSqlSessionManager { for (String name : attrs.keySet()) { - if ( __METADATA.equals(name) ) + if (__METADATA.equals(name)) { continue; } - + String attr = decodeName(name); Object value = decodeValue(attrs.get(name)); - session.doPutOrRemove(attr,value); - session.bindValue(attr,value); + + if (attrs.keySet().contains(name)) + { + session.doPutOrRemove(attr,value); + session.bindValue(attr,value); + } + else + { + session.doPutOrRemove(attr,value); + } + } + // cleanup, remove values from session, that don't exist in data anymore: + for (String name : session.getNames()) + { + if (!attrs.keySet().contains(name)) + { + session.doPutOrRemove(name,null); + session.unbindValue(name,session.getAttribute(name)); + } } } session.didActivate(); - - + return version; } catch (Exception e) diff --git a/jetty-security/src/main/config/etc/README.spnego b/jetty-security/src/main/config/etc/README.spnego index 6bc2123290e..0b4cc5b7ab5 100644 --- a/jetty-security/src/main/config/etc/README.spnego +++ b/jetty-security/src/main/config/etc/README.spnego @@ -12,7 +12,7 @@ The easiest place to put these lines are in the start.ini file. For debugging the spengo authentication the following options are helpful: -Dorg.eclipse.jetty.LEVEL=debug --Dsun.security.spnego.debug=all +-Dsun.security.spnego.debug=true Spengo Authentication is enabled in the webapp with the following setup. @@ -59,7 +59,4 @@ embedded, via the jetty.xml or in a context file for the webapp. true - - - -8 \ No newline at end of file + \ No newline at end of file diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java index 51833fad789..d762ebefbcf 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java @@ -254,7 +254,7 @@ public class DigestAuthenticator extends LoginAuthenticator Nonce nonce=_nonceQueue.peek(); while (nonce!=null && nonce._tspom Jetty :: SPDY :: Parent + + + 7.6.2.v20120308 + + spdy-core spdy-jetty diff --git a/jetty-spdy/spdy-jetty-http-webapp/pom.xml b/jetty-spdy/spdy-jetty-http-webapp/pom.xml index bc40e50409a..e072282c35b 100644 --- a/jetty-spdy/spdy-jetty-http-webapp/pom.xml +++ b/jetty-spdy/spdy-jetty-http-webapp/pom.xml @@ -9,10 +9,27 @@ spdy-jetty-http-webapp war Jetty :: SPDY :: Jetty HTTP Web Application - + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + config + + + + + + + diff --git a/jetty-spdy/spdy-jetty-http-webapp/src/main/config/jetty-spdy.xml b/jetty-spdy/spdy-jetty-http-webapp/src/main/config/etc/jetty-spdy.xml similarity index 100% rename from jetty-spdy/spdy-jetty-http-webapp/src/main/config/jetty-spdy.xml rename to jetty-spdy/spdy-jetty-http-webapp/src/main/config/etc/jetty-spdy.xml diff --git a/jetty-spdy/spdy-jetty-http/pom.xml b/jetty-spdy/spdy-jetty-http/pom.xml index dcb940559db..559020bef45 100644 --- a/jetty-spdy/spdy-jetty-http/pom.xml +++ b/jetty-spdy/spdy-jetty-http/pom.xml @@ -1,5 +1,6 @@ - + org.eclipse.jetty.spdy spdy-parent @@ -10,11 +11,35 @@ Jetty :: SPDY :: Jetty HTTP Layer + + maven-dependency-plugin + + + copy + generate-resources + + copy + + + + + org.mortbay.jetty.npn + npn-boot + ${npn.version} + jar + false + ${build.directory}/npn + + + + + + maven-surefire-plugin - true - -Xbootclasspath/p:${settings.localRepository}/org/mortbay/jetty/npn/npn-boot/${project.version}/npn-boot-${project.version}.jar + true + -Xbootclasspath/p:${build.directory}/npn/npn-boot-${npn.version}.jar @@ -27,7 +52,7 @@ maven-surefire-plugin - true + true diff --git a/jetty-spdy/spdy-jetty/pom.xml b/jetty-spdy/spdy-jetty/pom.xml index 047b3e37f1e..c202606c671 100644 --- a/jetty-spdy/spdy-jetty/pom.xml +++ b/jetty-spdy/spdy-jetty/pom.xml @@ -10,11 +10,35 @@ Jetty :: SPDY :: Jetty Binding + + maven-dependency-plugin + + + copy + generate-resources + + copy + + + + + org.mortbay.jetty.npn + npn-boot + ${npn.version} + jar + false + ${build.directory}/npn + + + + + + maven-surefire-plugin - true - -Xbootclasspath/p:${settings.localRepository}/org/mortbay/jetty/npn/npn-boot/${project.version}/npn-boot-${project.version}.jar + true + -Xbootclasspath/p:${build.directory}/npn/npn-boot-${npn.version}.jar diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java index 3d4d7f702de..c1fd5e2e251 100644 --- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java +++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java @@ -32,6 +32,11 @@ public class EmptyAsyncEndPoint implements AsyncEndPoint private boolean closed; private int maxIdleTime; + @Override + public void dispatch() + { + } + @Override public void asyncDispatch() { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java index f19407e0d23..917d9ddfc71 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java @@ -350,10 +350,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable /* ------------------------------------------------------------ */ public static void dumpObject(Appendable out,Object o) throws IOException { - if (o instanceof LifeCycle) - out.append(String.valueOf(o)).append(" - ").append((AbstractLifeCycle.getState((LifeCycle)o))).append("\n"); - else - out.append(String.valueOf(o)).append("\n"); + try + { + if (o instanceof LifeCycle) + out.append(String.valueOf(o)).append(" - ").append((AbstractLifeCycle.getState((LifeCycle)o))).append("\n"); + else + out.append(String.valueOf(o)).append("\n"); + } + catch(Throwable th) + { + out.append(" => ").append(th.toString()).append('\n'); + } } /* ------------------------------------------------------------ */ diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java index e3cccc09dd8..a6ae12096f1 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java @@ -465,12 +465,16 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo { final StackTraceElement[] trace=thread.getStackTrace(); boolean inIdleJobPoll=false; - for (StackTraceElement t : trace) + // trace can be null on early java 6 jvms + if (trace != null) { - if ("idleJobPoll".equals(t.getMethodName())) + for (StackTraceElement t : trace) { - inIdleJobPoll=true; - break; + if ("idleJobPoll".equals(t.getMethodName())) + { + inIdleJobPoll = true; + break; + } } } final boolean idle=inIdleJobPoll;