Issue #207 - Support javax.websocket version 1.1

This commit is contained in:
Joakim Erdfelt 2016-08-19 15:21:33 -07:00
parent 0df8a766b7
commit de7c7ca7af
5 changed files with 28 additions and 28 deletions

View File

@ -21,12 +21,10 @@ package org.eclipse.jetty.websocket.jsr356;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;

View File

@ -24,15 +24,17 @@
</modules>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<onlyAnalyze>org.eclipse.jetty.websocket.*</onlyAnalyze>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<onlyAnalyze>org.eclipse.jetty.websocket.*</onlyAnalyze>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -88,9 +88,10 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
private ClassLoader classLoader;
private ExtensionFactory extensionFactory;
private BatchMode batchmode = BatchMode.AUTO;
private RemoteEndpointFactory remoteEndpointFactory;
private String protocolVersion;
private Map<String, String[]> parameterMap = new HashMap<>();
private WebSocketRemoteEndpoint remote;
private RemoteEndpoint remote;
private OutgoingFrames outgoingHandler;
private WebSocketPolicy policy;
private UpgradeRequest upgradeRequest;
@ -123,13 +124,13 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
public void close()
{
/* This is assumed to always be a NORMAL closure, no reason phrase */
connection.close(StatusCode.NORMAL, null);
close(StatusCode.NORMAL, null);
}
@Override
public void close(CloseStatus closeStatus)
{
this.close(closeStatus.getCode(), closeStatus.getPhrase());
close(closeStatus.getCode(),closeStatus.getPhrase());
}
@Override
@ -183,16 +184,13 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
if (LOG.isDebugEnabled())
LOG.debug("stopping - {}", this);
if (getConnection() != null)
try
{
try
{
getConnection().close(StatusCode.SHUTDOWN, "Shutdown");
}
catch (Throwable t)
{
LOG.debug("During Connection Shutdown", t);
}
close(StatusCode.SHUTDOWN,"Shutdown");
}
catch (Throwable t)
{
LOG.debug("During Connection Shutdown",t);
}
super.doStop();
}
@ -601,6 +599,11 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
}
}
public WebSocketRemoteEndpoint newRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoingFrames, BatchMode batchMode)
{
return new WebSocketRemoteEndpoint(connection,outgoingHandler,getBatchMode());
}
/**
* Open/Activate the session
*/
@ -621,7 +624,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
connection.getIOState().onConnected();
// Connect remote
remote = new WebSocketRemoteEndpoint(connection, outgoingHandler, getBatchMode());
remote = remoteEndpointFactory.newRemoteEndpoint(connection,outgoingHandler,getBatchMode());
if (LOG_OPEN.isDebugEnabled())
LOG_OPEN.debug("[{}] {}.open() remote={}", policy.getBehavior(), this.getClass().getSimpleName(), remote);

View File

@ -63,6 +63,7 @@ public class MessageWriterTest
public void closeSession() throws Exception
{
session.close();
session.stop();
remoteSession.close();
remoteSession.stop();
}

View File

@ -225,10 +225,6 @@ public class WebSocketServletRFCTest
CloseInfo close = new CloseInfo(cf);
Assert.assertThat("Close Frame.status code",close.getStatusCode(),is(StatusCode.SERVER_ERROR));
}
finally
{
client.close();
}
}
/**