Index: 3rdParty_sources/versions.txt =================================================================== diff -u -r345648e21e2c2b088c907ed812175477dd9b78f2 -rec3c5a5adbf38c525b3d3f2aec05af3f78f3968f --- 3rdParty_sources/versions.txt (.../versions.txt) (revision 345648e21e2c2b088c907ed812175477dd9b78f2) +++ 3rdParty_sources/versions.txt (.../versions.txt) (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f) @@ -54,4 +54,6 @@ xmltooling 1.4.0 -XStream 1.5.0 \ No newline at end of file +XStream 1.5.0 + +websocket api_1.1_spec-1.1.0.Final \ No newline at end of file Index: 3rdParty_sources/websocket/javax/websocket/ClientEndpoint.java =================================================================== diff -u --- 3rdParty_sources/websocket/javax/websocket/ClientEndpoint.java (revision 0) +++ 3rdParty_sources/websocket/javax/websocket/ClientEndpoint.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f) @@ -0,0 +1,105 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * http://glassfish.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package javax.websocket; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * The ClientEndpoint annotation a class level annotation is used to denote that a POJO + * is a web socket client and can be deployed as such. Similar to + * {@link javax.websocket.server.ServerEndpoint}, POJOs that are + * annotated with this annotation can have methods that, using the web socket method level annotations, + * are web socket lifecycle methods. + *
+ * For example: + *
+ * @ClientEndpoint(subprotocols="chat")
+ * public class HelloServer {
+ *
+ * @OnMessage
+ * public void processMessageFromServer(String message, Session session) {
+ * System.out.println("Message came from the server ! " + message);
+ * }
+ *
+ * }
+ *
+ *
+ * @author dannycoward
+ */
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface ClientEndpoint {
+
+ /**
+ * The names of the subprotocols this client supports.
+ *
+ * @return the array of names of the subprotocols.
+ */
+ String[] subprotocols() default {};
+
+ /**
+ * The array of Java classes that are to act as Decoders for messages coming into
+ * the client.
+ *
+ * @return the array of decoders.
+ */
+ Class extends Decoder>[] decoders() default {};
+
+ /**
+ * The array of Java classes that are to act as Encoders for messages sent by the client.
+ *
+ * @return the array of decoders.
+ */
+ Class extends Encoder>[] encoders() default {};
+
+ /**
+ * An optional custom configurator class that the developer would like to use
+ * to provide custom configuration of new instances of this endpoint. The implementation
+ * creates a new instance of the configurator per logical endpoint.
+ *
+ * @return the custom configurator class, or ClientEndpointConfigurator.class
+ * if none was provided in the annotation.
+ */
+ public Class extends ClientEndpointConfig.Configurator> configurator() default ClientEndpointConfig.Configurator.class;
+}
Index: 3rdParty_sources/websocket/javax/websocket/ClientEndpointConfig.java
===================================================================
diff -u
--- 3rdParty_sources/websocket/javax/websocket/ClientEndpointConfig.java (revision 0)
+++ 3rdParty_sources/websocket/javax/websocket/ClientEndpointConfig.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f)
@@ -0,0 +1,253 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package javax.websocket;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The ClientEndpointConfig is a special kind of endpoint configuration object that contains
+ * web socket configuration information specific only to client endpoints. Developers deploying
+ * programmatic client endpoints can create instances of this configuration by
+ * using a {@link ClientEndpointConfig.Builder}. Developers can override some
+ * of the configuration operations by providing an implementation of
+ * {@link ClientEndpointConfig.Configurator}.
+ *
+ * @author dannycoward
+ */
+public interface ClientEndpointConfig extends EndpointConfig {
+
+
+ /**
+ * Return the ordered list of sub protocols a client endpoint would like to use,
+ * in order of preference, favorite first that this client would
+ * like to use for its sessions.
+ * This list is used to generate the Sec-WebSocket-Protocol header in the opening
+ * handshake for clients using this configuration. The first protocol name is the most preferred.
+ * See Client Opening Handshake.
+ *
+ * @return the list of the preferred subprotocols, the empty list if there are none
+ */
+ List
+ * ClientEndpointConfig cec = ClientEndpointConfig.Builder.create().build();
+ *
+ *
+ * Building a configuration with no subprotocols and a custom configurator.
+ *
+ * ClientEndpointConfig customCec = ClientEndpointConfig.Builder.create()
+ * .preferredSubprotocols(mySubprotocols)
+ * .configurator(new MyClientConfigurator())
+ * .build();
+ *
+ *
+ *
+ * @author dannycoward
+ */
+ public final class Builder {
+ private ListIf deployed as a client endpoint, it will be instantiated once for the + * single connection to the server. + * + *
When deployed as a server endpoint, the implementation uses the + * {@link javax.websocket.server.ServerEndpointConfig.Configurator#getEndpointInstance} + * method to obtain the + * endpoint instance it will use for each new client connection. If the developer uses + * the default {@link javax.websocket.server.ServerEndpointConfig.Configurator}, + * there will be precisely one + * endpoint instance per active client connection. Consequently, in this typical + * case, when implementing/overriding the methods of Endpoint, the developer is + * guaranteed that there will be at most one thread calling each endpoint instance + * at a time. + * + *
If the developer provides a custom {@link javax.websocket.server.ServerEndpointConfig.Configurator} + * which overrides the default policy for endpoint instance creation, for example, + * using a single Endpoint instance for multiple client connections, the developer + * may need to write code that can execute concurrently. + * + *
Here is an example of a simple endpoint that echoes any incoming text message back to the sender. + *
+ * public class EchoServer extends Endpoint {
+ *
+ * public void onOpen(Session session, EndpointConfig config) {
+ * final RemoteEndpoint remote = session.getBasicRemote();
+ * session.addMessageHandler(String.class, new MessageHandler.Whole<String>() {
+ * public void onMessage(String text) {
+ * try {
+ * remote.sendString("Got your message (" + text + "). Thanks !");
+ * } catch (IOException ioe) {
+ * // handle send failure here
+ * }
+ * }
+ * });
+ * }
+ *
+ * }
+ *
+ *
+ * @author dannycoward
+ */
+public abstract class Endpoint {
+
+ /**
+ * Developers must implement this method to be notified when a new conversation has
+ * just begun.
+ *
+ * @param session the session that has just been activated.
+ * @param config the configuration used to configure this endpoint.
+ */
+ public abstract void onOpen(Session session, EndpointConfig config);
+
+ /**
+ * This method is called immediately prior to the session with the remote
+ * peer being closed. It is called whether the session is being closed
+ * because the remote peer initiated a close and sent a close frame, or
+ * whether the local websocket container or this endpoint requests to close
+ * the session. The developer may take this last opportunity to retrieve
+ * session attributes such as the ID, or any application data it holds before
+ * it becomes unavailable after the completion of the method. Developers should
+ * not attempt to modify the session from within this method, or send new
+ * messages from this call as the underlying
+ * connection will not be able to send them at this stage.
+ *
+ * @param session the session about to be closed.
+ * @param closeReason the reason the session was closed.
+ */
+ public void onClose(Session session, CloseReason closeReason) {
+ }
+
+ /**
+ * Developers may implement this method when the web socket session
+ * creates some kind of error that is not modeled in the web socket protocol. This may for example
+ * be a notification that an incoming message is too big to handle, or that the incoming message could not be encoded.
+ *
+ * There are a number of categories of exception that this method is (currently) defined to handle: + *
See {@link Endpoint} for a usage example. + * + * @author dannycoward + */ +public interface MessageHandler { + + /** + * This kind of handler is notified by the container on arrival of a complete message. If the message is received in parts, + * the container buffers it until it is has been fully received before this method is called. + * + *
For handling incoming text messages, the allowed types for T are + *
For handling incoming binary messages, the allowed types for T are + *
For handling incoming pong messages, the type of T is {@link PongMessage} + * + *
Developers should not continue to reference message objects of type {@link java.io.Reader}, {@link java.nio.ByteBuffer}
+ * or {@link java.io.InputStream} after the completion of the onMessage() call, since they
+ * may be recycled by the implementation.
+ *
+ * @param For handling parts of text messages, the type T is {@link java.lang.String}
+ *
+ * For handling parts of binary messages, the allowable types for T are
+ * Developers should not continue to reference message objects of type {@link java.nio.ByteBuffer}
+ * after the completion of the onMessage() call, since they
+ * may be recycled by the implementation.
+ *
+ * Note: Implementations may choose their own schemes for delivering large messages in smaller parts through this API. These
+ * schemes may or may not bear a relationship to the underlying websocket dataframes in which the message
+ * is received off the wire.
+ *
+ * @param The method may only take the following parameters:-
+ * The parameters may appear in any order. See
+ * {@link Endpoint#onClose}
+ * for more details on how the session parameter may be used during method calls
+ * annotated with this annotation.
+ *
+ * @author dannycoward
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface OnClose {
+
+}
Index: 3rdParty_sources/websocket/javax/websocket/OnError.java
===================================================================
diff -u
--- 3rdParty_sources/websocket/javax/websocket/OnError.java (revision 0)
+++ 3rdParty_sources/websocket/javax/websocket/OnError.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f)
@@ -0,0 +1,67 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package javax.websocket;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This method level annotation can be used to decorate a Java method that wishes to be called in order
+ * to handle errors. See {@link Endpoint#onError} for
+ * a description of the different categories of error.
+ *
+ * The method may only take the following parameters:-
+ * The parameters may appear in any order.
+ *
+ * @author dannycoward
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface OnError {
+
+}
Index: 3rdParty_sources/websocket/javax/websocket/OnMessage.java
===================================================================
diff -u
--- 3rdParty_sources/websocket/javax/websocket/OnMessage.java (revision 0)
+++ 3rdParty_sources/websocket/javax/websocket/OnMessage.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f)
@@ -0,0 +1,144 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package javax.websocket;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This method level annotation can be used to make a Java method receive incoming web socket messages. Each websocket
+ * endpoint may only have one message handling method for each of the native websocket message formats: text, binary and pong. Methods
+ * using this annotation are allowed to have
+ * parameters of types described below, otherwise the container will generate an error at deployment time.
+ * The allowed parameters are:
+ * The method may have a non-void return type, in which case the web socket
+ * runtime must interpret this as a web socket message to return to the peer.
+ * The allowed data types for this return type, other than void, are String,
+ * ByteBuffer, byte[], any Java primitive or class equivalent, and anything for
+ * which there is an encoder. If the method uses a Java primitive as a return
+ * value, the implementation must construct the text message to send using the
+ * standard Java string representation of the Java primitive unless there developer
+ * provided encoder for the type configured for this endpoint, in which
+ * case that encoder must be used. If the method uses
+ * a class equivalent of a Java primitive as a return value, the implementation
+ * must construct the text message from the Java primitive equivalent as
+ * described above.
+ *
+ * Developers should
+ * note that if developer closes the session during the invocation of a method with a return type, the method will complete but the
+ * return value will not be delivered to the remote endpoint. The send failure will be passed back into the endpoint's error handling method.
+ *
+ * For example:
+ * The method may only take the following parameters:-
+ * The parameters may appear in any order.
+ *
+ * @author dannycoward
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface OnOpen {
+
+}
Index: 3rdParty_sources/websocket/javax/websocket/PongMessage.java
===================================================================
diff -u
--- 3rdParty_sources/websocket/javax/websocket/PongMessage.java (revision 0)
+++ 3rdParty_sources/websocket/javax/websocket/PongMessage.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f)
@@ -0,0 +1,58 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package javax.websocket;
+
+import java.nio.ByteBuffer;
+
+/**
+ * The PongMessage interface represents a web socket pong. PongMessages may be received by using
+ * a {@code MessageHandler.Basic There is no guarantee of the successful delivery of a web socket message to
+ * the peer, but if the action of sending a message causes an error known to
+ * the container, the API throws it.
+ * RemoteEndpoints include a variety of ways to send messages: by whole message,
+ * in parts, and in various data formats including websocket pings and pongs.
+ *
+ * Implementations
+ * may or may not support batching of messages. More detail of the expected semantics
+ * of implementations that do support batching are laid out in {@link RemoteEndpoint#setBatchingAllowed(boolean)}.
+ *
+ * Note: Implementations may choose their own schemes for sending large messages in smaller parts. These
+ * schemes may or may not bear a relationship to the underlying websocket dataframes in which the message
+ * is ultimately sent on the wire.
+ *
+ * If the underlying connection is closed and methods on the RemoteEndpoint are attempted to be called, they will
+ * result in an error being generated. For the methods that send messages, this will be an IOException, for the methods
+ * that alter configuration of the endpoint, this will be runtime IllegalArgumentExceptions.
+ * @author dannycoward
+ */
+public interface RemoteEndpoint {
+
+ /**
+ * Indicate to the implementation that it is allowed to batch outgoing messages
+ * before sending. Not all implementations support batching of outgoing messages.
+ * The default mode for RemoteEndpoints is false. If the developer
+ * has indicated that batching of outgoing
+ * messages is permitted, then the developer must call flushBatch() in order to be
+ * sure that all the messages passed into the send methods of this RemoteEndpoint
+ * are sent.
+ * When batching is allowed, the implementations send operations are considered
+ * to have completed if the message has been written to the local batch, in
+ * the case when there is still room in the batch for the message, and are considered
+ * to have completed if the batch has been send to the peer and the remainder
+ * written to the new batch, in the case when
+ * writing the message causes the batch to need to be sent. The blocking
+ * and asynchronous send methods use this notion of completion in order
+ * to complete blocking calls, notify SendHandlers and complete Futures respectively.
+ * When batching is allowed, if the developer has called send methods
+ * on this RemoteEndpoint without calling flushBatch(), then the implementation
+ * may not have sent all the messages the developer has asked to be sent. If
+ * the parameter value is false and the implementation has a batch of unsent messages,
+ * then the implementation must immediately send the batch of unsent messages.
+ *
+ * @param allowed whether the implementation is allowed to batch messages.
+ * @throws IOException if batching is being disabled and there are unsent messages
+ * this error may be thrown as the implementation sends the batch of unsent messages if
+ * there is a problem.
+ */
+ void setBatchingAllowed(boolean allowed) throws IOException;
+
+ /**
+ * Return whether the implementation is allowed to batch outgoing messages
+ * before sending. The default mode for RemoteEndpoints is false. The value
+ * may be changed by calling {@link #setBatchingAllowed(boolean) setBatchingAllowed}.
+ */
+ boolean getBatchingAllowed();
+
+ /**
+ * This method is only used when batching is allowed for this RemoteEndpint. Calling
+ * this method forces the implementation to send any unsent messages it has been batching.
+ */
+ void flushBatch() 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 MessageHandler.Pong handler.
+ *
+ * @param applicationData the data to be carried in the ping request.
+ * @throws IOException if the ping failed to be sent
+ * @throws IllegalArgumentException if the applicationData exceeds the maximum allowed payload of 125 bytes
+ */
+ void sendPing(ByteBuffer applicationData) throws IOException, IllegalArgumentException;
+
+ /**
+ * 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 the pong failed to be sent
+ * @throws IllegalArgumentException if the applicationData exceeds the maximum allowed payload of 125 bytes
+ */
+ void sendPong(ByteBuffer applicationData) throws IOException, IllegalArgumentException;
+
+ /**
+ * This representation of the peer of a web socket conversation has the ability
+ * to send messages asynchronously. The point of completion of the send is
+ * defined when all the supplied data has been written to the underlying connection.
+ * The completion handlers for the asynchronous methods are always called with
+ * a different thread from that which initiated the send.
+ */
+ interface Async extends RemoteEndpoint {
+
+ /**
+ * Return the number of milliseconds the implementation will timeout
+ * attempting to send a websocket message. A non-positive number indicates
+ * the implementation will not timeout attempting to send a websocket message
+ * asynchronously. This value overrides the default value assigned in the
+ * WebSocketContainer.
+ *
+ * @return the timeout time in milliseconds.
+ */
+ long getSendTimeout();
+
+ /**
+ * Sets the number of milliseconds the implementation will timeout
+ * attempting to send a websocket message. A non-positive number indicates
+ * the implementation will not timeout attempting to send a websocket message
+ * asynchronously. This value overrides the default value assigned in the
+ * WebSocketContainer.
+ *
+ * @param timeoutmillis The number of milliseconds this RemoteEndpoint will wait before timing out
+ * an incomplete asynchronous message send.
+ */
+ void setSendTimeout(long timeoutmillis);
+
+ /**
+ * Initiates the asynchronous transmission of a text message. This method returns before the message
+ * is transmitted. Developers provide a callback to be notified when the message has been
+ * transmitted. Errors
+ * in transmission are given to the developer in the SendResult object.
+ *
+ * @param text the text being sent.
+ * @param handler the handler which will be notified of progress.
+ * @throws IllegalArgumentException if the text or the handler is {@code null}.
+ */
+ void sendText(String text, SendHandler handler);
+
+ /**
+ * Initiates the asynchronous transmission of a text message. This method
+ * returns before the message is transmitted. Developers use the
+ * returned Future object to track progress of the transmission. The
+ * Future's get() method returns {@code null} upon successful completion. Errors
+ * in transmission are wrapped in the {@link java.util.concurrent.ExecutionException}
+ * thrown when querying the Future object.
+ *
+ * @param text the text being sent.
+ * @return the Future object representing the send operation.
+ * @throws IllegalArgumentException if the text is {@code null}.
+ */
+ Future If the websocket connection underlying this RemoteEndpoint is busy sending a message when a call is made
+ * to send another one, for example if two threads attempt to call a send method
+ * concurrently, or if a developer attempts to send a new message while in the
+ * middle of sending an existing one, the send method called while
+ * the connection is already busy may throw an {@link java.lang.IllegalStateException}.
+ */
+
+ interface Basic extends RemoteEndpoint {
+
+ /**
+ * Send a text message, blocking until all of the message has been transmitted.
+ *
+ * @param text the message to be sent.
+ * @throws IOException if there is a problem delivering the message.
+ * @throws IllegalArgumentException if the text is {@code null}.
+ */
+ void sendText(String text) throws IOException;
+
+ /**
+ * Send a binary message, returning when all of the message has been transmitted.
+ *
+ * @param data the message to be sent.
+ * @throws IOException if there is a problem delivering the message.
+ * @throws IllegalArgumentException if the data is {@code null}.
+
+ */
+ void sendBinary(ByteBuffer data) throws IOException;
+
+ /**
+ * Send a text message in parts, blocking until all of the message has been transmitted. The runtime
+ * reads the message in order. Non-final parts of the message are sent with isLast set to false. The final part
+ * must be sent with isLast set to true.
+ *
+ * @param partialMessage the parts of the message being sent.
+ * @param isLast Whether the partial message being sent is the last part of the message.
+ * @throws IOException if there is a problem delivering the message fragment.
+ * @throws IllegalArgumentException if the partialMessage is {@code null}.
+ */
+ void sendText(String partialMessage, boolean isLast) throws IOException;
+
+ /**
+ * Send a binary message in parts, blocking until all of the message has been transmitted. The runtime
+ * reads the message in order. Non-final parts are sent with isLast set to false. The final piece
+ * must be sent with isLast set to true.
+ *
+ * @param partialByte the part of the message being sent.
+ * @param isLast Whether the partial message being sent is the last part of the message.
+ * @throws IOException if there is a problem delivering the partial message.
+ * @throws IllegalArgumentException if the partialByte is {@code null}.
+ */
+ void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException; // or Iterable
+ * Once the session is closed, it is no longer valid for use by applications. Calling any of
+ * its methods (with the exception of the close() methods)
+ * once the session has been closed will result in an {@link java.lang.IllegalStateException} being thrown.
+ * Developers should retrieve any information from the session during the
+ * {@link Endpoint#onClose} method. Following the convention of {@link java.io.Closeable}
+ * calling the Session close() methods after the Session has been closed has no
+ * effect.
+ *
+ * Session objects may be called by multiple threads. Implementations must
+ * ensure the integrity of the mutable properties of the session under such circumstances.
+ *
+ * @author dannycoward
+ */
+public interface Session extends Closeable {
+
+ /**
+ * Return the container that this session is part of.
+ *
+ * @return the container.
+ */
+ WebSocketContainer getContainer();
+
+ /**
+ * Register to handle to incoming messages in this conversation. A maximum of one message handler per
+ * native websocket message type (text, binary, pong) may be added to each Session. I.e. a maximum
+ * of one message handler to handle incoming text messages a maximum of one message handler for
+ * handling incoming binary messages, and a maximum of one for handling incoming pong
+ * messages. For further details of which message handlers handle which of the native websocket
+ * message types please see {@link MessageHandler.Whole} and {@link MessageHandler.Partial}.
+ * Adding more than one of any one type will result in a runtime exception.
+ *
+ * This method is not safe to use unless you are providing an anonymous class derived directly
+ * from {@link javax.websocket.MessageHandler.Whole} or {@link javax.websocket.MessageHandler.Partial}.
+ * In all other cases (Lambda Expressions, more complex inheritance or generic type arrangements),
+ * one of the following methods have to be used:
+ * {@link #addMessageHandler(Class, javax.websocket.MessageHandler.Whole)} or
+ * {@link #addMessageHandler(Class, javax.websocket.MessageHandler.Partial)}.
+ *
+ * @param handler the MessageHandler to be added.
+ * @throws IllegalStateException if there is already a MessageHandler registered for the same native
+ * websocket message type as this handler.
+ */
+ void addMessageHandler(MessageHandler handler) throws IllegalStateException;
+
+ /**
+ * Register to handle to incoming messages in this conversation. A maximum of one message handler per
+ * native websocket message type (text, binary, pong) may be added to each Session. I.e. a maximum
+ * of one message handler to handle incoming text messages a maximum of one message handler for
+ * handling incoming binary messages, and a maximum of one for handling incoming pong
+ * messages. For further details of which message handlers handle which of the native websocket
+ * message types please see {@link MessageHandler.Whole} and {@link MessageHandler.Partial}.
+ * Adding more than one of any one type will result in a runtime exception.
+ *
+ * @param clazz type of the message processed by message handler to be registered.
+ * @param handler whole message handler to be added.
+ * @throws IllegalStateException if there is already a MessageHandler registered for the same native
+ * websocket message type as this handler.
+ * @since 1.1
+ */
+ public A WebSocketContainer may be accessed by concurrent threads, so
+ * implementations must ensure the integrity of its mutable attributes in such
+ * circumstances.
+ *
+ * @author dannycoward
+ */
+public interface WebSocketContainer {
+
+ /**
+ * Return the number of milliseconds the implementation will timeout
+ * attempting to send a websocket message for all RemoteEndpoints associated
+ * with this container. A non-positive number indicates
+ * the implementation will not timeout attempting to send a websocket message
+ * asynchronously. Note this default may be overridden in each RemoteEndpoint.
+ *
+ * @return the timeout time in millsenconds.
+ */
+ long getDefaultAsyncSendTimeout();
+
+ /**
+ * Sets the number of milliseconds the implementation will timeout
+ * attempting to send a websocket message for all RemoteEndpoints associated
+ * with this container. A non-positive number indicates
+ * the implementation will not timeout attempting to send a websocket message
+ * asynchronously. Note this default may be overridden in each RemoteEndpoint.
+ */
+ void setAsyncSendTimeout(long timeoutmillis);
+
+ /**
+ * Connect the supplied annotated endpoint instance to its server. The supplied
+ * object must be a class decorated with the class level
+ * {@link javax.websocket.server.ServerEndpoint} annotation. This method
+ * blocks until the connection is established, or throws an error if either
+ * the connection could not be made or there was a problem with the supplied
+ * endpoint class. If the developer uses this method to deploy the client
+ * endpoint, services like dependency injection that are supported, for
+ * example, when the implementation is part of the Java EE platform
+ * may not be available. If the client endpoint uses dependency injection,
+ * use {@link WebSocketContainer#connectToServer(java.lang.Class, java.net.URI)}
+ * instead.
+ *
+ * @param annotatedEndpointInstance the annotated websocket client endpoint
+ * instance.
+ * @param path the complete path to the server endpoint.
+ * @return the Session created if the connection is successful.
+ * @throws DeploymentException if the annotated endpoint instance is not valid.
+ * @throws IOException if there was a network or protocol problem that
+ * prevented the client endpoint being connected to its server.
+ * @throws IllegalStateException if called during the deployment phase
+ * of the containing application.
+ */
+ Session connectToServer(Object annotatedEndpointInstance, URI path) throws DeploymentException, IOException;
+
+ /**
+ * Connect the supplied annotated endpoint to its server. The supplied object must be a
+ * class decorated with the class level
+ * {@link javax.websocket.server.ServerEndpoint} annotation. This method blocks until the connection
+ * is established, or throws an error if either the connection could not be made or there
+ * was a problem with the supplied endpoint class.
+ *
+ * @param annotatedEndpointClass the annotated websocket client endpoint.
+ * @param path the complete path to the server endpoint.
+ * @return the Session created if the connection is successful.
+ * @throws DeploymentException if the class is not a valid annotated endpoint class.
+ * @throws IOException if there was a network or protocol problem that
+ * prevented the client endpoint being connected to its server.
+ * @throws IllegalStateException if called during the deployment phase
+ * of the containing application.
+ */
+ Session connectToServer(Class> annotatedEndpointClass, URI path) throws DeploymentException, IOException;
+
+
+ /**
+ * Connect the supplied programmatic client endpoint instance to its server
+ * with the given configuration. This method blocks until the connection
+ * is established, or throws an error if the connection could not be made.
+ * If the developer uses this method to deploy the client
+ * endpoint, services like dependency injection that are supported, for
+ * example, when the implementation is part of the Java EE platform
+ * may not be available. If the client endpoint uses dependency injection,
+ * use {@link WebSocketContainer#connectToServer(java.lang.Class, javax.websocket.ClientEndpointConfig, java.net.URI) }
+ * instead.
+ *
+ * @param endpointInstance the programmatic client endpoint instance {@link Endpoint}.
+ * @param path the complete path to the server endpoint.
+ * @param cec the configuration used to configure the programmatic endpoint.
+ * @return the Session created if the connection is successful.
+ * @throws DeploymentException if the configuration is not valid
+ * @throws IOException if there was a network or protocol problem that
+ * prevented the client endpoint being connected to its server
+ * @throws IllegalStateException if called during the deployment phase
+ * of the containing application.
+ */
+ Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, URI path) throws DeploymentException, IOException;
+
+ /**
+ * Connect the supplied programmatic endpoint to its server with the given
+ * configuration. This method blocks until the connection
+ * is established, or throws an error if the connection could not be made.
+ *
+ * @param endpointClass the programmatic client endpoint class {@link Endpoint}.
+ * @param path the complete path to the server endpoint.
+ * @param cec the configuration used to configure the programmatic endpoint.
+ * @return the Session created if the connection is successful.
+ * @throws DeploymentException if the configuration is not valid
+ * @throws IOException if there was a network or protocol problem that prevented the client endpoint being connected to its server
+ * @throws IllegalStateException if called during the deployment phase
+ * of the containing application.
+ */
+ Session connectToServer(Class extends Endpoint> endpointClass, ClientEndpointConfig cec, URI path) throws DeploymentException, IOException;
+
+
+
+ /**
+ * Return the default time in milliseconds after which any web socket sessions in this
+ * container will be closed if it has been inactive. A value that is
+ * 0 or negative indicates the sessions will never timeout due to inactivity.
+ * The value may be overridden on a per session basis using
+ * {@link Session#setMaxIdleTimeout(long) }
+ *
+ * @return the default number of milliseconds after which an idle session in this container
+ * will be closed
+ */
+ long getDefaultMaxSessionIdleTimeout();
+
+ /**
+ * Sets the default time in milliseconds after which any web socket sessions in this
+ * container will be closed if it has been inactive. A value that is
+ * 0 or negative indicates the sessions will never timeout due to inactivity.
+ * The value may be overridden on a per session basis using
+ * {@link Session#setMaxIdleTimeout(long) }
+ *
+ * @param timeout the maximum time in milliseconds.
+ */
+ void setDefaultMaxSessionIdleTimeout(long timeout);
+
+ /**
+ * Returns the default maximum size of incoming binary message that this container
+ * will buffer. This default may be overridden on a per session basis using
+ * {@link Session#setMaxBinaryMessageBufferSize(int) }
+ *
+ * @return the maximum size of incoming binary message in number of bytes.
+ */
+ int getDefaultMaxBinaryMessageBufferSize();
+
+ /**
+ * Sets the default maximum size of incoming binary message that this container
+ * will buffer.
+ *
+ * @param max the maximum size of binary message in number of bytes.
+ */
+ void setDefaultMaxBinaryMessageBufferSize(int max);
+
+ /**
+ * Returns the default maximum size of incoming text message that this container
+ * will buffer. This default may be overridden on a per session basis using
+ * {@link Session#setMaxTextMessageBufferSize(int) }
+ *
+ * @return the maximum size of incoming text message in number of bytes.
+ */
+ int getDefaultMaxTextMessageBufferSize();
+
+ /**
+ * Sets the maximum size of incoming text message that this container
+ * will buffer.
+ *
+ * @param max the maximum size of text message in number of bytes.
+ */
+ void setDefaultMaxTextMessageBufferSize(int max);
+
+ /**
+ * Return the set of Extensions installed in the container.
+ *
+ * @return the set of extensions.
+ */
+ Set For example:-
+ * For example:-
+ * For websocket enabled web containers, developers may
+ * obtain a reference to the ServerContainer instance by retrieving it as an
+ * attribute named WebSocket
+ * implementations that run outside the web container may have other means
+ * by which to provide a ServerContainer instance to the developer at application
+ * deployment time.
+ * Once the
+ * application deployment phase is complete, and the websocket application has
+ * begun accepting incoming connections, the registration methods may no
+ * longer be called.
+ *
+ * @author dannycoward
+ */
+public interface ServerContainer extends WebSocketContainer {
+
+ /**
+ * Deploys the given annotated endpoint into this ServerContainer during the
+ * initialization phase of deploying the application.
+ *
+ * @param endpointClass the class of the annotated endpoint
+ * @throws DeploymentException if the annotated endpoint was badly formed.
+ * @throws IllegalStateException if the containing websocket application has already
+ * been deployed.
+ */
+ public void addEndpoint(Class> endpointClass) throws DeploymentException;
+ /**
+ *
+ * @param serverConfig the configuration instance representing the logical endpoint
+ * that will be registered.
+ * @throws DeploymentException if the endpoint was badly formed.
+ * @throws IllegalStateException if the containing websocket application has already
+ * been deployed.
+ */
+ public void addEndpoint(ServerEndpointConfig serverConfig) throws DeploymentException;
+
+}
Index: 3rdParty_sources/websocket/javax/websocket/server/ServerEndpoint.java
===================================================================
diff -u
--- 3rdParty_sources/websocket/javax/websocket/server/ServerEndpoint.java (revision 0)
+++ 3rdParty_sources/websocket/javax/websocket/server/ServerEndpoint.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f)
@@ -0,0 +1,131 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package javax.websocket.server;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.websocket.Decoder;
+import javax.websocket.Encoder;
+
+/**
+ * This class level annotation declares that the class it decorates
+ * is a web socket endpoint that will be deployed and made available in the URI-space
+ * of a web socket server. The annotation allows the developer to
+ * define the URL (or URI template) which this endpoint will be published, and other
+ * important properties of the endpoint to the websocket runtime, such as the encoders
+ * it uses to send messages.
+ *
+ * The annotated class
+ * must have a public no-arg constructor.
+ *
+ * For example:
+ * The default platform implementation of this method returns the first
+ * subprotocol in the list sent by the client that the server supports,
+ * or the empty string if there isn't one.
+ *
+ * @param requested the requested subprotocols from the client endpoint
+ * @param supported the subprotocols supported by the server endpoint
+ * @return the negotiated subprotocol or the empty string if there isn't one.
+ */
+
+ public String getNegotiatedSubprotocol(List The default platform implementation of this method returns a list
+ * containing all of the requested extensions passed to this method that
+ * it supports, using the order in the requested extensions, the empty
+ * list if none.
+ *
+ * @param installed the installed extensions on the implementation.
+ * @param requested the requested extensions, in the order they were
+ * requested by the client
+ * @return the list of extensions negotiated, the empty list if none.
+ */
+ public List The platform default implementation of this method makes a check of the
+ * validity of the Origin header sent along with
+ * the opening handshake following the recommendation at:
+ * Sending
+ * the Server's Opening Handshake.
+ *
+ * @param originHeaderValue the value of the origin header passed
+ * by the client.
+ * @return whether the check passed or not
+ */
+ public boolean checkOrigin(String originHeaderValue) {
+ return this.getContainerDefaultConfigurator().checkOrigin(originHeaderValue);
+ }
+
+ /**
+ * Called by the container after it has formulated a handshake response resulting from
+ * a well-formed handshake request. The container has already
+ * checked that this configuration has a matching URI, determined the
+ * validity of the origin using the checkOrigin method, and filled
+ * out the negotiated subprotocols and extensions based on this configuration.
+ * Custom configurations may override this method in order to inspect
+ * the request parameters and modify the handshake response that the server has formulated.
+ * and the URI checking also.
+ *
+ * If the developer does not override this method, no further
+ * modification of the request and response are made by the implementation.
+ *
+ * @param sec the configuration object involved in the handshake
+ * @param request the opening handshake request.
+ * @param response the proposed opening handshake response
+ */
+ public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
+ // nothing.
+ }
+
+
+ /**
+ * This method is called by the container each time a new client
+ * connects to the logical endpoint this configurator configures.
+ * Developers may override this method to control instantiation of
+ * endpoint instances in order to customize the initialization
+ * of the endpoint instance, or manage them in some other way.
+ * If the developer overrides this method, services like
+ * dependency injection that are otherwise supported, for example, when
+ * the implementation is part of the Java EE platform
+ * may not be available.
+ * The platform default implementation of this method returns a new
+ * endpoint instance per call, thereby ensuring that there is one
+ * endpoint instance per client, the default deployment cardinality.
+ *
+ * @param endpointClass the class of the endpoint
+ * @param Here are some examples:
+ *
+ * Building a plain configuration for an endpoint with just a path.
+ * Building a configuration with no subprotocols and a custom configurator.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The parameters may be listed in any order.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * For example:
+ *
+ * @OnMessage
+ * public void processGreeting(String message, Session session) {
+ * System.out.println("Greeting received:" + message);
+ * }
+ *
+ * Developers should not continue to reference message objects of type {@link java.io.Reader}, {@link java.nio.ByteBuffer}
+ * or {@link java.io.InputStream} after the annotated method has completed, since they
+ * may be recycled by the implementation.
+ *
+ * @author dannycoward
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface OnMessage {
+
+ /**
+ * Specifies the maximum size of message in bytes that the method
+ * this annotates will be able to process, or -1 to indicate
+ * that there is no maximum. The default is -1. This attribute only
+ * applies when the annotation is used to process whole messages, not to
+ * those methods that process messages in parts or use a stream or reader
+ * parameter to handle the incoming message.
+ * If the incoming whole message exceeds this limit, then the implementation
+ * generates an error and closes the connection using the reason that
+ * the message was too big.
+ *
+ * @return the maximum size in bytes.
+ */
+ public long maxMessageSize() default -1;
+}
Index: 3rdParty_sources/websocket/javax/websocket/OnOpen.java
===================================================================
diff -u
--- 3rdParty_sources/websocket/javax/websocket/OnOpen.java (revision 0)
+++ 3rdParty_sources/websocket/javax/websocket/OnOpen.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f)
@@ -0,0 +1,66 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package javax.websocket;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This method level annotation can be used to decorate a Java method that wishes to be called when a new
+ * web socket session is open.
+ *
+ *
+ * @OnMessage
+ * public void processUpload(byte[] b, boolean last, Session session) {
+ * // process partial data here, which check on last to see if these is more on the way
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ * @ServerEndpoint("/bookings/{guest-id}")
+ * public class BookingServer {
+ *
+ * @OnMessage
+ * public void processBookingRequest(@PathParam("guest-id") String guestID, String message, Session session) {
+ * // process booking from the given guest here
+ * }
+ * }
+ *
+ *
+ * @author dannycoward
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+public @interface PathParam {
+
+ /**
+ * The name of the variable used in the URI-template. If the name does
+ * not match a path variable in the URI-template, the value of the method parameter
+ * this annotation annotates is {@code null}.
+ *
+ * @return the name of the variable used in the URI-template.
+ */
+ public String value();
+}
Index: 3rdParty_sources/websocket/javax/websocket/server/ServerApplicationConfig.java
===================================================================
diff -u
--- 3rdParty_sources/websocket/javax/websocket/server/ServerApplicationConfig.java (revision 0)
+++ 3rdParty_sources/websocket/javax/websocket/server/ServerApplicationConfig.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f)
@@ -0,0 +1,84 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package javax.websocket.server;
+
+import java.util.Set;
+import javax.websocket.Endpoint;
+
+/**
+ * Developers include implementations of ServerApplicationConfig in an archive containing
+ * websocket endpoints (WAR file, or JAR file within the WAR file) in order to specify the websocket
+ * endpoints within the archive the implementation must deploy. There is a separate
+ * method for programmatic endpoints and for annotated endpoints.
+ *
+ * @author dannycoward
+ */
+public interface ServerApplicationConfig {
+
+ /**
+ * Return a set of ServerEndpointConfig instances that the server container
+ * will use to deploy the programmatic endpoints. The set of Endpoint classes passed in to this method is
+ * the set obtained by scanning the archive containing the implementation
+ * of this ServerApplicationConfig. This set passed in
+ * may be used the build the set of ServerEndpointConfig instances
+ * to return to the container for deployment.
+ *
+ * @param endpointClasses the set of all the Endpoint classes in the archive containing
+ * the implementation of this interface.
+ * @return the non-null set of ServerEndpointConfig s to deploy on the server, using the empty set to
+ * indicate none.
+ */
+ public Set
+ * @ServerEndpoint("/rewards/{vip-level}")
+ * public class RewardServer {
+ *
+ * @OnMessage
+ * public void processReward(@PathParam("vip-level") Integer vipLevel, String message, Session session) {
+ * // process reward here
+ * }
+ * }
+ *
javax.websocket.server.ServerContainer
on the
+ * ServletContext. This way, the registration methods held on this interface
+ * may be called to register server endpoints from a ServletContextListener
+ * during the deployment of the WAR file containing the endpoint.
+ *
+ *
+ * @author dannycoward
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface ServerEndpoint {
+
+ /**
+ * The URI or URI-template, level-1 (See RFC 6570) where the endpoint will be deployed. The URI us relative to the
+ * root of the web socket container and must begin with a leading "/". Trailing "/"'s are ignored. Examples:
+ *
+ * @ServerEndpoint("/hello");
+ * public class HelloServer {
+ *
+ * @OnMessage
+ * public void processGreeting(String message, Session session) {
+ * System.out.println("Greeting received:" + message);
+ * }
+ *
+ * }
+ *
+ *
+ * @return the URI or URI-template
+ */
+ public String value();
+
+ /**
+ * The ordered array of web socket protocols this endpoint supports.
+ * For example, {"superchat", "chat"}.
+ *
+ * @return the subprotocols.
+ */
+ public String[] subprotocols() default {};
+
+ /**
+ * The ordered array of decoder classes this endpoint will use. For example,
+ * if the developer has provided a MysteryObject decoder, this endpoint will be able to
+ * receive MysteryObjects as web socket messages. The websocket runtime will use the first
+ * decoder in the list able to decode a message, ignoring the remaining decoders.
+ *
+ * @return the decoders.
+ */
+ public Class extends Decoder>[] decoders() default {};
+
+ /**
+ * The ordered array of encoder classes this endpoint will use. For example,
+ * if the developer has provided a MysteryObject encoder, this class will be able to
+ * send web socket messages in the form of MysteryObjects. The websocket runtime will use the first
+ * encoder in the list able to encode a message, ignoring the remaining encoders.
+ *
+ * @return the encoders.
+ */
+ public Class extends Encoder>[] encoders() default {};
+
+
+ /**
+ * The optional custom configurator class that the developer would like to use
+ * to further configure new instances of this endpoint. If no configurator
+ * class is provided, the implementation uses its own. The implementation
+ * creates a new instance of the configurator per logical endpoint.
+ *
+ * @return the custom configuration class, or ServerEndpointConfig.Configurator.class
+ * if none was set in the annotation.
+ */
+ public Class extends ServerEndpointConfig.Configurator> configurator() default ServerEndpointConfig.Configurator.class;
+}
Index: 3rdParty_sources/websocket/javax/websocket/server/ServerEndpointConfig.java
===================================================================
diff -u
--- 3rdParty_sources/websocket/javax/websocket/server/ServerEndpointConfig.java (revision 0)
+++ 3rdParty_sources/websocket/javax/websocket/server/ServerEndpointConfig.java (revision ec3c5a5adbf38c525b3d3f2aec05af3f78f3968f)
@@ -0,0 +1,385 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package javax.websocket.server;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.ServiceLoader;
+import javax.websocket.Decoder;
+import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
+import javax.websocket.Extension;
+import javax.websocket.HandshakeResponse;
+
+/**
+ * The ServerEndpointConfig is a special kind of endpoint configuration object that contains
+ * web socket configuration information specific only to server endpoints. For developers
+ * deploying programmatic endpoints, ServerEndpointConfig objects
+ * can be created using a {@link ServerEndpointConfig.Builder}. Certain configuration
+ * operations can be customized by providing a {@link ServerEndpointConfig.Configurator}
+ *
+ * @author dannycoward
+ */
+public interface ServerEndpointConfig extends EndpointConfig {
+
+ /**
+ * Returns the Class of the endpoint this configuration is configuring. If
+ * the endpoint is an annotated endpoint, the value is the class of the Java class
+ * annotated with @ServerEndpoint. if the endpoint is a programmatic, the value
+ * is the class of the subclass of Endpoint.
+ *
+ * @return the class of the endpoint, annotated or programmatic.
+ */
+ Class> getEndpointClass();
+
+ /**
+ * Return the path for this endpoint configuration. The path is the URI or
+ * URI-template (level 1) relative to the websocket root of the server to which the
+ * endpoint using this configuration will be mapped. The path is always non-null
+ * and always begins with a leading "/".
+ *
+ * @return the relative path for this configuration.
+ */
+ String getPath();
+
+ /**
+ * Return the websocket subprotocols configured.
+ *
+ * @return the list of subprotocols, the empty list if none
+ */
+ List
+ * @ServerEndpoint("/chat")
+ * @ServerEndpoint("/chat/{user}")
+ * @ServerEndpoint("/booking/{privilege-level}")
+ *
+ *
+ *
+ * ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/foo").build();
+ *
+ *
+ * @author dannycoward
+ */
+ public final class Builder {
+ private String path;
+ private Class> endpointClass;
+ private List
+ * ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/bar")
+ * .subprotocols(subprotocols)
+ * .configurator(new MyServerConfigurator())
+ * .build();
+ *