You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/12/05 23:52:00 UTC

svn commit: r1417682 - /tomcat/trunk/java/javax/websocket/

Author: markt
Date: Wed Dec  5 22:51:58 2012
New Revision: 1417682

URL: http://svn.apache.org/viewvc?rev=1417682&view=rev
Log:
Sync with latest API from EG

Added:
    tomcat/trunk/java/javax/websocket/EndpointFactory.java
Modified:
    tomcat/trunk/java/javax/websocket/ClientContainer.java
    tomcat/trunk/java/javax/websocket/ClientEndpointConfiguration.java
    tomcat/trunk/java/javax/websocket/DefaultClientConfiguration.java
    tomcat/trunk/java/javax/websocket/DefaultServerConfiguration.java
    tomcat/trunk/java/javax/websocket/Endpoint.java
    tomcat/trunk/java/javax/websocket/ServerContainer.java
    tomcat/trunk/java/javax/websocket/ServerEndpointConfiguration.java
    tomcat/trunk/java/javax/websocket/Session.java
    tomcat/trunk/java/javax/websocket/WebSocketEndpoint.java
    tomcat/trunk/java/javax/websocket/WebSocketMessage.java
    tomcat/trunk/java/javax/websocket/WebSocketPathParam.java

Modified: tomcat/trunk/java/javax/websocket/ClientContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/ClientContainer.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/ClientContainer.java (original)
+++ tomcat/trunk/java/javax/websocket/ClientContainer.java Wed Dec  5 22:51:58 2012
@@ -21,9 +21,14 @@ import java.util.Set;
 
 public interface ClientContainer {
 
-    void connectToServer(Object endpoint, URI path) throws DeploymentException;
+    Session connectToServer(Object endpoint, URI path)
+            throws DeploymentException;
 
-    Set<Session> getActiveSessions();
+    Session connectToServer(Endpoint endpoint,
+            ClientEndpointConfiguration clientEndpointConfiguration, URI path)
+            throws DeploymentException;
+
+    Set<Session> getOpenSessions();
 
     long getMaxSessionIdleTimeout();
 

Modified: tomcat/trunk/java/javax/websocket/ClientEndpointConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/ClientEndpointConfiguration.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/ClientEndpointConfiguration.java (original)
+++ tomcat/trunk/java/javax/websocket/ClientEndpointConfiguration.java Wed Dec  5 22:51:58 2012
@@ -23,4 +23,8 @@ public interface ClientEndpointConfigura
     List<String> getPreferredSubprotocols();
 
     List<String> getExtensions();
+
+    void beforeRequest(HandshakeRequest handshakeRequest);
+
+    void afterResponse(HandshakeResponse handshakeResponse);
 }

Modified: tomcat/trunk/java/javax/websocket/DefaultClientConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/DefaultClientConfiguration.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/DefaultClientConfiguration.java (original)
+++ tomcat/trunk/java/javax/websocket/DefaultClientConfiguration.java Wed Dec  5 22:51:58 2012
@@ -66,4 +66,14 @@ public class DefaultClientConfiguration 
         this.decoders = decoders;
         return this;
     }
+
+    @Override
+    public void beforeRequest(HandshakeRequest handshakeRequest) {
+        // NO-OP
+    }
+
+    @Override
+    public void afterResponse(HandshakeResponse handshakeResponse) {
+        // NO-OP
+    }
 }

Modified: tomcat/trunk/java/javax/websocket/DefaultServerConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/DefaultServerConfiguration.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/DefaultServerConfiguration.java (original)
+++ tomcat/trunk/java/javax/websocket/DefaultServerConfiguration.java Wed Dec  5 22:51:58 2012
@@ -20,7 +20,9 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
 
-public class DefaultServerConfiguration implements ServerEndpointConfiguration {
+public class DefaultServerConfiguration<T>
+        implements ServerEndpointConfiguration<T> {
+
     private String path;
     @SuppressWarnings("unused") // TODO Remove this once implemented
     private List<String> subprotocols = new ArrayList<>();
@@ -32,27 +34,33 @@ public class DefaultServerConfiguration 
     protected DefaultServerConfiguration() {
     }
 
+    @Override
+    public EndpointFactory<T> getEndpointFactory() {
+        // TODO
+        return null;
+    }
+
     public DefaultServerConfiguration(String path) {
         this.path = path;
     }
 
-    public DefaultServerConfiguration setEncoders(List<Encoder> encoders) {
+    public DefaultServerConfiguration<T> setEncoders(List<Encoder> encoders) {
         this.encoders = encoders;
         return this;
     }
 
-    public DefaultServerConfiguration setDecoders(List<Decoder> decoders) {
+    public DefaultServerConfiguration<T> setDecoders(List<Decoder> decoders) {
         this.decoders = decoders;
         return this;
     }
 
-    public DefaultServerConfiguration setSubprotocols(
+    public DefaultServerConfiguration<T> setSubprotocols(
             List<String> subprotocols) {
         this.subprotocols = subprotocols;
         return this;
     }
 
-    public DefaultServerConfiguration setExtensions(
+    public DefaultServerConfiguration<T> setExtensions(
             List<String> extensions) {
         this.extensions = extensions;
         return this;
@@ -64,7 +72,6 @@ public class DefaultServerConfiguration 
         return this.encoders;
     }
 
-
     @Override
     public List<Decoder> getDecoders() {
         return this.decoders;
@@ -81,7 +88,6 @@ public class DefaultServerConfiguration 
         return null;
     }
 
-
     @Override
     public List<String> getNegotiatedExtensions(
             List<String> requestedExtensions) {

Modified: tomcat/trunk/java/javax/websocket/Endpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/Endpoint.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/Endpoint.java (original)
+++ tomcat/trunk/java/javax/websocket/Endpoint.java Wed Dec  5 22:51:58 2012
@@ -18,8 +18,6 @@ package javax.websocket;
 
 public abstract class Endpoint {
 
-    public abstract EndpointConfiguration getEndpointConfiguration();
-
     /**
      * Event that is triggered when a new session starts.
      *

Added: tomcat/trunk/java/javax/websocket/EndpointFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/EndpointFactory.java?rev=1417682&view=auto
==============================================================================
--- tomcat/trunk/java/javax/websocket/EndpointFactory.java (added)
+++ tomcat/trunk/java/javax/websocket/EndpointFactory.java Wed Dec  5 22:51:58 2012
@@ -0,0 +1,21 @@
+/*
+ * 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 interface EndpointFactory<T> {
+    T createEndpoint();
+}

Modified: tomcat/trunk/java/javax/websocket/ServerContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/ServerContainer.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/ServerContainer.java (original)
+++ tomcat/trunk/java/javax/websocket/ServerContainer.java Wed Dec  5 22:51:58 2012
@@ -22,12 +22,14 @@ package javax.websocket;
 public interface ServerContainer extends ClientContainer {
 
     /**
-     * Publish the Endpoint in this ServerContainer.
+     * Publish the Endpoint asscoiated with the given configuration in this
+     * ServerContainer.
      *
-     * @param clazz The implementation class for the Endpoint
+     * @param clazz The configuration class for the Endpoint
      *
      * @throws DeploymentException  If the publish process fails for any reason
      */
-    void publishServer(Class<? extends Endpoint> clazz)
+    void publishServer(
+            Class<? extends ServerEndpointConfiguration<?>> clazz)
             throws DeploymentException;
 }

Modified: tomcat/trunk/java/javax/websocket/ServerEndpointConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/ServerEndpointConfiguration.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/ServerEndpointConfiguration.java (original)
+++ tomcat/trunk/java/javax/websocket/ServerEndpointConfiguration.java Wed Dec  5 22:51:58 2012
@@ -19,7 +19,9 @@ package javax.websocket;
 import java.net.URI;
 import java.util.List;
 
-public interface ServerEndpointConfiguration extends EndpointConfiguration {
+public interface ServerEndpointConfiguration<T> extends EndpointConfiguration {
+
+    EndpointFactory<T> getEndpointFactory();
 
     String getNegotiatedSubprotocol(List<String> requestedSubprotocols);
 

Modified: tomcat/trunk/java/javax/websocket/Session.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/Session.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/Session.java (original)
+++ tomcat/trunk/java/javax/websocket/Session.java Wed Dec  5 22:51:58 2012
@@ -26,8 +26,6 @@ public interface Session {
 
     ClientContainer getContainer();
 
-    void setEncoders(List<Encoder> encoders);
-
     void addMessageHandler(MessageHandler listener);
 
     Set<MessageHandler> getMessageHandlers();
@@ -44,7 +42,7 @@ public interface Session {
 
     long getInactiveTime();
 
-    boolean isActive();
+    boolean isOpen();
 
     long getTimeout();
 
@@ -67,4 +65,6 @@ public interface Session {
     String getQueryString();
 
     Map<String,String> getPathParameters();
+
+    Map<String,Object> getUserProperties();
 }

Modified: tomcat/trunk/java/javax/websocket/WebSocketEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/WebSocketEndpoint.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/WebSocketEndpoint.java (original)
+++ tomcat/trunk/java/javax/websocket/WebSocketEndpoint.java Wed Dec  5 22:51:58 2012
@@ -28,11 +28,13 @@ public @interface WebSocketEndpoint {
     /**
      * URI or URI-template that the annotated class should be mapped to.
      */
-    public String value();
+    String value();
 
-    public String[] subprotocols() default {};
+    String[] subprotocols() default {};
 
-    public Class<? extends Decoder>[] decoders() default {};
+    Class<? extends Decoder>[] decoders() default {};
 
-    public Class<? extends Encoder>[] encoders() default {};
+    Class<? extends Encoder>[] encoders() default {};
+
+    //Class<? extends EndpointFactory<?>> factory();
 }

Modified: tomcat/trunk/java/javax/websocket/WebSocketMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/WebSocketMessage.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/WebSocketMessage.java (original)
+++ tomcat/trunk/java/javax/websocket/WebSocketMessage.java Wed Dec  5 22:51:58 2012
@@ -24,5 +24,5 @@ import java.lang.annotation.Target;
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.METHOD)
 public @interface WebSocketMessage {
-    public long maxMessageSize() default -1;
+    long maxMessageSize() default -1;
 }

Modified: tomcat/trunk/java/javax/websocket/WebSocketPathParam.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/WebSocketPathParam.java?rev=1417682&r1=1417681&r2=1417682&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/WebSocketPathParam.java (original)
+++ tomcat/trunk/java/javax/websocket/WebSocketPathParam.java Wed Dec  5 22:51:58 2012
@@ -24,5 +24,5 @@ import java.lang.annotation.Target;
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.PARAMETER)
 public @interface WebSocketPathParam {
-    public String value();
+    String value();
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org