diff options
Diffstat (limited to 'jetty-websocket/websocket-api/src')
21 files changed, 270 insertions, 66 deletions
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/BatchMode.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/BatchMode.java index c92c776cc3..530cb0b61d 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/BatchMode.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/BatchMode.java @@ -18,8 +18,10 @@ package org.eclipse.jetty.websocket.api; +import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames; + /** - * The possible batch modes when invoking {@link OutgoingFrames#outgoingFrame(Frame, WriteCallback, BatchMode)}. + * The possible batch modes when invoking {@link OutgoingFrames#outgoingFrame(org.eclipse.jetty.websocket.api.extensions.Frame, WriteCallback, BatchMode)}. */ public enum BatchMode { diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/InvalidWebSocketException.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/InvalidWebSocketException.java index 2dfeb85d41..f6bb061bef 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/InvalidWebSocketException.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/InvalidWebSocketException.java @@ -18,6 +18,8 @@ package org.eclipse.jetty.websocket.api; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; + /** * Indicating that the provided Class is not a valid WebSocket as defined by the API. * <p> diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/RemoteEndpoint.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/RemoteEndpoint.java index bbf9655708..990253fb1b 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/RemoteEndpoint.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/RemoteEndpoint.java @@ -31,11 +31,14 @@ public interface RemoteEndpoint * * @param data * the message to be sent + * @throws IOException + * if unable to send the bytes */ void sendBytes(ByteBuffer data) throws IOException; /** - * Initiates the asynchronous transmission of a binary message. This method returns before the message is transmitted. Developers may use the returned + * Initiates the asynchronous transmission of a binary message. This method returns before the message is + * transmitted. Developers may use the returned * Future object to track progress of the transmission. * * @param data @@ -45,7 +48,8 @@ public interface RemoteEndpoint Future<Void> sendBytesByFuture(ByteBuffer data); /** - * Initiates the asynchronous transmission of a binary message. This method returns before the message is transmitted. Developers may provide a callback to + * Initiates the asynchronous transmission of a binary message. This method returns before the message is + * transmitted. Developers may provide a callback to * be notified when the message has been transmitted or resulted in an error. * * @param data @@ -56,38 +60,54 @@ public interface RemoteEndpoint void sendBytes(ByteBuffer data, WriteCallback callback); /** - * Send a binary message in pieces, blocking until all of the message has been transmitted. The runtime reads the message in order. Non-final pieces are + * Send a binary message in pieces, blocking until all of the message has been transmitted. The runtime reads the + * message in order. Non-final pieces are * sent with isLast set to false. The final piece must be sent with isLast set to true. * * @param fragment * the piece of the message being sent + * @param isLast + * true if this is the last piece of the partial bytes + * @throws IOException + * if unable to send the partial bytes */ void sendPartialBytes(ByteBuffer fragment, boolean isLast) throws IOException; /** - * Send a text message in pieces, blocking until all of the message has been transmitted. The runtime reads the message in order. Non-final pieces are sent + * Send a text message in pieces, blocking until all of the message has been transmitted. The runtime reads the + * message in order. Non-final pieces are sent * with isLast set to false. The final piece must be sent with isLast set to true. * * @param fragment * the piece of the message being sent + * @param isLast + * true if this is the last piece of the partial bytes + * @throws IOException + * if unable to send the partial bytes */ void sendPartialString(String fragment, boolean isLast) throws IOException; /** - * Send a Ping message containing the given application data to the remote endpoint. The corresponding Pong message may be picked up using the + * Send a Ping message containing the given application data to the remote endpoint. The corresponding Pong message + * may be picked up using the * MessageHandler.Pong handler. * * @param applicationData * the data to be carried in the ping request + * @throws IOException + * if unable to send the ping */ void sendPing(ByteBuffer applicationData) throws IOException; /** - * Allows the developer to send an unsolicited Pong message containing the given application data in order to serve as a unidirectional heartbeat for the + * Allows the developer to send an unsolicited Pong message containing the given application data in order to serve + * as a unidirectional heartbeat for the * session. * * @param applicationData * the application data to be carried in the pong response. + * @throws IOException + * if unable to send the pong */ void sendPong(ByteBuffer applicationData) throws IOException; @@ -98,11 +118,14 @@ public interface RemoteEndpoint * * @param text * the message to be sent + * @throws IOException + * if unable to send the text message */ void sendString(String text) throws IOException; /** - * Initiates the asynchronous transmission of a text message. This method may return before the message is transmitted. Developers may use the returned + * Initiates the asynchronous transmission of a text message. This method may return before the message is + * transmitted. Developers may use the returned * Future object to track progress of the transmission. * * @param text @@ -112,7 +135,8 @@ public interface RemoteEndpoint Future<Void> sendStringByFuture(String text); /** - * Initiates the asynchronous transmission of a text message. This method may return before the message is transmitted. Developers may provide a callback to + * Initiates the asynchronous transmission of a text message. This method may return before the message is + * transmitted. Developers may provide a callback to * be notified when the message has been transmitted or resulted in an error. * * @param text @@ -139,7 +163,9 @@ public interface RemoteEndpoint /** * Flushes messages that may have been batched by the implementation. - * @throws IOException if the flush fails + * + * @throws IOException + * if the flush fails * @see #getBatchMode() */ void flush() throws IOException; diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java index f9daa0e2e3..3d28ecb290 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java @@ -22,9 +22,10 @@ import java.io.Closeable; import java.io.IOException; import java.net.InetSocketAddress; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; + /** * Session represents an active link of communications with a Remote WebSocket Endpoint. - * <p> */ public interface Session extends Closeable { @@ -80,7 +81,11 @@ public interface Session extends Closeable * Once called, any read/write activity on the websocket from this point will be indeterminate. * <p> * Once the underlying connection has been determined to be closed, the various onClose() events (either - * {@link WebSocketListener#onWebSocketClose(int, String)} or {@link OnWebSocketClose}) will be called on your websocket. + * {@link WebSocketListener#onWebSocketClose(int, String)} or {@link OnWebSocketClose}) will be called on your + * websocket. + * + * @throws IOException + * if unable to disconnect * * @see #close() * @see #close(CloseStatus) diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java index a98a6f39d7..91df0d723b 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java @@ -136,13 +136,15 @@ public class UpgradeResponse /** * Issue a forbidden upgrade response. * <p> - * This means that the websocket endpoint was valid, but the conditions to use a WebSocket resulted in a forbidden access. + * This means that the websocket endpoint was valid, but the conditions to use a WebSocket resulted in a forbidden + * access. * <p> * Use this when the origin or authentication is invalid. * * @param message * the short 1 line detail message about the forbidden response * @throws IOException + * if unable to send the forbidden */ public void sendForbidden(String message) throws IOException { diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketConnectionListener.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketConnectionListener.java new file mode 100644 index 0000000000..dc75fe6e91 --- /dev/null +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketConnectionListener.java @@ -0,0 +1,61 @@ +// +// ======================================================================== +// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.api; + +/** + * Core WebSocket Connection Listener + */ +public interface WebSocketConnectionListener +{ + /** + * A Close Event was received. + * <p> + * The underlying Connection will be considered closed at this point. + * + * @param statusCode + * the close status code. (See {@link StatusCode}) + * @param reason + * the optional reason for the close. + */ + void onWebSocketClose(int statusCode, String reason); + + /** + * A WebSocket {@link Session} has connected successfully and is ready to be used. + * <p> + * Note: It is a good idea to track this session as a field in your object so that you can write messages back via the {@link RemoteEndpoint} + * + * @param session + * the websocket session. + */ + void onWebSocketConnect(Session session); + + /** + * A WebSocket exception has occurred. + * <p> + * This is a way for the internal implementation to notify of exceptions occured during the processing of websocket. + * <p> + * Usually this occurs from bad / malformed incoming packets. (example: bad UTF8 data, frames that are too big, violations of the spec) + * <p> + * This will result in the {@link Session} being closed by the implementing side. + * + * @param cause + * the error that occurred. + */ + void onWebSocketError(Throwable cause); +} diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketFrameListener.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketFrameListener.java new file mode 100644 index 0000000000..2f30b79a03 --- /dev/null +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketFrameListener.java @@ -0,0 +1,34 @@ +// +// ======================================================================== +// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.api; + +import org.eclipse.jetty.websocket.api.extensions.Frame; + +/** + * WebSocket Frame Listener interface for incoming WebSocket frames. + */ +public interface WebSocketFrameListener extends WebSocketConnectionListener +{ + /** + * A WebSocket frame has been received. + * + * @param frame the immutable frame received + */ + void onWebSocketFrame(Frame frame); +} diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketListener.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketListener.java index b86095154b..9bb12c4458 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketListener.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketListener.java @@ -19,9 +19,9 @@ package org.eclipse.jetty.websocket.api; /** - * Basic WebSocket Listener interface for incoming WebSocket events. + * Basic WebSocket Listener interface for incoming WebSocket message events. */ -public interface WebSocketListener +public interface WebSocketListener extends WebSocketConnectionListener { /** * A WebSocket binary frame has been received. @@ -36,45 +36,9 @@ public interface WebSocketListener void onWebSocketBinary(byte payload[], int offset, int len); /** - * A Close Event was received. - * <p> - * The underlying Connection will be considered closed at this point. - * - * @param statusCode - * the close status code. (See {@link StatusCode}) - * @param reason - * the optional reason for the close. - */ - void onWebSocketClose(int statusCode, String reason); - - /** - * A WebSocket {@link Session} has connected successfully and is ready to be used. - * <p> - * Note: It is a good idea to track this session as a field in your object so that you can write messages back via the {@link RemoteEndpoint} - * - * @param session - * the websocket session. - */ - void onWebSocketConnect(Session session); - - /** - * A WebSocket exception has occurred. - * <p> - * This is a way for the internal implementation to notify of exceptions occured during the processing of websocket. - * <p> - * Usually this occurs from bad / malformed incoming packets. (example: bad UTF8 data, frames that are too big, violations of the spec) - * <p> - * This will result in the {@link Session} being closed by the implementing side. - * - * @param error - * the error that occurred. - */ - void onWebSocketError(Throwable cause); - - /** * A WebSocket Text frame was received. * - * @param message + * @param message the message */ void onWebSocketText(String message); } diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPartialListener.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPartialListener.java new file mode 100644 index 0000000000..a9d03cdb5c --- /dev/null +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPartialListener.java @@ -0,0 +1,58 @@ +// +// ======================================================================== +// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.api; + +import java.nio.ByteBuffer; + +/** + * WebSocket Partial Message Listener interface for incoming WebSocket TEXT/BINARY/CONTINUATION frames. + */ +public interface WebSocketPartialListener extends WebSocketConnectionListener +{ + /** + * A WebSocket BINARY (or associated CONTINUATION) frame has been received. + * <p> + * <b>Important Note</b>: The payload <code>ByteBuffer</code> cannot be modified, and the ByteBuffer object itself + * will be recycled on completion of this method call, make a copy of the data contained within if you want to + * retain it between calls. + * + * @param payload + * the binary message frame payload + * @param fin + * true if this is the final frame, false otherwise + */ + void onWebSocketPartialBinary(ByteBuffer payload, boolean fin); + + /** + * A WebSocket TEXT (or associated CONTINUATION) frame has been received. + * + * @param payload + * the text message payload + * <p> + * Note that due to framing, there is a above average chance of any UTF8 sequences being split on the + * border between two frames will result in either the previous frame, or the next frame having an + * invalid UTF8 sequence, but the combined frames having a valid UTF8 sequence. + * <p> + * The String being provided here will not end in a split UTF8 sequence. Instead this partial sequence + * will be held over until the next frame is received. + * @param fin + * true if this is the final frame, false otherwise + */ + void onWebSocketPartialText(String payload, boolean fin); +} diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPingPongListener.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPingPongListener.java new file mode 100644 index 0000000000..fa74c339d8 --- /dev/null +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPingPongListener.java @@ -0,0 +1,43 @@ +// +// ======================================================================== +// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.api; + +import java.nio.ByteBuffer; + +/** + * WebSocket PING/PONG Listener interface for incoming WebSocket PING/PONG frames. + */ +public interface WebSocketPingPongListener extends WebSocketConnectionListener +{ + /** + * A WebSocket PING has been received. + * + * @param payload + * the ping payload + */ + void onWebSocketPing(ByteBuffer payload); + + /** + * A WebSocket PONG has been received. + * + * @param payload + * the pong payload + */ + void onWebSocketPong(ByteBuffer payload); +} diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketClose.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketClose.java index a29fab3ef7..461663b733 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketClose.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketClose.java @@ -24,6 +24,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.eclipse.jetty.websocket.api.Session; + /** * Annotation for tagging methods to receive connection close events. * <p> diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketConnect.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketConnect.java index 89690f3e33..f74b3c6b08 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketConnect.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketConnect.java @@ -24,6 +24,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.eclipse.jetty.websocket.api.Session; + /** * Annotation for tagging methods to receive connection open events. * <p> diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketError.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketError.java index 1fb9e6bc6f..5ef8caa33c 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketError.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketError.java @@ -24,12 +24,13 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.eclipse.jetty.websocket.api.Session; + /** * Annotation for receiving websocket errors (exceptions) that have occurred internally in the websocket implementation. * <p> * Acceptable method patterns.<br> * Note: <code>methodName</code> can be any name you want to use. - * <p> * <ol> * <li><code>public void methodName({@link Throwable} error)</code></li> * <li><code>public void methodName({@link Session} session, {@link Throwable} error)</code></li> diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketFrame.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketFrame.java index f3bcd0dd3b..7dcae2343b 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketFrame.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketFrame.java @@ -24,14 +24,16 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.eclipse.jetty.websocket.api.Session; + /** * (ADVANCED) Annotation for tagging methods to receive frame events. * <p> * Acceptable method patterns.<br> * Note: <code>methodName</code> can be any name you want to use. * <ol> - * <li><code>public void methodName({@link Frame} frame)</code></li> - * <li><code>public void methodName({@link Session} session, {@link Frame} frame)</code></li> + * <li><code>public void methodName({@link org.eclipse.jetty.websocket.api.extensions.Frame} frame)</code></li> + * <li><code>public void methodName({@link Session} session, {@link org.eclipse.jetty.websocket.api.extensions.Frame} frame)</code></li> * </ol> */ @Documented diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketMessage.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketMessage.java index 74f687b4d2..eb96580ad4 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketMessage.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/annotations/OnWebSocketMessage.java @@ -18,12 +18,15 @@ package org.eclipse.jetty.websocket.api.annotations; +import java.io.Reader; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.eclipse.jetty.websocket.api.Session; + /** * Annotation for tagging methods to receive Binary or Text Message events. * <p> diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/Extension.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/Extension.java index ebcb7dab1d..4cee100f03 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/Extension.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/Extension.java @@ -36,6 +36,7 @@ public interface Extension extends IncomingFrames, OutgoingFrames * The <code>Sec-WebSocket-Extensions</code> name for this extension. * <p> * Also known as the <a href="https://tools.ietf.org/html/rfc6455#section-9.1"><code>extension-token</code> per Section 9.1. Negotiating Extensions</a>. + * @return the name of the extension */ public String getName(); @@ -81,9 +82,4 @@ public interface Extension extends IncomingFrames, OutgoingFrames * the next outgoing extension */ public void setNextOutgoingFrames(OutgoingFrames nextOutgoing); - - // TODO: Extension should indicate if it requires boundary of fragments to be preserved - - // TODO: Extension should indicate if it uses the Extension data field of frame for its own reasons. - } diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionConfig.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionConfig.java index 1041bc5d74..5036eb7a5b 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionConfig.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionConfig.java @@ -128,6 +128,7 @@ public class ExtensionConfig /** * Copy constructor + * @param copy the extension config to copy */ public ExtensionConfig(ExtensionConfig copy) { diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/Frame.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/Frame.java index 3dec2fa9db..ecce110651 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/Frame.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/Frame.java @@ -103,8 +103,9 @@ public interface Frame * Same as {@link #isFin()} * * @return true if final frame. + * @deprecated use {@link #isFin()} instead */ - // FIXME: remove + @Deprecated public boolean isLast(); public boolean isMasked(); diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java index 2f6cea3f42..9476cff437 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java @@ -28,10 +28,10 @@ public interface OutgoingFrames { /** * A frame, and optional callback, intended for the network layer. - * <p/> + * <p> * Note: the frame can undergo many transformations in the various * layers and extensions present in the implementation. - * <p/> + * <p> * If you are implementing a mutation, you are obliged to handle * the incoming WriteCallback appropriately. * diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java index faf9674a10..c4931c0a84 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/QuoteUtil.java @@ -27,7 +27,6 @@ import java.util.NoSuchElementException; * Provide some consistent Http header value and Extension configuration parameter quoting support. * <p> * While QuotedStringTokenizer exists in jetty-util, and works great with http header values, using it in websocket-api is undesired. - * <p> * <ul> * <li>Using QuotedStringTokenizer would introduce a dependency to jetty-util that would need to be exposed via the WebAppContext classloader</li> * <li>ABNF defined extension parameter parsing requirements of RFC-6455 (WebSocket) ABNF, is slightly different than the ABNF parsing defined in RFC-2616 diff --git a/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilTest.java b/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilTest.java index d475ec0fa7..c3d8606d4b 100644 --- a/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilTest.java +++ b/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilTest.java @@ -18,8 +18,8 @@ package org.eclipse.jetty.websocket.api.util; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; import java.util.Iterator; import java.util.NoSuchElementException; |