Moving classes around, stubbing out new classes for jetty-9 refactor

This commit is contained in:
Joakim Erdfelt 2012-06-12 13:15:40 -07:00
parent 571c6e02ca
commit c7b2297216
39 changed files with 207 additions and 23 deletions

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.client;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -33,6 +33,13 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.MaskGen;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketConnection;
import org.eclipse.jetty.websocket.WebSocketConnectionRFC6455;
import org.eclipse.jetty.websocket.WebSocket.Connection;
import org.eclipse.jetty.websocket.WebSocket.FrameConnection;
import org.eclipse.jetty.websocket.WebSocket.OnFrame;
/* ------------------------------------------------------------ */

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.client;
import java.io.EOFException;
import java.io.IOException;
@ -49,6 +49,12 @@ import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ThreadPool;
import org.eclipse.jetty.websocket.MaskGen;
import org.eclipse.jetty.websocket.RandomMaskGen;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketConnection;
import org.eclipse.jetty.websocket.WebSocketConnectionRFC6455;
import org.eclipse.jetty.websocket.extensions.Extension;
/* ------------------------------------------------------------ */
/**

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.client;
import java.net.InetSocketAddress;
import java.net.URI;
@ -28,6 +28,13 @@ import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketConnectionRFC6455;
import org.eclipse.jetty.websocket.WebSocket.Connection;
import org.eclipse.jetty.websocket.WebSocket.FrameConnection;
import org.eclipse.jetty.websocket.WebSocket.OnFrame;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.WebSocketClientFactory;
/**
* This is not a general purpose websocket client.

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.client;
import java.io.BufferedReader;
import java.io.IOException;
@ -39,6 +39,13 @@ import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jetty.util.BlockingArrayQueue;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketConnectionRFC6455;
import org.eclipse.jetty.websocket.ZeroMaskGen;
import org.eclipse.jetty.websocket.WebSocket.Connection;
import org.eclipse.jetty.websocket.WebSocket.OnTextMessage;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.WebSocketClientFactory;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;

View File

@ -20,6 +20,7 @@ import java.nio.ByteBuffer;
import java.util.List;
import org.eclipse.jetty.io.AsyncConnection;
import org.eclipse.jetty.websocket.extensions.Extension;

View File

@ -50,6 +50,7 @@ import org.eclipse.jetty.websocket.WebSocket.OnBinaryMessage;
import org.eclipse.jetty.websocket.WebSocket.OnControl;
import org.eclipse.jetty.websocket.WebSocket.OnFrame;
import org.eclipse.jetty.websocket.WebSocket.OnTextMessage;
import org.eclipse.jetty.websocket.extensions.Extension;
/* ------------------------------------------------------------ */

View File

@ -44,6 +44,12 @@ import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.extensions.Extension;
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.servlet.helper.WebSocketServletConnection;
import org.eclipse.jetty.websocket.servlet.helper.WebSocketServletConnectionRFC6455;
/**
* Factory to create WebSocket connections

View File

@ -0,0 +1,12 @@
package org.eclipse.jetty.websocket.api;
public class WebSocket {
/**
* Version in use by Safari / OSX
*/
public static final short DRAFT0 = 0;
/**
* Version declared by RFC6455
*/
public static final short RFC6455 = 13;
}

View File

@ -0,0 +1,23 @@
package org.eclipse.jetty.websocket.api;
/**
* A recoverable exception within the websocket framework.
*/
@SuppressWarnings("serial")
public class WebSocketException extends RuntimeException {
public WebSocketException() {
super();
}
public WebSocketException(String message, Throwable cause) {
super(message, cause);
}
public WebSocketException(String message) {
super(message);
}
public WebSocketException(Throwable cause) {
super(cause);
}
}

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.extensions;
import java.io.IOException;
import java.util.HashMap;
@ -21,6 +21,10 @@ import java.util.Map;
import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketGenerator;
import org.eclipse.jetty.websocket.WebSocketParser;
import org.eclipse.jetty.websocket.WebSocket.FrameConnection;
import org.eclipse.jetty.websocket.WebSocketParser.FrameHandler;
public class AbstractExtension implements Extension

View File

@ -13,10 +13,16 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.extensions;
import java.util.Map;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketGenerator;
import org.eclipse.jetty.websocket.WebSocketParser;
import org.eclipse.jetty.websocket.WebSocket.FrameConnection;
import org.eclipse.jetty.websocket.WebSocketParser.FrameHandler;
public interface Extension extends WebSocketParser.FrameHandler, WebSocketGenerator
{
public String getName();

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.extensions.deflate;
import java.io.IOException;
import java.util.Map;
@ -25,6 +25,8 @@ import java.util.zip.Inflater;
import org.eclipse.jetty.io.ByteArrayBuffer;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.WebSocketConnectionRFC6455;
import org.eclipse.jetty.websocket.extensions.AbstractExtension;
/**
* @TODO Implement proposed deflate frame draft

View File

@ -13,11 +13,13 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.extensions.fragment;
import java.io.IOException;
import java.util.Map;
import org.eclipse.jetty.websocket.extensions.AbstractExtension;
public class FragmentExtension extends AbstractExtension
{
private int _maxLength=-1;

View File

@ -13,7 +13,9 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.extensions.identity;
import org.eclipse.jetty.websocket.extensions.AbstractExtension;
public class IdentityExtension extends AbstractExtension
{

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.frames;
public class BinaryFrame {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.frames;
public class CloseFrame {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.frames;
public class ContinuationFrame {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.frames;
public class ControlFrame {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.frames;
public class ControlFrameType {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.frames;
public class PingFrame {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.frames;
public class PongFrame {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.frames;
public class TextFrame {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.generator;
public class ControlFrameGenerator {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.generator;
public class Generator {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.parser;
public class ControlFrameBodyParser {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.parser;
public class ControlFrameParser {
}

View File

@ -0,0 +1,5 @@
package org.eclipse.jetty.websocket.parser;
public class Parser {
}

View File

@ -22,9 +22,11 @@ import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.websocket.helper.CaptureSocket;
import org.eclipse.jetty.websocket.helper.MessageSender;
import org.eclipse.jetty.websocket.helper.WebSocketCaptureServlet;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.WebSocketClientFactory;
import org.eclipse.jetty.websocket.servlet.helper.CaptureSocket;
import org.eclipse.jetty.websocket.servlet.helper.MessageSender;
import org.eclipse.jetty.websocket.servlet.helper.WebSocketCaptureServlet;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;

View File

@ -27,6 +27,8 @@ import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.WebSocketClientFactory;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;

View File

@ -26,6 +26,9 @@ import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.WebSocketClientFactory;
import org.eclipse.jetty.websocket.servlet.helper.WebSocketServlet;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;

View File

@ -26,7 +26,7 @@
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
@ -36,6 +36,8 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.WebSocketFactory;
import org.eclipse.jetty.websocket.WebSocketFactory.Acceptor;
/* ------------------------------------------------------------ */
/**

View File

@ -13,12 +13,14 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.servlet;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.websocket.WebSocketConnection;
public interface WebSocketServletConnection extends WebSocketConnection
{
void handshake(HttpServletRequest request, HttpServletResponse response, String subprotocol) throws IOException;

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.servlet;
import java.io.IOException;
import java.util.List;
@ -21,6 +21,10 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketConnectionRFC6455;
import org.eclipse.jetty.websocket.WebSocketFactory;
import org.eclipse.jetty.websocket.extensions.Extension;
public class WebSocketServletConnectionRFC6455 extends WebSocketConnectionRFC6455 implements WebSocketServletConnection
{

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.servlet;
import java.io.IOException;
import java.util.concurrent.ConcurrentLinkedQueue;
@ -29,6 +29,15 @@ import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketConnectionRFC6455;
import org.eclipse.jetty.websocket.WebSocketHandler;
import org.eclipse.jetty.websocket.WebSocket.Connection;
import org.eclipse.jetty.websocket.WebSocket.FrameConnection;
import org.eclipse.jetty.websocket.WebSocket.OnBinaryMessage;
import org.eclipse.jetty.websocket.WebSocket.OnControl;
import org.eclipse.jetty.websocket.WebSocket.OnFrame;
import org.eclipse.jetty.websocket.WebSocket.OnTextMessage;
public class TestServer extends Server
{

View File

@ -1,4 +1,4 @@
package org.eclipse.jetty.websocket;
package org.eclipse.jetty.websocket.servlet;
import static org.hamcrest.Matchers.*;
@ -20,7 +20,16 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.websocket.helper.MessageSender;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketGeneratorRFC6455Test;
import org.eclipse.jetty.websocket.WebSocketMessageRFC6455Test;
import org.eclipse.jetty.websocket.WebSocketParserRFC6455Test;
import org.eclipse.jetty.websocket.WebSocket.Connection;
import org.eclipse.jetty.websocket.WebSocket.OnTextMessage;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.WebSocketClientFactory;
import org.eclipse.jetty.websocket.servlet.helper.MessageSender;
import org.eclipse.jetty.websocket.servlet.helper.WebSocketServlet;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket.helper;
package org.eclipse.jetty.websocket.servlet.helper;
import java.util.ArrayList;
import java.util.List;

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket.helper;
package org.eclipse.jetty.websocket.servlet.helper;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket.helper;
package org.eclipse.jetty.websocket.servlet.helper;
import java.io.BufferedReader;
import java.io.IOException;

View File

@ -13,7 +13,7 @@
*
* You may elect to redistribute this code under either of these licenses.
*******************************************************************************/
package org.eclipse.jetty.websocket.helper;
package org.eclipse.jetty.websocket.servlet.helper;
import java.io.IOException;
import java.util.ArrayList;
@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.helper.WebSocketServlet;
@SuppressWarnings("serial")
public class WebSocketCaptureServlet extends WebSocketServlet