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 2013/01/21 01:18:41 UTC

svn commit: r1436011 - in /tomcat/trunk/java/org/apache/tomcat/websocket: WsRemoteEndpointClient.java WsWebSocketContainer.java

Author: markt
Date: Mon Jan 21 00:18:41 2013
New Revision: 1436011

URL: http://svn.apache.org/viewvc?rev=1436011&view=rev
Log:
Add a little more client plumbing

Added:
    tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointClient.java   (with props)
Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java

Added: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointClient.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointClient.java?rev=1436011&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointClient.java (added)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointClient.java Mon Jan 21 00:18:41 2013
@@ -0,0 +1,43 @@
+/*
+ *  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 org.apache.tomcat.websocket;
+
+import java.nio.ByteBuffer;
+
+public class WsRemoteEndpointClient extends WsRemoteEndpointBase {
+
+    @Override
+    public void onWritePossible() {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    protected void writeMessage(int opCode, ByteBuffer header,
+            ByteBuffer message) {
+        // TODO Auto-generated method stub
+
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        // TODO Auto-generated method stub
+
+    }
+}

Propchange: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1436011&r1=1436010&r2=1436011&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Mon Jan 21 00:18:41 2013
@@ -40,8 +40,27 @@ public class WsWebSocketContainer implem
     public Session connectToServer(Class<? extends Endpoint> endpoint,
             ClientEndpointConfiguration clientEndpointConfiguration, URI path)
             throws DeploymentException {
-        // TODO Auto-generated method stub
-        return null;
+
+        // Create HTTP connection
+        // TODO
+
+        // Handshake
+        // TODO
+
+        // Switch to WebSocket
+        WsRemoteEndpointClient wsRemoteEndpointClient =
+                new WsRemoteEndpointClient();
+
+        WsSession wsSession;
+        try {
+            wsSession = new WsSession(endpoint.newInstance());
+        } catch (InstantiationException | IllegalAccessException e) {
+            // TODO
+            throw new DeploymentException("TBD", e);
+        }
+
+        wsSession.setRemote(wsRemoteEndpointClient);
+        return wsSession;
     }
 
 



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