Issue #2175 cleanups after review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
8aca98976d
commit
f9b9cc1313
|
@ -32,7 +32,14 @@ import org.eclipse.jetty.http.HttpVersion;
|
|||
import org.eclipse.jetty.http.pathmap.PathSpec;
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.io.MappedByteBufferPool;
|
||||
import org.eclipse.jetty.server.*;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.LocalConnector;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.server.SslConnectionFactory;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
|
|
|
@ -38,7 +38,9 @@ import org.junit.jupiter.api.BeforeAll;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
/**
|
||||
* Tests a {@link javax.websocket.Decoder.TextStream} automatic decoding to a Socket onMessage parameter
|
||||
|
|
|
@ -25,7 +25,12 @@ import java.net.URI;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.ContainerProvider;
|
||||
import javax.websocket.Endpoint;
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.MessageHandler;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketContainer;
|
||||
import javax.websocket.server.ServerContainer;
|
||||
import javax.websocket.server.ServerEndpointConfig;
|
||||
|
||||
|
|
|
@ -31,7 +31,13 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.ContainerProvider;
|
||||
import javax.websocket.Endpoint;
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.OnError;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketContainer;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
|
|
|
@ -19,18 +19,15 @@
|
|||
package org.eclipse.jetty.websocket.core.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Queue;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.DecoratedObjectFactory;
|
||||
import org.eclipse.jetty.util.IteratingCallback;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
|
@ -201,7 +198,7 @@ public class ExtensionStack implements IncomingFrames, OutgoingFrames, Dumpable
|
|||
outgoing.sendFrame(frame, callback, batch);
|
||||
}
|
||||
|
||||
public void connect(IncomingFrames incoming, OutgoingFrames outgoing, WebSocketChannel webSocketChannel)
|
||||
public void initialize(IncomingFrames incoming, OutgoingFrames outgoing, WebSocketChannel webSocketChannel)
|
||||
{
|
||||
if (extensions == null)
|
||||
throw new IllegalStateException();
|
||||
|
|
|
@ -79,7 +79,7 @@ public class WebSocketChannel implements IncomingFrames, FrameHandler.CoreSessio
|
|||
this.behavior = behavior;
|
||||
this.negotiated = negotiated;
|
||||
this.demanding = handler.isDemanding();
|
||||
negotiated.getExtensions().connect(new IncomingAdaptor(), new OutgoingAdaptor(), this);
|
||||
negotiated.getExtensions().initialize(new IncomingAdaptor(), new OutgoingAdaptor(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +153,7 @@ public class WebSocketChannel implements IncomingFrames, FrameHandler.CoreSessio
|
|||
if (frame.getOpCode() == OpCode.CLOSE)
|
||||
{
|
||||
if (!(frame instanceof ParsedFrame)) // already check in parser
|
||||
CloseStatus.getCloseStatus(frame);
|
||||
CloseStatus.getCloseStatus(frame); // return ignored as get used to validate there is a closeStatus
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -237,7 +237,7 @@ public class WebSocketChannel implements IncomingFrames, FrameHandler.CoreSessio
|
|||
@Override
|
||||
public boolean isOpen()
|
||||
{
|
||||
return channelState.isOutOpen();
|
||||
return channelState.isOutputOpen();
|
||||
}
|
||||
|
||||
public void setWebSocketConnection(WebSocketConnection connection)
|
||||
|
@ -640,7 +640,7 @@ public class WebSocketChannel implements IncomingFrames, FrameHandler.CoreSessio
|
|||
@Override
|
||||
public void completed()
|
||||
{
|
||||
if (channelState.isOutOpen())
|
||||
if (channelState.isOutputOpen())
|
||||
{
|
||||
CloseStatus closeStatus = CloseStatus.getCloseStatus(frame);
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ public class WebSocketChannelState
|
|||
CONNECTING,
|
||||
CONNECTED,
|
||||
OPEN,
|
||||
ICLOSED,
|
||||
OCLOSED,
|
||||
ISHUT,
|
||||
OSHUT,
|
||||
CLOSED
|
||||
}
|
||||
|
||||
|
@ -85,16 +85,16 @@ public class WebSocketChannelState
|
|||
return getState()==State.CLOSED;
|
||||
}
|
||||
|
||||
public boolean isInOpen()
|
||||
public boolean isInputOpen()
|
||||
{
|
||||
State state = getState();
|
||||
return (state==State.OPEN || state==State.OCLOSED);
|
||||
return (state==State.OPEN || state==State.OSHUT);
|
||||
}
|
||||
|
||||
public boolean isOutOpen()
|
||||
public boolean isOutputOpen()
|
||||
{
|
||||
State state = getState();
|
||||
return (state==State.OPEN || state==State.ICLOSED);
|
||||
return (state==State.OPEN || state==State.ISHUT);
|
||||
}
|
||||
|
||||
public CloseStatus getCloseStatus()
|
||||
|
@ -125,7 +125,7 @@ public class WebSocketChannelState
|
|||
|
||||
synchronized (this)
|
||||
{
|
||||
if (!isOutOpen())
|
||||
if (!isOutputOpen())
|
||||
throw new IllegalStateException(_channelState.toString());
|
||||
|
||||
if (opcode == OpCode.CLOSE)
|
||||
|
@ -135,9 +135,9 @@ public class WebSocketChannelState
|
|||
switch (_channelState)
|
||||
{
|
||||
case OPEN:
|
||||
_channelState = State.OCLOSED;
|
||||
_channelState = State.OSHUT;
|
||||
return false;
|
||||
case ICLOSED:
|
||||
case ISHUT:
|
||||
_channelState = State.CLOSED;
|
||||
return true;
|
||||
default:
|
||||
|
@ -160,7 +160,7 @@ public class WebSocketChannelState
|
|||
|
||||
synchronized (this)
|
||||
{
|
||||
if (!isInOpen())
|
||||
if (!isInputOpen())
|
||||
throw new IllegalStateException(_channelState.toString());
|
||||
|
||||
if (opcode == OpCode.CLOSE)
|
||||
|
@ -170,9 +170,9 @@ public class WebSocketChannelState
|
|||
switch (_channelState)
|
||||
{
|
||||
case OPEN:
|
||||
_channelState = State.ICLOSED;
|
||||
_channelState = State.ISHUT;
|
||||
return false;
|
||||
case OCLOSED:
|
||||
case OSHUT:
|
||||
_channelState = State.CLOSED;
|
||||
return true;
|
||||
default:
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
package org.eclipse.jetty.websocket.core.extensions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.io.MappedByteBufferPool;
|
||||
import org.eclipse.jetty.util.DecoratedObjectFactory;
|
||||
|
@ -35,9 +38,6 @@ import org.eclipse.jetty.websocket.core.internal.IdentityExtension;
|
|||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
@ -80,7 +80,7 @@ public class ExtensionStackTest
|
|||
// Setup Listeners
|
||||
IncomingFrames session = new IncomingFramesCapture();
|
||||
OutgoingFrames connection = new OutgoingFramesCapture();
|
||||
stack.connect(session, connection, null);
|
||||
stack.initialize(session, connection, null);
|
||||
|
||||
// Dump
|
||||
LOG.debug("{}", stack.dump());
|
||||
|
@ -104,7 +104,7 @@ public class ExtensionStackTest
|
|||
// Setup Listeners
|
||||
IncomingFrames session = new IncomingFramesCapture();
|
||||
OutgoingFrames connection = new OutgoingFramesCapture();
|
||||
stack.connect(session, connection, null);
|
||||
stack.initialize(session, connection, null);
|
||||
|
||||
// Dump
|
||||
LOG.debug("{}", stack.dump());
|
||||
|
|
|
@ -27,7 +27,12 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.pathmap.*;
|
||||
import org.eclipse.jetty.http.pathmap.MappedResource;
|
||||
import org.eclipse.jetty.http.pathmap.PathMappings;
|
||||
import org.eclipse.jetty.http.pathmap.PathSpec;
|
||||
import org.eclipse.jetty.http.pathmap.RegexPathSpec;
|
||||
import org.eclipse.jetty.http.pathmap.ServletPathSpec;
|
||||
import org.eclipse.jetty.http.pathmap.UriTemplatePathSpec;
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.io.MappedByteBufferPool;
|
||||
import org.eclipse.jetty.io.RuntimeIOException;
|
||||
|
|
Loading…
Reference in New Issue