Rolling Extension and ExtensionConfig change into rest of websocket-common

This commit is contained in:
Joakim Erdfelt 2012-11-06 15:51:23 -07:00
parent 11ff35ccbb
commit a7968c07be
8 changed files with 24 additions and 25 deletions

View File

@ -24,9 +24,9 @@ import org.eclipse.jetty.websocket.api.WebSocketException;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.extensions.Extension;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.api.extensions.ExtensionRegistry;
import org.eclipse.jetty.websocket.api.extensions.ExtensionFactory;
public class WebSocketExtensionRegistry extends ExtensionRegistry
public class WebSocketExtensionRegistry extends ExtensionFactory
{
private WebSocketPolicy policy;
private ByteBufferPool bufferPool;

View File

@ -35,6 +35,7 @@ import org.eclipse.jetty.websocket.api.SuspendToken;
import org.eclipse.jetty.websocket.api.WebSocketConnection;
import org.eclipse.jetty.websocket.api.WebSocketException;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.extensions.Extension;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.ConnectionState;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
@ -97,7 +98,7 @@ public class MuxChannel implements WebSocketConnection, InternalConnection, Inco
}
@Override
public void configureFromExtensions(List<AbstractExtension> extensions)
public void configureFromExtensions(List<Extension> extensions)
{
/* ignore */
}

View File

@ -43,12 +43,12 @@ import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.SuspendToken;
import org.eclipse.jetty.websocket.api.WebSocketConnection;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.ConnectionState;
import org.eclipse.jetty.websocket.common.Generator;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.RequestedExtensionConfig;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
/**
@ -67,7 +67,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
private final FrameQueue queue;
private final AtomicBoolean suspendToken;
private WebSocketSession session;
private List<RequestedExtensionConfig> extensions;
private List<ExtensionConfig> extensions;
private boolean flushing;
private boolean isFilling;
private ConnectionState connectionState;
@ -217,7 +217,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
*
* @return the list of negotiated extensions in use.
*/
public List<RequestedExtensionConfig> getExtensions()
public List<ExtensionConfig> getExtensions()
{
return extensions;
}
@ -484,7 +484,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
* @param extensions
* the list of negotiated extensions in use.
*/
public void setExtensions(List<RequestedExtensionConfig> extensions)
public void setExtensions(List<ExtensionConfig> extensions)
{
this.extensions = extensions;
}

View File

@ -20,12 +20,13 @@ package org.eclipse.jetty.websocket.common.io;
import java.util.List;
import org.eclipse.jetty.websocket.api.extensions.Extension;
import org.eclipse.jetty.websocket.common.LogicalConnection;
import org.eclipse.jetty.websocket.common.extensions.AbstractExtension;
public interface InternalConnection extends LogicalConnection
{
void configureFromExtensions(List<AbstractExtension> extensions);
// TODO: find way to remove
void configureFromExtensions(List<Extension> extensions);
void setIncoming(IncomingFrames incoming);

View File

@ -37,7 +37,6 @@ import org.eclipse.jetty.websocket.common.ByteBufferAssert;
import org.eclipse.jetty.websocket.common.IncomingFramesCapture;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.OutgoingFramesCapture;
import org.eclipse.jetty.websocket.common.RequestedExtensionConfig;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.extensions.fragment.FragmentExtension;
import org.junit.Assert;
@ -56,7 +55,7 @@ public class FragmentExtensionTest
FragmentExtension ext = new FragmentExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("fragment;maxLength=4");
ExtensionConfig config = ExtensionConfig.parse("fragment;maxLength=4");
ext.setConfig(config);
FrameHandler incomingHandler = ext.createIncomingFrameHandler(capture);
@ -108,7 +107,7 @@ public class FragmentExtensionTest
FragmentExtension ext = new FragmentExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("fragment;maxLength=4");
ExtensionConfig config = ExtensionConfig.parse("fragment;maxLength=4");
ext.setConfig(config);
FrameHandler incomingHandler = ext.createIncomingFrameHandler(capture);
@ -143,7 +142,7 @@ public class FragmentExtensionTest
FragmentExtension ext = new FragmentExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("fragment;maxLength=20");
ExtensionConfig config = ExtensionConfig.parse("fragment;maxLength=20");
ext.setConfig(config);
FrameHandler outgoingHandler = ext.createOutgoingFrameHandler(capture);
@ -212,7 +211,7 @@ public class FragmentExtensionTest
FragmentExtension ext = new FragmentExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("fragment");
ExtensionConfig config = ExtensionConfig.parse("fragment");
ext.setConfig(config);
FrameHandler outgoingHandler = ext.createOutgoingFrameHandler(capture);
@ -276,7 +275,7 @@ public class FragmentExtensionTest
FragmentExtension ext = new FragmentExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("fragment;maxLength=4");
ExtensionConfig config = ExtensionConfig.parse("fragment;maxLength=4");
ext.setConfig(config);
FrameHandler outgoingHandler = ext.createOutgoingFrameHandler(capture);

View File

@ -47,7 +47,7 @@ public class IdentityExtensionTest
{
IncomingFramesCapture capture = new IncomingFramesCapture();
AbstractExtension ext = new IdentityExtension();
Extension ext = new IdentityExtension();
FrameHandler incomingHandler = ext.createIncomingFrameHandler(capture);
WebSocketFrame frame = WebSocketFrame.text("hello");

View File

@ -38,7 +38,6 @@ import org.eclipse.jetty.websocket.common.ByteBufferAssert;
import org.eclipse.jetty.websocket.common.IncomingFramesCapture;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.OutgoingFramesCapture;
import org.eclipse.jetty.websocket.common.RequestedExtensionConfig;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.junit.Assert;
import org.junit.Test;
@ -53,7 +52,7 @@ public class PerMessageCompressionExtensionTest
PerMessageCompressionExtension ext = new PerMessageCompressionExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(policy);
ExtensionConfig config = RequestedExtensionConfig.parse("permessage-compress");
ExtensionConfig config = ExtensionConfig.parse("permessage-compress");
ext.setConfig(config);
// Setup capture of incoming frames
@ -166,7 +165,7 @@ public class PerMessageCompressionExtensionTest
PerMessageCompressionExtension ext = new PerMessageCompressionExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("permessage-compress");
ExtensionConfig config = ExtensionConfig.parse("permessage-compress");
ext.setConfig(config);
// Setup capture of incoming frames
@ -203,7 +202,7 @@ public class PerMessageCompressionExtensionTest
PerMessageCompressionExtension ext = new PerMessageCompressionExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("permessage-compress");
ExtensionConfig config = ExtensionConfig.parse("permessage-compress");
ext.setConfig(config);
// Setup capture of incoming frames
@ -258,7 +257,7 @@ public class PerMessageCompressionExtensionTest
PerMessageCompressionExtension ext = new PerMessageCompressionExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("permessage-compress");
ExtensionConfig config = ExtensionConfig.parse("permessage-compress");
ext.setConfig(config);
// Setup capture of outgoing frames
@ -318,7 +317,7 @@ public class PerMessageCompressionExtensionTest
PerMessageCompressionExtension ext = new PerMessageCompressionExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = RequestedExtensionConfig.parse("permessage-compress");
ExtensionConfig config = ExtensionConfig.parse("permessage-compress");
ext.setConfig(config);
// Setup capture of outgoing frames

View File

@ -41,7 +41,6 @@ import org.eclipse.jetty.websocket.common.IncomingFramesCapture;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.OutgoingNetworkBytesCapture;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.RequestedExtensionConfig;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.extensions.IncomingFrameHandler;
import org.eclipse.jetty.websocket.common.io.IncomingFrames;
@ -58,7 +57,7 @@ public class WebkitDeflateFrameExtensionTest
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(policy);
ExtensionConfig config = RequestedExtensionConfig.parse("x-webkit-deflate-frame");
ExtensionConfig config = ExtensionConfig.parse("x-webkit-deflate-frame");
ext.setConfig(config);
// Setup capture of incoming frames
@ -102,7 +101,7 @@ public class WebkitDeflateFrameExtensionTest
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(policy);
ExtensionConfig config = RequestedExtensionConfig.parse("x-webkit-deflate-frame");
ExtensionConfig config = ExtensionConfig.parse("x-webkit-deflate-frame");
ext.setConfig(config);
ByteBufferPool bufferPool = new MappedByteBufferPool();