Renaming DeflateFrameExtension in response to spec name change

This commit is contained in:
Joakim Erdfelt 2012-09-17 11:26:27 -07:00
parent 707ff4aea8
commit dc2a13602e
4 changed files with 21 additions and 29 deletions

View File

@ -18,11 +18,11 @@
package org.eclipse.jetty.websocket.api;
import org.eclipse.jetty.websocket.extensions.deflate.DeflateFrameExtension;
import org.eclipse.jetty.websocket.extensions.permessage.CompressExtension;
/**
* Exception to terminate the connection because it has received data within a frame payload that was not consistent with the requirements of that frame
* payload. (eg: not UTF-8 in a text frame, or a bad data seen in the {@link DeflateFrameExtension})
* payload. (eg: not UTF-8 in a text frame, or a bad data seen in the {@link CompressExtension})
*
* @see StatusCode#BAD_PAYLOAD
*/

View File

@ -30,9 +30,9 @@ import org.eclipse.jetty.websocket.api.Extension;
import org.eclipse.jetty.websocket.api.ExtensionRegistry;
import org.eclipse.jetty.websocket.api.WebSocketException;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.extensions.deflate.DeflateFrameExtension;
import org.eclipse.jetty.websocket.extensions.fragment.FragmentExtension;
import org.eclipse.jetty.websocket.extensions.identity.IdentityExtension;
import org.eclipse.jetty.websocket.extensions.permessage.CompressExtension;
import org.eclipse.jetty.websocket.protocol.ExtensionConfig;
public class WebSocketExtensionRegistry implements ExtensionRegistry
@ -50,7 +50,7 @@ public class WebSocketExtensionRegistry implements ExtensionRegistry
this.registry.put("identity",IdentityExtension.class);
this.registry.put("fragment",FragmentExtension.class);
this.registry.put("x-deflate-frame",DeflateFrameExtension.class);
this.registry.put("permessage-compress",CompressExtension.class);
}
@Override

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.extensions.deflate;
package org.eclipse.jetty.websocket.extensions.permessage;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -35,13 +35,14 @@ import org.eclipse.jetty.websocket.protocol.ExtensionConfig;
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
/**
* @TODO Implement proposed deflate frame draft
* Per Message Compression extension for WebSocket.
* <p>
* Attempts to follow <a href="https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-00">draft-ietf-hybi-permessage-compression-00</a>
*/
public class DeflateFrameExtension extends Extension
public class CompressExtension extends Extension
{
private static final Logger LOG = Log.getLogger(DeflateFrameExtension.class);
private static final Logger LOG = Log.getLogger(CompressExtension.class);
private int minLength = 8;
private Deflater deflater;
private Inflater inflater;
@ -193,13 +194,6 @@ public class DeflateFrameExtension extends Extension
return;
}
if (frame.getPayloadLength() < minLength)
{
// skip, frame too small to care compressing it.
nextOutput(context,callback,frame);
return;
}
ByteBuffer data = frame.getPayload();
try
{
@ -258,8 +252,6 @@ public class DeflateFrameExtension extends Extension
{
super.setConfig(config);
minLength = config.getParameter("minLength",minLength);
deflater = new Deflater(Deflater.BEST_COMPRESSION);
deflater.setStrategy(Deflater.DEFAULT_STRATEGY);
inflater = new Inflater();
@ -268,7 +260,7 @@ public class DeflateFrameExtension extends Extension
@Override
public String toString()
{
return String.format("DeflateFrameExtension[minLength=%d]",minLength);
return String.format("CompressExtension[]");
}
/**

View File

@ -31,7 +31,7 @@ import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.websocket.ByteBufferAssert;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.extensions.deflate.DeflateFrameExtension;
import org.eclipse.jetty.websocket.extensions.permessage.CompressExtension;
import org.eclipse.jetty.websocket.protocol.ExtensionConfig;
import org.eclipse.jetty.websocket.protocol.IncomingFramesCapture;
import org.eclipse.jetty.websocket.protocol.OpCode;
@ -72,7 +72,7 @@ public class DeflateFrameExtensionTest
policy.setBufferSize(100000);
policy.setMaxPayloadSize(150000);
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(policy);
@ -110,7 +110,7 @@ public class DeflateFrameExtensionTest
// ensure that test remains sane
Assert.assertThat("Medium Payload Length",msg.length(),allOf(greaterThanOrEqualTo(0x7E),lessThanOrEqualTo(0xFF_FF)));
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = ExtensionConfig.parse("x-deflate-frame;minLength=8");
@ -133,7 +133,7 @@ public class DeflateFrameExtensionTest
@Test
public void testFlateSmall()
{
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = ExtensionConfig.parse("x-deflate-frame;minLength=8");
@ -168,7 +168,7 @@ public class DeflateFrameExtensionTest
@Test
public void testFlateSmall_Many()
{
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = ExtensionConfig.parse("x-deflate-frame;minLength=8");
@ -203,7 +203,7 @@ public class DeflateFrameExtensionTest
{
IncomingFramesCapture capture = new IncomingFramesCapture();
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = ExtensionConfig.parse("x-deflate-frame;minLength=16");
@ -257,7 +257,7 @@ public class DeflateFrameExtensionTest
public void testIncomingPing() {
IncomingFramesCapture capture = new IncomingFramesCapture();
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = ExtensionConfig.parse("x-deflate-frame;minLength=16");
@ -292,7 +292,7 @@ public class DeflateFrameExtensionTest
{
IncomingFramesCapture capture = new IncomingFramesCapture();
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = ExtensionConfig.parse("x-deflate-frame;minLength=16");
@ -346,7 +346,7 @@ public class DeflateFrameExtensionTest
{
OutgoingFramesCapture capture = new OutgoingFramesCapture();
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = ExtensionConfig.parse("x-deflate-frame;minLength=16");
@ -412,7 +412,7 @@ public class DeflateFrameExtensionTest
{
OutgoingFramesCapture capture = new OutgoingFramesCapture();
DeflateFrameExtension ext = new DeflateFrameExtension();
CompressExtension ext = new CompressExtension();
ext.setBufferPool(new MappedByteBufferPool());
ext.setPolicy(WebSocketPolicy.newServerPolicy());
ExtensionConfig config = ExtensionConfig.parse("x-deflate-frame;minLength=16");