geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1492048 [1/3] - in /geronimo/specs/trunk: ./ geronimo-websockets_1.0_spec/ geronimo-websockets_1.0_spec/src/ geronimo-websockets_1.0_spec/src/main/ geronimo-websockets_1.0_spec/src/main/java/ geronimo-websockets_1.0_spec/src/main/java/java...
Date Wed, 12 Jun 2013 04:13:30 GMT
Author: gawor
Date: Wed Jun 12 04:13:29 2013
New Revision: 1492048

URL: http://svn.apache.org/r1492048
Log:
GERONIMO-6462: Websocket 1.0 spec. Patch from Andy McCright

Added:
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/pom.xml   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpoint.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpointConfig.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ContainerProvider.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DecodeException.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Decoder.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DeploymentException.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EncodeException.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Encoder.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Endpoint.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EndpointConfig.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Extension.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/HandshakeResponse.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/MessageHandler.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/OnClose.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/OnError.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/OnMessage.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/OnOpen.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/PongMessage.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/RemoteEndpoint.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/SendHandler.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/SendResult.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Session.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/SessionException.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/WebSocketContainer.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/server/
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/server/HandshakeRequest.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/server/PathParam.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/server/ServerApplicationConfig.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/server/ServerContainer.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/server/ServerEndpoint.java   (with props)
    geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/server/ServerEndpointConfig.java   (with props)
Modified:
    geronimo/specs/trunk/pom.xml

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/pom.xml?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/pom.xml (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/pom.xml Wed Jun 12 04:13:29 2013
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.genesis</groupId>
+        <artifactId>genesis-java5-flava</artifactId>
+        <version>2.1</version>
+    </parent>
+
+    <groupId>org.apache.geronimo.specs</groupId>
+    <artifactId>geronimo-websockets_1.0_spec</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Geronimo WebSockets Spec 1.0</name>
+    <version>1.0-SNAPSHOT</version>
+
+    <description>WebSockets 1.0 API</description>
+
+    <url>http://geronimo.apache.org/maven/${siteId}/${version}</url>
+
+    <distributionManagement>
+        <site>
+            <id>apache-website</id>
+            <url>${site.deploy.url}/maven/${siteId}/${version}</url>
+        </site>
+    </distributionManagement>
+
+    <properties>
+        <siteId>specs/${artifactId}</siteId>
+    </properties>
+
+    <scm>
+        <connection>scm:svn:https://svn.apache.org/repos/asf/geronimo/specs/trunk/geronimo-websockets_1.0_spec/</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/geronimo/specs/trunk/geronimo-websockets_1.0_spec/</developerConnection>
+        <url>http://svn.apache.org/viewcvs.cgi/geronimo/specs/trunk/geronimo-websockets_1.0_spec/</url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            javax.websocket;version=1.0,
+                            javax.websocket.server;version=1.0
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>rat</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <!-- Override of default rat checks.  To use, type "mvn -Prat verify". -->
+                        <groupId>org.apache.rat</groupId>
+                        <artifactId>apache-rat-plugin</artifactId>
+                        <version>0.6</version>
+                        <executions>
+                            <execution>
+                                <phase>verify</phase>
+                                <goals>
+                                    <goal>check</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <reportFile>${project.build.directory}/${project.build.finalName}.rat</reportFile>
+                            <excludeSubProjects>false</excludeSubProjects>
+                            <excludes>
+                                <exclude>**/target/**/*</exclude>
+                                <exclude>**/appended-resources/**/*</exclude>
+                                <exclude>**/velocity.log</exclude>
+                                <!-- manifest files don't support comments so don't contain the ASL2.0 header -->
+                                <exclude>**/*.MF</exclude>
+                                <!-- These are covered by information in the LICENSE file -->
+                                <exclude>**/xml.xsd</exclude>
+                                <exclude>**/XMLSchema.dtd</exclude>
+                                <!--RAT doesn't seem to recognize MIT style licenses-->
+                                <exclude>manual/src/styles/print.css</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpoint.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpoint.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpoint.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpoint.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+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 ServerEndpoint, POJOs that are annotated with this annotation can have methods that,
+ * using the web socket method level annotations, are web socket lifecycle methods.
+ * <p/>
+ * For example:
+ * <p/>
+ * <code>
+ * 
+ * @ClientEndpoint(subprotocols="chat") public class HelloServer {
+ * 
+ * @OnMessage public void processMessageFromServer(String message, Session session) {
+ *            System.out.println("Message came from the server ! " + message); }
+ * 
+ *            } </code>
+ * 
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.TYPE)
+public @interface ClientEndpoint {
+
+    /**
+     * 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.
+     */
+    Class<? extends ClientEndpointConfig.Configurator> configurator() default ClientEndpointConfig.Configurator.class;
+
+    /**
+     * 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 {};
+
+    /**
+     * The names of the subprotocols this client supports.
+     * 
+     * @return the array of names of the subprotocols.
+     */
+    String[] subprotocols() default {};
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpoint.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpointConfig.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpointConfig.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpointConfig.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpointConfig.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+import java.util.Collections;
+import java.util.HashMap;
+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 ClientEndpointConfig.Builder. Developers can override some of the
+ * configuration operations by providing an implementation of ClientEndpointConfig.Configurator.
+ * 
+ */
+public interface ClientEndpointConfig extends EndpointConfig {
+
+    /**
+     * The ClientEndpointConfig.Builder is a class used for creating ClientEndpointConfig objects for the purposes of
+     * deploying a client endpoint. Here are some examples: Building a plain configuration with no encoders, decoders,
+     * subprotocols or extensions. ClientEndpointConfig cec = ClientEndpointConfig.Builder.create().build(); Building a
+     * configuration with no subprotocols and a custom configurator.
+     * <p/>
+     * <code>
+     *  ClientEndpointConfig customCec = ClientEndpointConfig.Builder.create()
+     *    .preferredSubprotocols(mySubprotocols)
+     *    .configurator(new MyClientConfigurator())
+     *    .build();
+     * </code>
+     * 
+     */
+    public static final class Builder {
+
+        private Configurator configurator;
+        private List<String> preferredSubprotocols;
+        private List<Extension> extensions;
+        private List<Class<? extends Encoder>> encoders;
+        private List<Class<? extends Decoder>> decoders;
+        private Map<String, Object> userProperties = new HashMap<String, Object>();
+
+        /**
+         * Creates a new builder object with no subprotocols, extensions, encoders, decoders and a null configurator.
+         * 
+         * @return a new builder object
+         */
+        public static Builder create() {
+            return new Builder();
+        }
+
+        /**
+         * Builds a configuration object using the attributes set on this builder.
+         * 
+         * @return a new configuration object
+         */
+        public ClientEndpointConfig build() {
+            if (decoders == null)
+                decoders = Collections.emptyList();
+            if (encoders == null)
+                encoders = Collections.emptyList();
+            if (extensions == null)
+                extensions = Collections.emptyList();
+            if (preferredSubprotocols == null)
+                preferredSubprotocols = Collections.emptyList();
+            
+            return new ClientEndpointConfig() {
+
+                @Override
+                public List<Class<? extends Encoder>> getEncoders() {
+                    return encoders;
+                }
+
+                @Override
+                public List<Class<? extends Decoder>> getDecoders() {
+                    return decoders;
+                }
+
+                @Override
+                public Map<String, Object> getUserProperties() {
+                    return userProperties;
+                }
+
+                @Override
+                public List<String> getPreferredSubprotocols() {
+                    return preferredSubprotocols;
+                }
+
+                @Override
+                public List<Extension> getExtensions() {
+                    return extensions;
+                }
+
+                @Override
+                public Configurator getConfigurator() {
+                    return configurator;
+                }
+
+            };
+        }
+
+        /**
+         * Sets the configurator object for the configuration this builder will build.
+         * 
+         * @param clientEndpointConfigurator
+         *            the configurator
+         * @return the builder instance
+         */
+        public Builder configurator(Configurator clientEndpointConfigurator) {
+            this.configurator = clientEndpointConfigurator;
+            return this;
+        }
+
+        /**
+         * Set the preferred sub protocols for the configuration this builder will build. The list is treated in order
+         * of preference, favorite first, that this client would like to use for its sessions.
+         * 
+         * @param preferredSubprotocols
+         *            the preferred subprotocol names.
+         * @return the builder instance
+         */
+        public Builder preferredSubprotocols(List<String> preferredSubprotocols) {
+            this.preferredSubprotocols = preferredSubprotocols;
+            return this;
+        }
+
+        /**
+         * Set the extensions for the configuration this builder will build. The list is treated in order of preference,
+         * favorite first, that the client would like to use for its sessions.
+         * 
+         * @param extensions
+         *            the extensions
+         * @return the builder instance
+         */
+        public ClientEndpointConfig.Builder extensions(List<Extension> extensions) {
+            this.extensions = extensions;
+            return this;
+        }
+
+        /**
+         * Assign the list of encoder implementation classes the client will use.
+         * 
+         * @param encoders
+         *            the encoder implementation classes
+         * @return the builder instance
+         */
+        public Builder encoders(List<Class<? extends Encoder>> encoders) {
+            this.encoders = encoders;
+            return this;
+        }
+
+        /**
+         * Assign the list of decoder implementation classes the client will use.
+         * 
+         * @param decoders
+         *            the decoder implementation classes
+         * @return the builder instance
+         */
+        public Builder decoders(List<Class<? extends Decoder>> decoders) {
+            this.decoders = decoders;
+            return this;
+        }
+    }
+
+    /**
+     * The Configurator class may be extended by developers who want to provide custom configuration algorithms, such as
+     * intercepting the opening handshake, or providing arbitrary methods and algorithms that can be accessed from each
+     * endpoint instance configured with this configurator.
+     * 
+     */
+    public static class Configurator {
+
+        public Configurator() {
+            // no-op
+        }
+
+        /**
+         * This method is called by the implementation after it has formulated the handshake request that will be used
+         * to initiate the connection to the server, but before it has sent any part of the request. This allows the
+         * developer to inspect and modify the handshake request headers prior to the start of the handshake
+         * interaction.
+         * 
+         * @param headers
+         *            the mutable map of handshake request headers the implementation is about to send to start the
+         *            handshake interaction.
+         */
+        public void beforeRequest(Map<String, List<String>> headers) {
+            // no-op
+        }
+
+        /**
+         * This method is called by the implementation after it has received a handshake response from the server as a
+         * result of a handshake interaction it initiated. The developer may implement this method in order to inspect
+         * the returning handshake response.
+         * 
+         * @param hr
+         *            the handshake response sent by the server.
+         */
+        public void afterResponse(HandshakeResponse hr) {
+            // no-op
+        }
+    }
+
+    /**
+     * 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 <a href="http://tools.ietf.org/html/rfc6455#section-4.1">Client Opening
+     * Handshake</a>.
+     * 
+     * @return the list of the preferred subprotocols, the empty list if there are none
+     */
+    List<String> getPreferredSubprotocols();
+
+    /**
+     * Return the extensions, in order of preference, favorite first, that this client would like to use for its
+     * sessions. These are the extensions that will be used to populate the Sec-WebSocket-Extensions header in the
+     * opening handshake for clients using this configuration. The first extension in the list is the most preferred
+     * extension. See <a href="http://tools.ietf.org/html/rfc6455#section-9.1">Negotiating Extensions</a>.
+     * 
+     * @return the list of extensions, the empty list if there are none.
+     */
+    List<Extension> getExtensions();
+
+    /**
+     * Return the custom configurator for this configuration. If the developer did not provide one, the platform default
+     * configurator is returned.
+     * 
+     * @return the configurator in use with this configuration.
+     */
+    ClientEndpointConfig.Configurator getConfigurator();
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpointConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpointConfig.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ClientEndpointConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+public class CloseReason {
+
+    /**
+     * A marker interface for the close codes. This interface may be implemented by enumerations that contain web socket
+     * close codes, for example enumerations that contain all the in use close codes as of web socket 1.0, or an
+     * enumeration that contains close codes that are currently reserved for special use by the web socket
+     * specification.
+     */
+    public static interface CloseCode {
+        /**
+         * Returns the code number, for example the integer '1000' for normal closure.
+         * 
+         * @return the code number
+         */
+        public int getCode();
+    }
+
+    /**
+     * An Enumeration of status codes for a web socket close that are defined in the specification.
+     */
+    public static enum CloseCodes implements CloseCode {
+        /**
+         * 1000 indicates a normal closure, meaning that the purpose for which the connection was established has been
+         * fulfilled.
+         */
+        NORMAL_CLOSURE, // 1000
+        /**
+         * 1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated
+         * away from a page.
+         */
+        GOING_AWAY, // 1001
+        /**
+         * 1002 indicates that an endpoint is terminating the connection due to a protocol error.
+         */
+        PROTOCOL_ERROR, // 1002
+        /**
+         * 1003 indicates that an endpoint is terminating the connection because it has received a type of data it
+         * cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary
+         * message).
+         */
+        CANNOT_ACCEPT, // 1003
+        /**
+         * Reserved. The specific meaning might be defined in the future.
+         */
+        RESERVED, // ? treated as 1004
+        /**
+         * 1005 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is
+         * designated for use in applications expecting a status code to indicate that no status code was actually
+         * present.
+         */
+        NO_STATUS_CODE, // 1005
+        /**
+         * 1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is
+         * designated for use in applications expecting a status code to indicate that the connection was closed
+         * abnormally, e.g., without sending or receiving a Close control frame.
+         */
+        CLOSED_ABNORMALLY, // 1006
+        /**
+         * 1007 indicates that an endpoint is terminating the connection because it has received data within a message
+         * that was not consistent with the type of the message (e.g., non-UTF-8 data within a text message).
+         */
+        NOT_CONSISTENT, // 1007
+        /**
+         * 1008 indicates that an endpoint is terminating the connection because it has received a message that violates
+         * its policy. This is a generic status code that can be returned when there is no other more suitable status
+         * code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy.
+         */
+        VIOLATED_POLICY, // 1008
+        /**
+         * 1009 indicates that an endpoint is terminating the connection because it has received a message that is too
+         * big for it to process.
+         */
+        TOO_BIG, // 1009
+        /**
+         * 1010 indicates that an endpoint (client) is terminating the connection because it has expected the server to
+         * negotiate one or more extension, but the server didn't return them in the response message of the WebSocket
+         * handshake. The list of extensions that are needed SHOULD appear in the /reason/ part of the Close frame. Note
+         * that this status code is not used by the server, because it can fail the WebSocket handshake instead.
+         */
+        NO_EXTENSION, // 1010
+        /**
+         * 1011 indicates that a server is terminating the connection because it encountered an unexpected condition
+         * that prevented it from fulfilling the request.
+         */
+        UNEXPECTED_CONDITION, // 1011
+        /**
+         * 1012 indicates that the service will be restarted.
+         */
+        SERVICE_RESTART, // 1012
+        /**
+         * 1013 indicates that the service is experiencing overload
+         */
+        TRY_AGAIN_LATER, // 1013
+
+        /**
+         * 1015 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is
+         * designated for use in applications expecting a status code to indicate that the connection was closed due to
+         * a failure to perform a TLS handshake (e.g., the server certificate can't be verified).
+         */
+        TLS_HANDSHAKE_FAILURE; // 1015
+
+        /**
+         * Return the code number of this status code.
+         * 
+         * @return the code.
+         */
+        @Override
+        public int getCode() {
+            // TODO This method makes no sense in this context....
+            return 1111;
+        }
+
+        /**
+         * Creates a CloseCode from the given int code number. This method throws an IllegalArgumentException if the int
+         * is not one of the close codes.
+         * 
+         * @param code
+         *            the integer code number
+         * @return a new CloseCode with the given code number
+         * @throws IllegalArgumentException
+         *             - if the code is not a valid close code
+         */
+        public static CloseCode getCloseCode(int code) {
+            switch (code) {
+            case 1000:
+                return NORMAL_CLOSURE;
+            case 1001:
+                return GOING_AWAY;
+            case 1002:
+                return PROTOCOL_ERROR;
+            case 1003:
+                return CANNOT_ACCEPT;
+            case 1005:
+                return NO_STATUS_CODE;
+            case 1006:
+                return CLOSED_ABNORMALLY;
+            case 1007:
+                return NOT_CONSISTENT;
+            case 1008:
+                return VIOLATED_POLICY;
+            case 1009:
+                return TOO_BIG;
+            case 1010:
+                return NO_EXTENSION;
+            case 1011:
+                return UNEXPECTED_CONDITION;
+            case 1012:
+                return SERVICE_RESTART;
+            case 1013:
+                return TRY_AGAIN_LATER;
+            case 1015:
+                return TLS_HANDSHAKE_FAILURE;
+            default:
+                throw new IllegalArgumentException("Unknown Code: " + code);
+            }
+        }
+
+    }
+
+    private final CloseCode closeCode;
+    private final String reasonPhrase;
+
+    /**
+     * Creates a reason for closing a web socket connection with the given code and reason phrase.
+     * 
+     * @param closeCode
+     *            the close code, may not be null
+     * @param reasonPhrase
+     *            the reason phrase, may be null.
+     */
+    public CloseReason(CloseCode closeCode, String reasonPhrase) {
+        if (closeCode == null) {
+            throw new NullPointerException();
+        }
+        this.closeCode = closeCode;
+        this.reasonPhrase = reasonPhrase == null ? "" : reasonPhrase;
+    }
+
+    /**
+     * The Close code associated with this CloseReason.
+     * 
+     * @return the close code.
+     */
+    public CloseCode getCloseCode() {
+        return closeCode;
+    }
+
+    /**
+     * The reason phrase associated with this CloseReason.
+     * 
+     * @return the reason phrase. If there is no reason phrase, this returns the empty string
+     */
+    public String getReasonPhrase() {
+        return reasonPhrase;
+    }
+
+    /**
+     * Converts the CloseReason to a debug-friendly string. The exact format is not defined by the specification and may
+     * change in future releases.
+     * 
+     * @return A String representation of this CloseReason
+     */
+    @Override
+    public String toString() {
+        return "javax.websocket.CloseReason: " + this.closeCode + " " + this.reasonPhrase;
+    }
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ContainerProvider.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ContainerProvider.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ContainerProvider.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ContainerProvider.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+import java.util.ServiceLoader;
+
+/**
+ * Provider class that allows the developer to get a reference to the implementation of the WebSocketContainer. The
+ * provider class uses the ServiceLoader to load an implementation of ContainerProvider. Specifically, the fully
+ * qualified classname of the container implementation of ContainerProvider must be listed in the
+ * META-INF/services/javax.websocket.ContainerProvider file in the implementation JAR file.
+ */
+public abstract class ContainerProvider {
+
+    private static ServiceLoader<WebSocketContainer> loader = ServiceLoader.load(WebSocketContainer.class);
+
+    /**
+     * Obtain a new instance of a WebSocketContainer. The method looks for the ContainerProvider implementation class in
+     * the order listed in the META-INF/services/javax.websocket.ContainerProvider file, returning the
+     * WebSocketContainer implementation from the ContainerProvider implementation that is not null.
+     * 
+     * @return an implementation provided instance of type WebSocketContainer
+     */
+    public static WebSocketContainer getWebSocketContainer() {
+        for (WebSocketContainer cntr : loader) {
+            return cntr;
+        }
+        return null;
+    }
+
+    public ContainerProvider() {
+    }
+
+    /**
+     * Load the container implementation.
+     * 
+     * @return the implementation class
+     */
+    protected abstract WebSocketContainer getContainer();
+
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ContainerProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ContainerProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/ContainerProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DecodeException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DecodeException.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DecodeException.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DecodeException.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+import java.nio.ByteBuffer;
+
+/**
+ * A general exception that occurs when trying to decode a custom object from a text or binary message.
+ * 
+ */
+public class DecodeException extends Exception {
+    private static final long serialVersionUID = -446026355870506692L;
+
+    private final ByteBuffer bytes;
+    private final String text;
+
+    /**
+     * Constructs a DecodedException with the given ByteBuffer that cannot be decoded, and reason why. The buffer may
+     * represent the whole message, or the part of the message most relevant to the decoding error, depending whether
+     * the application is using one of the streaming methods or not.
+     * 
+     * @param bytes
+     *            the byte buffer containing the (part of) the message that could not be decoded.
+     * @param message
+     *            the reason for the failure.
+     */
+    public DecodeException(ByteBuffer bytes, String message) {
+        super(message);
+        this.bytes = bytes;
+        this.text = null;
+    }
+
+    /**
+     * Constructor with the binary data that could not be decoded, and the reason why it failed to be, and the cause.
+     * The buffer may represent the whole message, or the part of the message most relevant to the decoding error,
+     * depending whether the application is using one of the streaming methods or not.
+     * 
+     * @param bytes
+     *            the byte buffer containing the (part of) the message that could not be decoded.
+     * @param message
+     *            the reason for the failure.
+     * @param cause
+     *            the cause of the error.
+     */
+    public DecodeException(ByteBuffer bytes, String message, Throwable cause) {
+        super(message, cause);
+        this.bytes = bytes;
+        this.text = null;
+    }
+
+    /**
+     * Constructs a DecodedException with the given encoded string that cannot be decoded, and reason why. The encoded
+     * string may represent the whole message, or the part of the message most relevant to the decoding error, depending
+     * whether the application is using one of the streaming methods or not.
+     * 
+     * @param encodedString
+     *            the string representing the (part of) the message that could not be decoded.
+     * @param message
+     *            the reason for the failure.
+     */
+    public DecodeException(String encodedString, String message) {
+        super(message);
+        this.text = encodedString;
+        this.bytes = null;
+    }
+
+    /**
+     * Constructor with the text data that could not be decoded, and the reason why it failed to be, and the cause. The
+     * encoded string may represent the whole message, or the part of the message most relevant to the decoding error,
+     * depending whether the application is using one of the streaming methods or not.
+     * 
+     * @param encodedString
+     *            the string representing the (part of) the message that could not be decoded.
+     * @param message
+     *            the reason for the failure.
+     * @param cause
+     *            the cause of the error.
+     */
+    public DecodeException(String encodedString, String message, Throwable cause) {
+        super(message, cause);
+        this.text = encodedString;
+        this.bytes = null;
+    }
+
+    /**
+     * Return the ByteBuffer containing either the whole message, or the partial message, that could not be decoded, or
+     * null if this exception arose from a failure to decode a text message.
+     * 
+     * @return the binary data not decoded or null for text message failures.
+     */
+    public ByteBuffer getBytes() {
+        return bytes;
+    }
+
+    /**
+     * Return the encoded string that is either the whole message, or the partial message that could not be decoded, or
+     * null if this exception arose from a failure to decode a binary message..
+     * 
+     * @return the text not decoded or null for binary message failures.
+     */
+    public String getText() {
+        return text;
+    }
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DecodeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DecodeException.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DecodeException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Decoder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Decoder.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Decoder.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Decoder.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.nio.ByteBuffer;
+
+/**
+ * The Decoder interface holds member interfaces that define how a developer can provide the web socket container a way
+ * web socket messages into developer defined custom objects. The websocket implementation creates a new instance of the
+ * decoder per endpoint instance per connection. The lifecycle of the Decoder instance is governed by the container
+ * calls to the init(javax.websocket.EndpointConfig) and destroy() methods.
+ * 
+ */
+public interface Decoder {
+
+    /**
+     * This interface defines how a custom object (of type T) is decoded from a web socket message in the form of a byte
+     * buffer.
+     */
+    public static interface Binary<T> extends Decoder {
+        /**
+         * Decode the given bytes into an object of type T.
+         * 
+         * @param bytes
+         *            the bytes to be decoded.
+         * @return the decoded object.
+         * @throws DecodeException
+         */
+        T decode(ByteBuffer bytes) throws DecodeException;
+
+        /**
+         * Answer whether the given bytes can be decoded into an object of type T.
+         * 
+         * @param bytes
+         *            the bytes to be decoded.
+         * @return whether or not the bytes can be decoded by this decoder.
+         */
+        boolean willDecode(ByteBuffer bytes);
+    }
+
+    /**
+     * This interface defines how a custom object is decoded from a web socket message in the form of a binary stream.
+     */
+    public static interface BinaryStream<T> extends Decoder {
+        /**
+         * Decode the given bytes read from the input stream into an object of type T.
+         * 
+         * @param is
+         *            the input stream carrying the bytes.
+         * @return the decoded object.
+         * @throws DecodeException
+         * @throws IOException
+         */
+        T decode(InputStream is) throws DecodeException, IOException;
+    }
+
+    /**
+     * This interface defines how a custom object is decoded from a web socket message in the form of a string.
+     */
+    public static interface Text<T> extends Decoder {
+        /**
+         * Decode the given String into an object of type T.
+         * 
+         * @param s
+         *            string to be decoded.
+         * @return the decoded message as an object of type T
+         * @throws DecodeException
+         */
+        T decode(String s) throws DecodeException;
+
+        /**
+         * Answer whether the given String can be decoded into an object of type T.
+         * 
+         * @param s
+         *            the string being tested for decodability.
+         * @return whether this decoder can decoded the supplied string.
+         */
+        boolean willDecode(String s);
+    }
+
+    /**
+     * This interface defines how a custom object of type T is decoded from a web socket message in the form of a
+     * character stream.
+     */
+    public static interface TextStream<T> extends Decoder {
+        /**
+         * Reads the websocket message from the implementation provided Reader and decodes it into an instance of the
+         * supplied object type.
+         * 
+         * @param reader
+         *            the reader from which to read the web socket message.
+         * @return the instance of the object that is the decoded web socket message.
+         * @throws DecodeException
+         * @throws IOException
+         */
+        T decode(Reader reader) throws DecodeException, IOException;
+    }
+
+    /**
+     * This method is called with the endpoint configuration object of the endpoint this decoder is intended for when it
+     * is about to be brought into service.
+     * 
+     * @param config
+     *            the endpoint configuration object when being brought into service
+     */
+    void init(EndpointConfig config);
+
+    /**
+     * This method is called when the decoder is about to be removed from service in order that any resources the
+     * encoder used may be closed gracefully.
+     */
+    void destroy();
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Decoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Decoder.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Decoder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DeploymentException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DeploymentException.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DeploymentException.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DeploymentException.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+/**
+ * Checked exception indicating some kind of failure either to publish an endpoint on its server, or a failure to
+ * connect a client to its server.
+ */
+public class DeploymentException extends Exception {
+    private static final long serialVersionUID = -1927418844498491675L;
+
+    /**
+     * Creates a deployment exception with the given reason for the deployment failure.
+     * 
+     * @param message
+     *            the reason for the failure.
+     */
+    public DeploymentException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a deployment exception with the given reason for the deployment failure and wrapped cause of the failure.
+     * 
+     * @param message
+     *            the reason for the failure.
+     * @param cause
+     *            the cause of the problem.
+     */
+    public DeploymentException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DeploymentException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DeploymentException.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/DeploymentException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EncodeException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EncodeException.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EncodeException.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EncodeException.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+/**
+ * A general exception that occurs when trying to encode a custom object to a string or binary message.
+ */
+public class EncodeException extends Exception {
+    private static final long serialVersionUID = -446026355870506692L;
+
+    private final Object object;
+
+    /**
+     * Constructor with the object being encoded, and the reason why it failed to be.
+     * 
+     * @param object
+     *            the object that could not be encoded.
+     * @param message
+     *            the reason for the failure.
+     */
+    public EncodeException(Object object, String message) {
+        super(message);
+        this.object = object;
+    }
+
+    /**
+     * Constructor with the object being encoded, and the reason why it failed to be, and the cause.
+     * 
+     * @param object
+     *            the object that could not be encoded.
+     * @param message
+     *            the reason for the failure.
+     * @param cause
+     *            the cause of the problem.
+     */
+    public EncodeException(Object object, String message, Throwable cause) {
+        super(message, cause);
+        this.object = object;
+    }
+
+    /**
+     * Return the Object that could not be encoded.
+     * 
+     * @return the object.
+     */
+    public Object getObject() {
+        return this.object;
+    }
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EncodeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EncodeException.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EncodeException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Encoder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Encoder.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Encoder.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Encoder.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.ByteBuffer;
+
+/**
+ * The Encoder interface defines how developers can provide a way to convert their custom objects into web socket
+ * messages. The Encoder interface contains subinterfaces that allow encoding algorithms to encode custom objects to:
+ * text, binary data, character stream and write to an output stream. The websocket implementation creates a new
+ * instance of the encoder per endpoint instance per connection. This means that each encoder instance has at most one
+ * calling thread at a time. The lifecycle of the Encoder instance is governed by the container calls to the
+ * init(javax.websocket.EndpointConfig) and destroy() methods.
+ */
+public interface Encoder {
+
+    /**
+     * This interface defines how to provide a way to convert a custom object into a binary message.
+     * 
+     * @param <T>
+     *            The type of the custom object that this Encoder can encoder to a ByteBuffer.
+     */
+    public static interface Binary<T> extends Encoder {
+        /**
+         * Encode the given object into a byte array.
+         * 
+         * @param object
+         *            the object being encoded.
+         * @return the binary data.
+         * @throws EncodeException
+         */
+        ByteBuffer encode(T object) throws EncodeException;
+    }
+
+    /**
+     * This interface may be implemented by encoding algorithms that want to write the encoded object to a binary
+     * stream.
+     * 
+     * @param <T>
+     *            the type of the object this encoder can encode.
+     */
+    public static interface BinaryStream<T> extends Encoder {
+        /**
+         * Encode the given object into a binary stream written to the implementation provided OutputStream.
+         * 
+         * @param object
+         *            the object being encoded.
+         * @param os
+         *            - the output stream where the encoded data is written.
+         * @throws EncodeException
+         * @throws IOException
+         */
+        void encode(T object, OutputStream os) throws EncodeException, IOException;
+    }
+
+    /**
+     * This interface defines how to provide a way to convert a custom object into a text message.
+     * 
+     * @param <T>
+     *            The type of the custom developer object that this Encoder can encode into a String.
+     */
+    public static interface Text<T> extends Encoder {
+        /**
+         * Encode the given object into a String.
+         * 
+         * @param object
+         *            the object being encoded.
+         * @return the encoded object as a string.
+         * @throws EncodeException
+         */
+        String encode(T object) throws EncodeException;
+    }
+
+    /**
+     * This interface may be implemented by encoding algorithms that want to write the encoded object to a character
+     * stream.
+     * 
+     * @param <T>
+     *            the type of the object this encoder can encode to a CharacterStream.
+     */
+    public static interface TextStream<T> extends Encoder {
+        /**
+         * Encode the given object to a character stream writing it to the supplied Writer. Implementations of this
+         * method may use the EncodeException to indicate a failure to convert the supplied object to an encoded form,
+         * and may use the IOException to indicate a failure to write the data to the supplied stream.
+         * 
+         * @param object
+         *            the object to be encoded.
+         * @param writer
+         *            the writer provided by the web socket runtime to write the encoded data.
+         * @throws EncodeException
+         *             if there was an error encoding the object due to its state.
+         * @throws IOException
+         *             if there was an exception writing to the writer.
+         */
+        void encode(T object, Writer writer) throws EncodeException, IOException;
+    }
+
+    /**
+     * This method is called with the endpoint configuration object of the endpoint this encoder is intended for when it
+     * is about to be brought into service.
+     * 
+     * @param config
+     *            the endpoint configuration object when being brought into service
+     */
+    void init(EndpointConfig config);
+
+    /**
+     * This method is called when the encoder is about to be removed from service in order that any resources the
+     * encoder used may be closed gracefully.
+     */
+    void destroy();
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Encoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Encoder.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Encoder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Endpoint.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Endpoint.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Endpoint.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Endpoint.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+/**
+ * The Web Socket Endpoint represents an object that can handle websocket conversations. Developers may extend this
+ * class in order to implement a programmatic websocket endpoint. The Endpoint class holds lifecycle methods that may be
+ * overridden to intercept websocket open, error and close events. By implementing the onOpen method, the programmatic
+ * endpoint gains access to the Session object, to which the developer may add MessageHandler implementations in order
+ * to intercept incoming websocket messages. Each instance of a websocket endpoint is guaranteed not to be called by
+ * more than one thread at a time per active connection.
+ * <p/>
+ * If deployed as a client endpoint, it will be instantiated once for the single connection to the server.
+ * <p/>
+ * When deployed as a server endpoint, the implementation uses the
+ * ServerEndpointConfig.Configurator.getEndpointInstance(java.lang.Class<T>) method to obtain the endpoint instance it
+ * will use for each new client connection. If the developer uses the default 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.
+ * <p/>
+ * If the developer provides a custom 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.
+ * <p/>
+ * Here is an example of a simple endpoint that echoes any incoming text message back to the sender.
+ * <p/>
+ * <code>
+ * public class EchoServer extends Endpoint {
+ * 
+ *     public void onOpen(Session session, EndpointConfig config) {
+ *         final RemoteEndpoint remote = session.getBasicRemote();
+ *         session.addMessageHandler(new MessageHandler.Whole<String>() {
+ *             public void onMessage(String text) {
+ *                 try {
+ *                     remote.sendString("Got your message (" + text + "). Thanks !");
+ *                 } catch (IOException ioe) {
+ *                     // handle send failure here
+ *                 }
+ *             }
+ *         });
+ *     }
+ * 
+ * }
+ * </code>
+ */
+public abstract class Endpoint {
+
+    public Endpoint() {
+        super();
+    }
+
+    /**
+     * 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.
+     * <p/>
+     * There are a number of categories of exception that this method is (currently) defined to handle:
+     * <ul>
+     * <li>connection problems, for example, a socket failure that occurs before the web socket connection can be
+     * formally closed. These are modeled as SessionExceptions</li>
+     * <li>runtime errors thrown by developer created message handlers calls.</li>
+     * <li>conversion errors encoding incoming messages before any message handler has been called. These are modeled as
+     * DecodeExceptions</li>
+     * 
+     * @param session
+     *            the session in use when the error occurs.
+     * @param thr
+     *            the throwable representing the problem.
+     */
+    public void onError(Session session, Throwable thr) {
+
+    }
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Endpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Endpoint.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Endpoint.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EndpointConfig.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EndpointConfig.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EndpointConfig.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EndpointConfig.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The endpoint configuration contains all the information needed during the handshake process for this end point. All
+ * endpoints specify, for example, a URI. In the case of a server endpoint, the URI signifies the URI to which the
+ * endpoint will be mapped. In the case of a client application the URI signifies the URI of the server to which the
+ * client endpoint will attempt to connect.
+ */
+public interface EndpointConfig {
+
+    /**
+     * Return the Encoder implementation classes configured. These will be instantiated by the container to encode
+     * custom objects passed into the send() methods on remote endpoints.
+     * 
+     * @return the encoder implementation classes, an empty list if none.
+     */
+    List<Class<? extends Encoder>> getEncoders();
+
+    /**
+     * Return the Decoder implementation classes configured. These will be instantiated by the container to decode
+     * incoming messages into the expected custom objects on MessageHandler.Whole.onMessage(Object) callbacks.
+     * 
+     * @return the decoder implementation classes, the empty list if none.
+     */
+    List<Class<? extends Decoder>> getDecoders();
+
+    /**
+     * This method returns a modifiable Map that the developer may use to store application specific information
+     * relating to the endpoint that uses this configuration instance. Web socket applications running on distributed
+     * implementations of the web container should make any application specific objects stored here
+     * java.io.Serializable, or the object may not be recreated after a failover.
+     * 
+     * @return a modifiable Map of application data.
+     */
+    Map<String, Object> getUserProperties();
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EndpointConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EndpointConfig.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/EndpointConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Extension.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Extension.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Extension.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Extension.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+import java.util.List;
+
+/**
+ * A simple representation of a websocket extension as a name and map of extension parameters.
+ */
+public interface Extension {
+
+    /**
+     * This member interface defines a single websocket extension parameter.
+     */
+    public static interface Parameter {
+        /**
+         * Return the name of the extension parameter.
+         * 
+         * @return the name of the parameter.
+         */
+        String getName();
+
+        /**
+         * Return the value of the extension parameter.
+         * 
+         * @return the value of the parameter.
+         */
+        String getValue();
+    }
+
+    /**
+     * The name of the extension.
+     * 
+     * @return the name of the extension.
+     */
+    String getName();
+
+    /**
+     * The extension parameters for this extension in the order they appear in the http headers.
+     * 
+     * @return The read-only Map of extension parameters belonging to this extension.
+     */
+    List<Parameter> getParameters();
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Extension.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Extension.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/Extension.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/HandshakeResponse.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/HandshakeResponse.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/HandshakeResponse.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/HandshakeResponse.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package javax.websocket;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The handshake response represents the web socket-defined Http response that is the response to the opening handshake
+ * request.
+ */
+public interface HandshakeResponse {
+
+    /**
+     * The Sec-WebSocket-Accept header name.
+     */
+    static final String SEC_WEBSOCKET_ACCEPT = "Sec-WebSocket-Accept";
+
+    /**
+     * Return the list of Http headers sent by the web socket server.
+     * 
+     * @return the http headers .
+     */
+    Map<String, List<String>> getHeaders();
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/HandshakeResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/HandshakeResponse.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/HandshakeResponse.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/MessageHandler.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/MessageHandler.java?rev=1492048&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/MessageHandler.java (added)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/MessageHandler.java Wed Jun 12 04:13:29 2013
@@ -0,0 +1,105 @@
+package javax.websocket;
+
+/**
+ * Developers implement MessageHandlers in order to receive incoming messages during a web socket conversation. Each web
+ * socket session uses no more than one thread at a time to call its MessageHandlers. This means that, provided each
+ * message handler instance is used to handle messages for one web socket session, at most one thread at a time can be
+ * calling any of its methods. Developers who wish to handle messages from multiple clients within the same message
+ * handlers may do so by adding the same instance as a handler on each of the Session objects for the clients. In that
+ * case, they will need to code with the possibility of their MessageHandler being called concurrently by multiple
+ * threads, each one arising from a different client session.
+ * <p/>
+ * See Endpoint for a usage example.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public interface MessageHandler {
+
+    /**
+     * This kind of handler is notified by the implementation as it becomes ready to deliver parts of a whole message.
+     * <p/>
+     * For handling parts of text messages, the type T is String
+     * <p/>
+     * For handling parts of binary messages, the allowable types for T are
+     * <ul>
+     * <li>ByteBuffer</li>
+     * <li>byte[]</li>
+     * </ul>
+     * <p/>
+     * Developers should not continue to reference message objects of type ByteBuffer after the completion of the
+     * onMessage() call, since they may be recycled by the implementation.
+     * <p/>
+     * 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 <T>
+     *            The type of the object that represent pieces of the incoming message that this MessageHandler will
+     *            consume.
+     */
+    public static interface Partial<T> extends MessageHandler {
+        /**
+         * Called when the next part of a message has been fully received.
+         * 
+         * @param partialMessage
+         *            the partial message data.
+         * @param last
+         *            flag to indicate if this partialMessage is the last of the whole message being delivered.
+         */
+        void onMessage(T partialMessage, boolean last);
+    }
+
+    /**
+     * 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.
+     * <p/>
+     * For handling incoming text messages, the allowed types for T are
+     * <ul>
+     * <li>String</li>
+     * <li>Reader</li>
+     * <li>any developer object for which there is a corresponding Decoder.Text or Decoder.TextStream configured</li>
+     * </ul>
+     * <p/>
+     * For handling incoming binary messages, the allowed types for T are
+     * <ul>
+     * <li>ByteBuffer</li>
+     * <li>byte[]</li>
+     * <li>InputStream</li>
+     * <li>any developer object for which there is a corresponding Decoder.Binary or Decoder.BinaryStream configured</li>
+     * </ul>
+     * <p/>
+     * For handling incoming pong messages, the type of T is PongMessage
+     * <p/>
+     * Developers should not continue to reference message objects of type Reader, ByteBuffer or InputStream after the
+     * completion of the onMessage() call, since they may be recycled by the implementation.
+     * 
+     * @param <T>
+     *            The type of the message object that this MessageHandler will consume.
+     */
+    public static interface Whole<T> extends MessageHandler {
+        /**
+         * Called when the message has been fully received.
+         * 
+         * @param message
+         *            the message data.
+         */
+        void onMessage(T message);
+    }
+}

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/MessageHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/MessageHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/MessageHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message