You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2016/03/29 06:20:29 UTC
[20/51] [abbrv] incubator-guacamole-client git commit: GUACAMOLE-1:
Rename Basic* classes sensibly. Refactor tunnel classes into own packages.
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/GuacamoleWebSocketTunnelServlet.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/GuacamoleWebSocketTunnelServlet.java b/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/GuacamoleWebSocketTunnelServlet.java
new file mode 100644
index 0000000..ff1775c
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/GuacamoleWebSocketTunnelServlet.java
@@ -0,0 +1,265 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.tunnel.websocket.tomcat;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.io.GuacamoleReader;
+import org.apache.guacamole.io.GuacamoleWriter;
+import org.apache.guacamole.net.GuacamoleTunnel;
+import org.apache.catalina.websocket.StreamInbound;
+import org.apache.catalina.websocket.WebSocketServlet;
+import org.apache.catalina.websocket.WsOutbound;
+import org.apache.guacamole.GuacamoleClientException;
+import org.apache.guacamole.GuacamoleConnectionClosedException;
+import org.apache.guacamole.tunnel.http.HTTPTunnelRequest;
+import org.apache.guacamole.tunnel.TunnelRequest;
+import org.apache.guacamole.protocol.GuacamoleStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A WebSocketServlet partial re-implementation of GuacamoleTunnelServlet.
+ *
+ * @author Michael Jumper
+ */
+public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
+
+ /**
+ * The default, minimum buffer size for instructions.
+ */
+ private static final int BUFFER_SIZE = 8192;
+
+ /**
+ * Logger for this class.
+ */
+ private final Logger logger = LoggerFactory.getLogger(GuacamoleWebSocketTunnelServlet.class);
+
+ /**
+ * Sends the given status on the given WebSocket connection and closes the
+ * connection.
+ *
+ * @param outbound The outbound WebSocket connection to close.
+ * @param guac_status The status to send.
+ */
+ public void closeConnection(WsOutbound outbound, GuacamoleStatus guac_status) {
+
+ try {
+ byte[] message = Integer.toString(guac_status.getGuacamoleStatusCode()).getBytes("UTF-8");
+ outbound.close(guac_status.getWebSocketCode(), ByteBuffer.wrap(message));
+ }
+ catch (IOException e) {
+ logger.debug("Unable to close WebSocket tunnel.", e);
+ }
+
+ }
+
+ @Override
+ protected String selectSubProtocol(List<String> subProtocols) {
+
+ // Search for expected protocol
+ for (String protocol : subProtocols)
+ if ("guacamole".equals(protocol))
+ return "guacamole";
+
+ // Otherwise, fail
+ return null;
+
+ }
+
+ @Override
+ public StreamInbound createWebSocketInbound(String protocol,
+ HttpServletRequest request) {
+
+ final TunnelRequest tunnelRequest = new HTTPTunnelRequest(request);
+
+ // Return new WebSocket which communicates through tunnel
+ return new StreamInbound() {
+
+ /**
+ * The GuacamoleTunnel associated with the connected WebSocket. If
+ * the WebSocket has not yet been connected, this will be null.
+ */
+ private GuacamoleTunnel tunnel = null;
+
+ @Override
+ protected void onTextData(Reader reader) throws IOException {
+
+ // Ignore inbound messages if there is no associated tunnel
+ if (tunnel == null)
+ return;
+
+ GuacamoleWriter writer = tunnel.acquireWriter();
+
+ // Write all available data
+ try {
+
+ char[] buffer = new char[BUFFER_SIZE];
+
+ int num_read;
+ while ((num_read = reader.read(buffer)) > 0)
+ writer.write(buffer, 0, num_read);
+
+ }
+ catch (GuacamoleConnectionClosedException e) {
+ logger.debug("Connection to guacd closed.", e);
+ }
+ catch (GuacamoleException e) {
+ logger.debug("WebSocket tunnel write failed.", e);
+ }
+
+ tunnel.releaseWriter();
+ }
+
+ @Override
+ public void onOpen(final WsOutbound outbound) {
+
+ try {
+ tunnel = doConnect(tunnelRequest);
+ }
+ catch (GuacamoleException e) {
+ logger.error("Creation of WebSocket tunnel to guacd failed: {}", e.getMessage());
+ logger.debug("Error connecting WebSocket tunnel.", e);
+ closeConnection(outbound, e.getStatus());
+ return;
+ }
+
+ // Do not start connection if tunnel does not exist
+ if (tunnel == null) {
+ closeConnection(outbound, GuacamoleStatus.RESOURCE_NOT_FOUND);
+ return;
+ }
+
+ Thread readThread = new Thread() {
+
+ @Override
+ public void run() {
+
+ StringBuilder buffer = new StringBuilder(BUFFER_SIZE);
+ GuacamoleReader reader = tunnel.acquireReader();
+ char[] readMessage;
+
+ try {
+
+ try {
+
+ // Attempt to read
+ while ((readMessage = reader.read()) != null) {
+
+ // Buffer message
+ buffer.append(readMessage);
+
+ // Flush if we expect to wait or buffer is getting full
+ if (!reader.available() || buffer.length() >= BUFFER_SIZE) {
+ outbound.writeTextMessage(CharBuffer.wrap(buffer));
+ buffer.setLength(0);
+ }
+
+ }
+
+ // No more data
+ closeConnection(outbound, GuacamoleStatus.SUCCESS);
+
+ }
+
+ // Catch any thrown guacamole exception and attempt
+ // to pass within the WebSocket connection, logging
+ // each error appropriately.
+ catch (GuacamoleClientException e) {
+ logger.info("WebSocket connection terminated: {}", e.getMessage());
+ logger.debug("WebSocket connection terminated due to client error.", e);
+ closeConnection(outbound, e.getStatus());
+ }
+ catch (GuacamoleConnectionClosedException e) {
+ logger.debug("Connection to guacd closed.", e);
+ closeConnection(outbound, GuacamoleStatus.SUCCESS);
+ }
+ catch (GuacamoleException e) {
+ logger.error("Connection to guacd terminated abnormally: {}", e.getMessage());
+ logger.debug("Internal error during connection to guacd.", e);
+ closeConnection(outbound, e.getStatus());
+ }
+
+ }
+ catch (IOException e) {
+ logger.debug("I/O error prevents further reads.", e);
+ }
+
+ }
+
+ };
+
+ readThread.start();
+
+ }
+
+ @Override
+ public void onClose(int i) {
+ try {
+ if (tunnel != null)
+ tunnel.close();
+ }
+ catch (GuacamoleException e) {
+ logger.debug("Unable to close connection to guacd.", e);
+ }
+ }
+
+ @Override
+ protected void onBinaryData(InputStream in) throws IOException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ };
+
+ }
+
+ /**
+ * Called whenever the JavaScript Guacamole client makes a connection
+ * request. It it up to the implementor of this function to define what
+ * conditions must be met for a tunnel to be configured and returned as a
+ * result of this connection request (whether some sort of credentials must
+ * be specified, for example).
+ *
+ * @param request
+ * The TunnelRequest associated with the connection request received.
+ * Any parameters specified along with the connection request can be
+ * read from this object.
+ *
+ * @return
+ * A newly constructed GuacamoleTunnel if successful, null otherwise.
+ *
+ * @throws GuacamoleException
+ * If an error occurs while constructing the GuacamoleTunnel, or if the
+ * conditions required for connection are not met.
+ */
+ protected abstract GuacamoleTunnel doConnect(TunnelRequest request)
+ throws GuacamoleException;
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/RestrictedGuacamoleWebSocketTunnelServlet.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/RestrictedGuacamoleWebSocketTunnelServlet.java b/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/RestrictedGuacamoleWebSocketTunnelServlet.java
new file mode 100644
index 0000000..3e0b4e6
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/RestrictedGuacamoleWebSocketTunnelServlet.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.tunnel.websocket.tomcat;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.net.GuacamoleTunnel;
+import org.apache.guacamole.tunnel.TunnelRequestService;
+import org.apache.guacamole.tunnel.TunnelRequest;
+
+/**
+ * Tunnel servlet implementation which uses WebSocket as a tunnel backend,
+ * rather than HTTP, properly parsing connection IDs included in the connection
+ * request.
+ */
+@Singleton
+public class RestrictedGuacamoleWebSocketTunnelServlet extends GuacamoleWebSocketTunnelServlet {
+
+ /**
+ * Service for handling tunnel requests.
+ */
+ @Inject
+ private TunnelRequestService tunnelRequestService;
+
+ @Override
+ protected GuacamoleTunnel doConnect(TunnelRequest request)
+ throws GuacamoleException {
+ return tunnelRequestService.createTunnel(request);
+ };
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/WebSocketTunnelModule.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/WebSocketTunnelModule.java b/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/WebSocketTunnelModule.java
new file mode 100644
index 0000000..1b553b9
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/WebSocketTunnelModule.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2014 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.tunnel.websocket.tomcat;
+
+import com.google.inject.servlet.ServletModule;
+import org.apache.guacamole.tunnel.TunnelLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Loads the Jetty 9 WebSocket tunnel implementation.
+ *
+ * @author Michael Jumper
+ */
+public class WebSocketTunnelModule extends ServletModule implements TunnelLoader {
+
+ /**
+ * Logger for this class.
+ */
+ private final Logger logger = LoggerFactory.getLogger(WebSocketTunnelModule.class);
+
+ @Override
+ public boolean isSupported() {
+
+ try {
+
+ // Attempt to find WebSocket servlet
+ Class.forName("org.apache.guacamole.websocket.tomcat.BasicGuacamoleWebSocketTunnelServlet");
+
+ // Support found
+ return true;
+
+ }
+
+ // If no such servlet class, this particular WebSocket support
+ // is not present
+ catch (ClassNotFoundException e) {}
+ catch (NoClassDefFoundError e) {}
+
+ // Support not found
+ return false;
+
+ }
+
+ @Override
+ public void configureServlets() {
+
+ logger.info("Loading Tomcat 7 WebSocket support...");
+ serve("/websocket-tunnel").with(RestrictedGuacamoleWebSocketTunnelServlet.class);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/package-info.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/package-info.java b/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/package-info.java
new file mode 100644
index 0000000..cacd13b
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/package-info.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/**
+ * Tomcat WebSocket tunnel implementation. The classes here require at least
+ * Tomcat 7.0, and may change significantly as there is no common WebSocket
+ * API for Java yet.
+ */
+package org.apache.guacamole.tunnel.websocket.tomcat;
+
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/BasicGuacamoleWebSocketTunnelEndpoint.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/BasicGuacamoleWebSocketTunnelEndpoint.java b/guacamole/src/main/java/org/apache/guacamole/websocket/BasicGuacamoleWebSocketTunnelEndpoint.java
deleted file mode 100644
index 744608a..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/BasicGuacamoleWebSocketTunnelEndpoint.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket;
-
-import com.google.inject.Provider;
-import java.util.Map;
-import javax.websocket.EndpointConfig;
-import javax.websocket.HandshakeResponse;
-import javax.websocket.Session;
-import javax.websocket.server.HandshakeRequest;
-import javax.websocket.server.ServerEndpointConfig;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.net.GuacamoleTunnel;
-import org.apache.guacamole.TunnelRequest;
-import org.apache.guacamole.TunnelRequestService;
-import org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint;
-
-/**
- * Tunnel implementation which uses WebSocket as a tunnel backend, rather than
- * HTTP, properly parsing connection IDs included in the connection request.
- */
-public class BasicGuacamoleWebSocketTunnelEndpoint extends GuacamoleWebSocketTunnelEndpoint {
-
- /**
- * Unique string which shall be used to store the TunnelRequest
- * associated with a WebSocket connection.
- */
- private static final String TUNNEL_REQUEST_PROPERTY = "WS_GUAC_TUNNEL_REQUEST";
-
- /**
- * Unique string which shall be used to store the TunnelRequestService to
- * be used for processing TunnelRequests.
- */
- private static final String TUNNEL_REQUEST_SERVICE_PROPERTY = "WS_GUAC_TUNNEL_REQUEST_SERVICE";
-
- /**
- * Configurator implementation which stores the requested GuacamoleTunnel
- * within the user properties. The GuacamoleTunnel will be later retrieved
- * during the connection process.
- */
- public static class Configurator extends ServerEndpointConfig.Configurator {
-
- /**
- * Provider which provides instances of a service for handling
- * tunnel requests.
- */
- private final Provider<TunnelRequestService> tunnelRequestServiceProvider;
-
- /**
- * Creates a new Configurator which uses the given tunnel request
- * service provider to retrieve the necessary service to handle new
- * connections requests.
- *
- * @param tunnelRequestServiceProvider
- * The tunnel request service provider to use for all new
- * connections.
- */
- public Configurator(Provider<TunnelRequestService> tunnelRequestServiceProvider) {
- this.tunnelRequestServiceProvider = tunnelRequestServiceProvider;
- }
-
- @Override
- public void modifyHandshake(ServerEndpointConfig config,
- HandshakeRequest request, HandshakeResponse response) {
-
- super.modifyHandshake(config, request, response);
-
- // Store tunnel request and tunnel request service for retrieval
- // upon WebSocket open
- Map<String, Object> userProperties = config.getUserProperties();
- userProperties.clear();
- userProperties.put(TUNNEL_REQUEST_PROPERTY, new WebSocketTunnelRequest(request));
- userProperties.put(TUNNEL_REQUEST_SERVICE_PROPERTY, tunnelRequestServiceProvider.get());
-
- }
-
- }
-
- @Override
- protected GuacamoleTunnel createTunnel(Session session,
- EndpointConfig config) throws GuacamoleException {
-
- Map<String, Object> userProperties = config.getUserProperties();
-
- // Get original tunnel request
- TunnelRequest tunnelRequest = (TunnelRequest) userProperties.get(TUNNEL_REQUEST_PROPERTY);
- if (tunnelRequest == null)
- return null;
-
- // Get tunnel request service
- TunnelRequestService tunnelRequestService = (TunnelRequestService) userProperties.get(TUNNEL_REQUEST_SERVICE_PROPERTY);
- if (tunnelRequestService == null)
- return null;
-
- // Create and return tunnel
- return tunnelRequestService.createTunnel(tunnelRequest);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/WebSocketTunnelModule.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/WebSocketTunnelModule.java b/guacamole/src/main/java/org/apache/guacamole/websocket/WebSocketTunnelModule.java
deleted file mode 100644
index bfa2659..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/WebSocketTunnelModule.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket;
-
-import com.google.inject.Provider;
-import com.google.inject.servlet.ServletModule;
-import java.util.Arrays;
-import javax.websocket.DeploymentException;
-import javax.websocket.server.ServerContainer;
-import javax.websocket.server.ServerEndpointConfig;
-import org.apache.guacamole.TunnelLoader;
-import org.apache.guacamole.TunnelRequestService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Loads the JSR-356 WebSocket tunnel implementation.
- *
- * @author Michael Jumper
- */
-public class WebSocketTunnelModule extends ServletModule implements TunnelLoader {
-
- /**
- * Logger for this class.
- */
- private final Logger logger = LoggerFactory.getLogger(WebSocketTunnelModule.class);
-
- @Override
- public boolean isSupported() {
-
- try {
-
- // Attempt to find WebSocket servlet
- Class.forName("javax.websocket.Endpoint");
-
- // Support found
- return true;
-
- }
-
- // If no such servlet class, this particular WebSocket support
- // is not present
- catch (ClassNotFoundException e) {}
- catch (NoClassDefFoundError e) {}
-
- // Support not found
- return false;
-
- }
-
- @Override
- public void configureServlets() {
-
- logger.info("Loading JSR-356 WebSocket support...");
-
- // Get container
- ServerContainer container = (ServerContainer) getServletContext().getAttribute("javax.websocket.server.ServerContainer");
- if (container == null) {
- logger.warn("ServerContainer attribute required by JSR-356 is missing. Cannot load JSR-356 WebSocket support.");
- return;
- }
-
- Provider<TunnelRequestService> tunnelRequestServiceProvider = getProvider(TunnelRequestService.class);
-
- // Build configuration for WebSocket tunnel
- ServerEndpointConfig config =
- ServerEndpointConfig.Builder.create(BasicGuacamoleWebSocketTunnelEndpoint.class, "/websocket-tunnel")
- .configurator(new BasicGuacamoleWebSocketTunnelEndpoint.Configurator(tunnelRequestServiceProvider))
- .subprotocols(Arrays.asList(new String[]{"guacamole"}))
- .build();
-
- try {
-
- // Add configuration to container
- container.addEndpoint(config);
-
- }
- catch (DeploymentException e) {
- logger.error("Unable to deploy WebSocket tunnel.", e);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/WebSocketTunnelRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/WebSocketTunnelRequest.java b/guacamole/src/main/java/org/apache/guacamole/websocket/WebSocketTunnelRequest.java
deleted file mode 100644
index 5e20dbd..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/WebSocketTunnelRequest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket;
-
-import java.util.List;
-import java.util.Map;
-import javax.websocket.server.HandshakeRequest;
-import org.apache.guacamole.TunnelRequest;
-
-/**
- * WebSocket-specific implementation of TunnelRequest.
- *
- * @author Michael Jumper
- */
-public class WebSocketTunnelRequest extends TunnelRequest {
-
- /**
- * All parameters passed via HTTP to the WebSocket handshake.
- */
- private final Map<String, List<String>> handshakeParameters;
-
- /**
- * Creates a TunnelRequest implementation which delegates parameter and
- * session retrieval to the given HandshakeRequest.
- *
- * @param request The HandshakeRequest to wrap.
- */
- public WebSocketTunnelRequest(HandshakeRequest request) {
- this.handshakeParameters = request.getParameterMap();
- }
-
- @Override
- public String getParameter(String name) {
-
- // Pull list of values, if present
- List<String> values = getParameterValues(name);
- if (values == null || values.isEmpty())
- return null;
-
- // Return first parameter value arbitrarily
- return values.get(0);
-
- }
-
- @Override
- public List<String> getParameterValues(String name) {
- return handshakeParameters.get(name);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/BasicGuacamoleWebSocketTunnelServlet.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/BasicGuacamoleWebSocketTunnelServlet.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/BasicGuacamoleWebSocketTunnelServlet.java
deleted file mode 100644
index f993270..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/BasicGuacamoleWebSocketTunnelServlet.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty8;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.net.GuacamoleTunnel;
-import org.apache.guacamole.TunnelRequestService;
-import org.apache.guacamole.TunnelRequest;
-
-/**
- * Tunnel servlet implementation which uses WebSocket as a tunnel backend,
- * rather than HTTP, properly parsing connection IDs included in the connection
- * request.
- */
-@Singleton
-public class BasicGuacamoleWebSocketTunnelServlet extends GuacamoleWebSocketTunnelServlet {
-
- /**
- * Service for handling tunnel requests.
- */
- @Inject
- private TunnelRequestService tunnelRequestService;
-
- @Override
- protected GuacamoleTunnel doConnect(TunnelRequest request)
- throws GuacamoleException {
- return tunnelRequestService.createTunnel(request);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/GuacamoleWebSocketTunnelServlet.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/GuacamoleWebSocketTunnelServlet.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/GuacamoleWebSocketTunnelServlet.java
deleted file mode 100644
index 832faee..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/GuacamoleWebSocketTunnelServlet.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty8;
-
-import java.io.IOException;
-import javax.servlet.http.HttpServletRequest;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.io.GuacamoleReader;
-import org.apache.guacamole.io.GuacamoleWriter;
-import org.apache.guacamole.net.GuacamoleTunnel;
-import org.eclipse.jetty.websocket.WebSocket;
-import org.eclipse.jetty.websocket.WebSocket.Connection;
-import org.eclipse.jetty.websocket.WebSocketServlet;
-import org.apache.guacamole.GuacamoleClientException;
-import org.apache.guacamole.GuacamoleConnectionClosedException;
-import org.apache.guacamole.HTTPTunnelRequest;
-import org.apache.guacamole.TunnelRequest;
-import org.apache.guacamole.protocol.GuacamoleStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A WebSocketServlet partial re-implementation of GuacamoleTunnelServlet.
- *
- * @author Michael Jumper
- */
-public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
-
- /**
- * Logger for this class.
- */
- private static final Logger logger = LoggerFactory.getLogger(GuacamoleWebSocketTunnelServlet.class);
-
- /**
- * The default, minimum buffer size for instructions.
- */
- private static final int BUFFER_SIZE = 8192;
-
- /**
- * Sends the given status on the given WebSocket connection and closes the
- * connection.
- *
- * @param connection The WebSocket connection to close.
- * @param guac_status The status to send.
- */
- public static void closeConnection(Connection connection,
- GuacamoleStatus guac_status) {
-
- connection.close(guac_status.getWebSocketCode(),
- Integer.toString(guac_status.getGuacamoleStatusCode()));
-
- }
-
- @Override
- public WebSocket doWebSocketConnect(HttpServletRequest request, String protocol) {
-
- final TunnelRequest tunnelRequest = new HTTPTunnelRequest(request);
-
- // Return new WebSocket which communicates through tunnel
- return new WebSocket.OnTextMessage() {
-
- /**
- * The GuacamoleTunnel associated with the connected WebSocket. If
- * the WebSocket has not yet been connected, this will be null.
- */
- private GuacamoleTunnel tunnel = null;
-
- @Override
- public void onMessage(String string) {
-
- // Ignore inbound messages if there is no associated tunnel
- if (tunnel == null)
- return;
-
- GuacamoleWriter writer = tunnel.acquireWriter();
-
- // Write message received
- try {
- writer.write(string.toCharArray());
- }
- catch (GuacamoleConnectionClosedException e) {
- logger.debug("Connection to guacd closed.", e);
- }
- catch (GuacamoleException e) {
- logger.debug("WebSocket tunnel write failed.", e);
- }
-
- tunnel.releaseWriter();
-
- }
-
- @Override
- public void onOpen(final Connection connection) {
-
- try {
- tunnel = doConnect(tunnelRequest);
- }
- catch (GuacamoleException e) {
- logger.error("Creation of WebSocket tunnel to guacd failed: {}", e.getMessage());
- logger.debug("Error connecting WebSocket tunnel.", e);
- closeConnection(connection, e.getStatus());
- return;
- }
-
- // Do not start connection if tunnel does not exist
- if (tunnel == null) {
- closeConnection(connection, GuacamoleStatus.RESOURCE_NOT_FOUND);
- return;
- }
-
- Thread readThread = new Thread() {
-
- @Override
- public void run() {
-
- StringBuilder buffer = new StringBuilder(BUFFER_SIZE);
- GuacamoleReader reader = tunnel.acquireReader();
- char[] readMessage;
-
- try {
-
- try {
-
- // Attempt to read
- while ((readMessage = reader.read()) != null) {
-
- // Buffer message
- buffer.append(readMessage);
-
- // Flush if we expect to wait or buffer is getting full
- if (!reader.available() || buffer.length() >= BUFFER_SIZE) {
- connection.sendMessage(buffer.toString());
- buffer.setLength(0);
- }
-
- }
-
- // No more data
- closeConnection(connection, GuacamoleStatus.SUCCESS);
-
- }
-
- // Catch any thrown guacamole exception and attempt
- // to pass within the WebSocket connection, logging
- // each error appropriately.
- catch (GuacamoleClientException e) {
- logger.info("WebSocket connection terminated: {}", e.getMessage());
- logger.debug("WebSocket connection terminated due to client error.", e);
- closeConnection(connection, e.getStatus());
- }
- catch (GuacamoleConnectionClosedException e) {
- logger.debug("Connection to guacd closed.", e);
- closeConnection(connection, GuacamoleStatus.SUCCESS);
- }
- catch (GuacamoleException e) {
- logger.error("Connection to guacd terminated abnormally: {}", e.getMessage());
- logger.debug("Internal error during connection to guacd.", e);
- closeConnection(connection, e.getStatus());
- }
-
- }
- catch (IOException e) {
- logger.debug("WebSocket tunnel read failed due to I/O error.", e);
- }
-
- }
-
- };
-
- readThread.start();
-
- }
-
- @Override
- public void onClose(int i, String string) {
- try {
- if (tunnel != null)
- tunnel.close();
- }
- catch (GuacamoleException e) {
- logger.debug("Unable to close connection to guacd.", e);
- }
- }
-
- };
-
- }
-
- /**
- * Called whenever the JavaScript Guacamole client makes a connection
- * request. It it up to the implementor of this function to define what
- * conditions must be met for a tunnel to be configured and returned as a
- * result of this connection request (whether some sort of credentials must
- * be specified, for example).
- *
- * @param request
- * The TunnelRequest associated with the connection request received.
- * Any parameters specified along with the connection request can be
- * read from this object.
- *
- * @return
- * A newly constructed GuacamoleTunnel if successful, null otherwise.
- *
- * @throws GuacamoleException
- * If an error occurs while constructing the GuacamoleTunnel, or if the
- * conditions required for connection are not met.
- */
- protected abstract GuacamoleTunnel doConnect(TunnelRequest request)
- throws GuacamoleException;
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/WebSocketTunnelModule.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/WebSocketTunnelModule.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/WebSocketTunnelModule.java
deleted file mode 100644
index 16c17a1..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/WebSocketTunnelModule.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty8;
-
-import com.google.inject.servlet.ServletModule;
-import org.apache.guacamole.TunnelLoader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Loads the Jetty 8 WebSocket tunnel implementation.
- *
- * @author Michael Jumper
- */
-public class WebSocketTunnelModule extends ServletModule implements TunnelLoader {
-
- /**
- * Logger for this class.
- */
- private final Logger logger = LoggerFactory.getLogger(WebSocketTunnelModule.class);
-
- @Override
- public boolean isSupported() {
-
- try {
-
- // Attempt to find WebSocket servlet
- Class.forName("org.apache.guacamole.websocket.jetty8.BasicGuacamoleWebSocketTunnelServlet");
-
- // Support found
- return true;
-
- }
-
- // If no such servlet class, this particular WebSocket support
- // is not present
- catch (ClassNotFoundException e) {}
- catch (NoClassDefFoundError e) {}
-
- // Support not found
- return false;
-
- }
-
- @Override
- public void configureServlets() {
-
- logger.info("Loading Jetty 8 WebSocket support...");
- serve("/websocket-tunnel").with(BasicGuacamoleWebSocketTunnelServlet.class);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/package-info.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/package-info.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/package-info.java
deleted file mode 100644
index 584892e..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty8/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/**
- * Jetty 8 WebSocket tunnel implementation. The classes here require Jetty 8.
- */
-package org.apache.guacamole.websocket.jetty8;
-
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketCreator.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketCreator.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketCreator.java
deleted file mode 100644
index 9528509..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketCreator.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty9;
-
-import org.eclipse.jetty.websocket.api.UpgradeRequest;
-import org.eclipse.jetty.websocket.api.UpgradeResponse;
-import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
-import org.apache.guacamole.TunnelRequestService;
-
-/**
- * WebSocketCreator which selects the appropriate WebSocketListener
- * implementation if the "guacamole" subprotocol is in use.
- *
- * @author Michael Jumper
- */
-public class BasicGuacamoleWebSocketCreator implements WebSocketCreator {
-
- /**
- * Service for handling tunnel requests.
- */
- private final TunnelRequestService tunnelRequestService;
-
- /**
- * Creates a new WebSocketCreator which uses the given TunnelRequestService
- * to create new GuacamoleTunnels for inbound requests.
- *
- * @param tunnelRequestService The service to use for inbound tunnel
- * requests.
- */
- public BasicGuacamoleWebSocketCreator(TunnelRequestService tunnelRequestService) {
- this.tunnelRequestService = tunnelRequestService;
- }
-
- @Override
- public Object createWebSocket(UpgradeRequest request, UpgradeResponse response) {
-
- // Validate and use "guacamole" subprotocol
- for (String subprotocol : request.getSubProtocols()) {
-
- if ("guacamole".equals(subprotocol)) {
- response.setAcceptedSubProtocol(subprotocol);
- return new BasicGuacamoleWebSocketTunnelListener(tunnelRequestService);
- }
-
- }
-
- // Invalid protocol
- return null;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketTunnelListener.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketTunnelListener.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketTunnelListener.java
deleted file mode 100644
index 2c2e91c..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketTunnelListener.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty9;
-
-import org.eclipse.jetty.websocket.api.Session;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.net.GuacamoleTunnel;
-import org.apache.guacamole.TunnelRequestService;
-
-/**
- * WebSocket listener implementation which properly parses connection IDs
- * included in the connection request.
- *
- * @author Michael Jumper
- */
-public class BasicGuacamoleWebSocketTunnelListener extends GuacamoleWebSocketTunnelListener {
-
- /**
- * Service for handling tunnel requests.
- */
- private final TunnelRequestService tunnelRequestService;
-
- /**
- * Creates a new WebSocketListener which uses the given TunnelRequestService
- * to create new GuacamoleTunnels for inbound requests.
- *
- * @param tunnelRequestService The service to use for inbound tunnel
- * requests.
- */
- public BasicGuacamoleWebSocketTunnelListener(TunnelRequestService tunnelRequestService) {
- this.tunnelRequestService = tunnelRequestService;
- }
-
- @Override
- protected GuacamoleTunnel createTunnel(Session session) throws GuacamoleException {
- return tunnelRequestService.createTunnel(new WebSocketTunnelRequest(session.getUpgradeRequest()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketTunnelServlet.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketTunnelServlet.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketTunnelServlet.java
deleted file mode 100644
index f16558d..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/BasicGuacamoleWebSocketTunnelServlet.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty9;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
-import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
-import org.apache.guacamole.TunnelRequestService;
-
-/**
- * A WebSocketServlet partial re-implementation of GuacamoleTunnelServlet.
- *
- * @author Michael Jumper
- */
-@Singleton
-public class BasicGuacamoleWebSocketTunnelServlet extends WebSocketServlet {
-
- /**
- * Service for handling tunnel requests.
- */
- @Inject
- private TunnelRequestService tunnelRequestService;
-
- @Override
- public void configure(WebSocketServletFactory factory) {
-
- // Register WebSocket implementation
- factory.setCreator(new BasicGuacamoleWebSocketCreator(tunnelRequestService));
-
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/GuacamoleWebSocketTunnelListener.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/GuacamoleWebSocketTunnelListener.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/GuacamoleWebSocketTunnelListener.java
deleted file mode 100644
index 368913d..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/GuacamoleWebSocketTunnelListener.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty9;
-
-import java.io.IOException;
-import org.eclipse.jetty.websocket.api.CloseStatus;
-import org.eclipse.jetty.websocket.api.RemoteEndpoint;
-import org.eclipse.jetty.websocket.api.Session;
-import org.eclipse.jetty.websocket.api.WebSocketListener;
-import org.apache.guacamole.GuacamoleClientException;
-import org.apache.guacamole.GuacamoleConnectionClosedException;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.io.GuacamoleReader;
-import org.apache.guacamole.io.GuacamoleWriter;
-import org.apache.guacamole.net.GuacamoleTunnel;
-import org.apache.guacamole.protocol.GuacamoleStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * WebSocket listener implementation which provides a Guacamole tunnel
- *
- * @author Michael Jumper
- */
-public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListener {
-
- /**
- * The default, minimum buffer size for instructions.
- */
- private static final int BUFFER_SIZE = 8192;
-
- /**
- * Logger for this class.
- */
- private static final Logger logger = LoggerFactory.getLogger(BasicGuacamoleWebSocketTunnelServlet.class);
-
- /**
- * The underlying GuacamoleTunnel. WebSocket reads/writes will be handled
- * as reads/writes to this tunnel.
- */
- private GuacamoleTunnel tunnel;
-
- /**
- * Sends the given status on the given WebSocket connection and closes the
- * connection.
- *
- * @param session The outbound WebSocket connection to close.
- * @param guac_status The status to send.
- */
- private void closeConnection(Session session, GuacamoleStatus guac_status) {
-
- try {
- int code = guac_status.getWebSocketCode();
- String message = Integer.toString(guac_status.getGuacamoleStatusCode());
- session.close(new CloseStatus(code, message));
- }
- catch (IOException e) {
- logger.debug("Unable to close WebSocket connection.", e);
- }
-
- }
-
- /**
- * Returns a new tunnel for the given session. How this tunnel is created
- * or retrieved is implementation-dependent.
- *
- * @param session The session associated with the active WebSocket
- * connection.
- * @return A connected tunnel, or null if no such tunnel exists.
- * @throws GuacamoleException If an error occurs while retrieving the
- * tunnel, or if access to the tunnel is denied.
- */
- protected abstract GuacamoleTunnel createTunnel(Session session)
- throws GuacamoleException;
-
- @Override
- public void onWebSocketConnect(final Session session) {
-
- try {
-
- // Get tunnel
- tunnel = createTunnel(session);
- if (tunnel == null) {
- closeConnection(session, GuacamoleStatus.RESOURCE_NOT_FOUND);
- return;
- }
-
- }
- catch (GuacamoleException e) {
- logger.error("Creation of WebSocket tunnel to guacd failed: {}", e.getMessage());
- logger.debug("Error connecting WebSocket tunnel.", e);
- closeConnection(session, e.getStatus());
- return;
- }
-
- // Prepare read transfer thread
- Thread readThread = new Thread() {
-
- /**
- * Remote (client) side of this connection
- */
- private final RemoteEndpoint remote = session.getRemote();
-
- @Override
- public void run() {
-
- StringBuilder buffer = new StringBuilder(BUFFER_SIZE);
- GuacamoleReader reader = tunnel.acquireReader();
- char[] readMessage;
-
- try {
-
- try {
-
- // Attempt to read
- while ((readMessage = reader.read()) != null) {
-
- // Buffer message
- buffer.append(readMessage);
-
- // Flush if we expect to wait or buffer is getting full
- if (!reader.available() || buffer.length() >= BUFFER_SIZE) {
- remote.sendString(buffer.toString());
- buffer.setLength(0);
- }
-
- }
-
- // No more data
- closeConnection(session, GuacamoleStatus.SUCCESS);
-
- }
-
- // Catch any thrown guacamole exception and attempt
- // to pass within the WebSocket connection, logging
- // each error appropriately.
- catch (GuacamoleClientException e) {
- logger.info("WebSocket connection terminated: {}", e.getMessage());
- logger.debug("WebSocket connection terminated due to client error.", e);
- closeConnection(session, e.getStatus());
- }
- catch (GuacamoleConnectionClosedException e) {
- logger.debug("Connection to guacd closed.", e);
- closeConnection(session, GuacamoleStatus.SUCCESS);
- }
- catch (GuacamoleException e) {
- logger.error("Connection to guacd terminated abnormally: {}", e.getMessage());
- logger.debug("Internal error during connection to guacd.", e);
- closeConnection(session, e.getStatus());
- }
-
- }
- catch (IOException e) {
- logger.debug("I/O error prevents further reads.", e);
- }
-
- }
-
- };
-
- readThread.start();
-
- }
-
- @Override
- public void onWebSocketText(String message) {
-
- // Ignore inbound messages if there is no associated tunnel
- if (tunnel == null)
- return;
-
- GuacamoleWriter writer = tunnel.acquireWriter();
-
- try {
- // Write received message
- writer.write(message.toCharArray());
- }
- catch (GuacamoleConnectionClosedException e) {
- logger.debug("Connection to guacd closed.", e);
- }
- catch (GuacamoleException e) {
- logger.debug("WebSocket tunnel write failed.", e);
- }
-
- tunnel.releaseWriter();
-
- }
-
- @Override
- public void onWebSocketBinary(byte[] payload, int offset, int length) {
- throw new UnsupportedOperationException("Binary WebSocket messages are not supported.");
- }
-
- @Override
- public void onWebSocketError(Throwable t) {
-
- logger.debug("WebSocket tunnel closing due to error.", t);
-
- try {
- if (tunnel != null)
- tunnel.close();
- }
- catch (GuacamoleException e) {
- logger.debug("Unable to close connection to guacd.", e);
- }
-
- }
-
-
- @Override
- public void onWebSocketClose(int statusCode, String reason) {
-
- try {
- if (tunnel != null)
- tunnel.close();
- }
- catch (GuacamoleException e) {
- logger.debug("Unable to close connection to guacd.", e);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/WebSocketTunnelModule.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/WebSocketTunnelModule.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/WebSocketTunnelModule.java
deleted file mode 100644
index aa62797..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/WebSocketTunnelModule.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty9;
-
-import com.google.inject.servlet.ServletModule;
-import org.apache.guacamole.TunnelLoader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Loads the Jetty 9 WebSocket tunnel implementation.
- *
- * @author Michael Jumper
- */
-public class WebSocketTunnelModule extends ServletModule implements TunnelLoader {
-
- /**
- * Logger for this class.
- */
- private final Logger logger = LoggerFactory.getLogger(WebSocketTunnelModule.class);
-
- @Override
- public boolean isSupported() {
-
- try {
-
- // Attempt to find WebSocket servlet
- Class.forName("org.apache.guacamole.websocket.jetty9.BasicGuacamoleWebSocketTunnelServlet");
-
- // Support found
- return true;
-
- }
-
- // If no such servlet class, this particular WebSocket support
- // is not present
- catch (ClassNotFoundException e) {}
- catch (NoClassDefFoundError e) {}
-
- // Support not found
- return false;
-
- }
-
- @Override
- public void configureServlets() {
-
- logger.info("Loading Jetty 9 WebSocket support...");
- serve("/websocket-tunnel").with(BasicGuacamoleWebSocketTunnelServlet.class);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/WebSocketTunnelRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/WebSocketTunnelRequest.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/WebSocketTunnelRequest.java
deleted file mode 100644
index 4625be3..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/WebSocketTunnelRequest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.jetty9;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.jetty.websocket.api.UpgradeRequest;
-import org.apache.guacamole.TunnelRequest;
-
-/**
- * Jetty 9 WebSocket-specific implementation of TunnelRequest.
- *
- * @author Michael Jumper
- */
-public class WebSocketTunnelRequest extends TunnelRequest {
-
- /**
- * All parameters passed via HTTP to the WebSocket handshake.
- */
- private final Map<String, String[]> handshakeParameters;
-
- /**
- * Creates a TunnelRequest implementation which delegates parameter and
- * session retrieval to the given UpgradeRequest.
- *
- * @param request The UpgradeRequest to wrap.
- */
- public WebSocketTunnelRequest(UpgradeRequest request) {
- this.handshakeParameters = request.getParameterMap();
- }
-
- @Override
- public String getParameter(String name) {
-
- // Pull list of values, if present
- List<String> values = getParameterValues(name);
- if (values == null || values.isEmpty())
- return null;
-
- // Return first parameter value arbitrarily
- return values.get(0);
-
- }
-
- @Override
- public List<String> getParameterValues(String name) {
-
- String[] values = handshakeParameters.get(name);
- if (values == null)
- return null;
-
- return Arrays.asList(values);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/package-info.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/package-info.java b/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/package-info.java
deleted file mode 100644
index 9b46c78..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/jetty9/package-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/**
- * Jetty 9 WebSocket tunnel implementation. The classes here require at least
- * Jetty 9, prior to Jetty 9.1 (when support for JSR 356 was implemented).
- */
-package org.apache.guacamole.websocket.jetty9;
-
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/package-info.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/package-info.java b/guacamole/src/main/java/org/apache/guacamole/websocket/package-info.java
deleted file mode 100644
index b478bff..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/package-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2014 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/**
- * Standard WebSocket tunnel implementation. The classes here require a recent
- * servlet container that supports JSR 356.
- */
-package org.apache.guacamole.websocket;
-
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/713fc7f8/guacamole/src/main/java/org/apache/guacamole/websocket/tomcat/BasicGuacamoleWebSocketTunnelServlet.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/websocket/tomcat/BasicGuacamoleWebSocketTunnelServlet.java b/guacamole/src/main/java/org/apache/guacamole/websocket/tomcat/BasicGuacamoleWebSocketTunnelServlet.java
deleted file mode 100644
index 73843e8..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/websocket/tomcat/BasicGuacamoleWebSocketTunnelServlet.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.websocket.tomcat;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.net.GuacamoleTunnel;
-import org.apache.guacamole.TunnelRequestService;
-import org.apache.guacamole.TunnelRequest;
-
-/**
- * Tunnel servlet implementation which uses WebSocket as a tunnel backend,
- * rather than HTTP, properly parsing connection IDs included in the connection
- * request.
- */
-@Singleton
-public class BasicGuacamoleWebSocketTunnelServlet extends GuacamoleWebSocketTunnelServlet {
-
- /**
- * Service for handling tunnel requests.
- */
- @Inject
- private TunnelRequestService tunnelRequestService;
-
- @Override
- protected GuacamoleTunnel doConnect(TunnelRequest request)
- throws GuacamoleException {
- return tunnelRequestService.createTunnel(request);
- };
-
-}