From fc0948d7ad308a47a80139a0779e08f24903df46 Mon Sep 17 00:00:00 2001 From: fmoga Date: Sun, 24 Jul 2011 13:32:46 +0000 Subject: Migrate to embedded Jetty as websocket server. Add javascript service proxy injection. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1150357 13f79535-47bb-0310-9956-ffa450edef68 --- .../runtime/WebSocketOperationDispatcher.java | 95 ---------------------- 1 file changed, 95 deletions(-) delete mode 100644 sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebSocketOperationDispatcher.java (limited to 'sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebSocketOperationDispatcher.java') diff --git a/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebSocketOperationDispatcher.java b/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebSocketOperationDispatcher.java deleted file mode 100644 index c33b3ca12a..0000000000 --- a/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebSocketOperationDispatcher.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.tuscany.sca.binding.websocket.runtime; - -import java.io.IOException; -import java.nio.channels.SocketChannel; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.apache.websocket.ServerWebSocket; -import org.apache.websocket.WebSocket; -import org.apache.websocket.WebSocketApplication; -import org.apache.websocket.WebSocketException; - -public class WebSocketOperationDispatcher implements WebSocketApplication { - - private ServerWebSocket server; - private Map endpoints = new HashMap(); - private Map operations = new HashMap(); - - public WebSocketOperationDispatcher(ServerWebSocket server) { - this.server = server; - } - - public void addOperation(String uri, RuntimeEndpoint endpoint, Operation operation) { - endpoints.put(uri, endpoint); - operations.put(uri, operation); - } - - public Operation getOperation(String uri) { - return operations.get(uri); - } - - public RuntimeEndpoint getEndpoint(String uri) { - return endpoints.get(uri); - } - - @Override - public void onConnection(WebSocket socket) { - // release server thread - new Thread(new WebSocketRequestHandler(socket, this)).start(); - } - - @Override - public void onHandshakeError(IOException e) { - throw new RuntimeException(e); - } - - @Override - public String acceptProtocol(String protocol) { - // don't accept any subprotocols - return null; - } - - @Override - public boolean acceptOrigin(String origin) { - // accept all clients - return true; - } - - @Override - public Map acceptExtensions(Map headers) throws WebSocketException { - // don't accept any extensions - return null; - } - - public void shutdown() { - try { - server.close(); - endpoints.clear(); - operations.clear(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - -} \ No newline at end of file -- cgit v1.2.3