From efe1b57f0cb271c2c637426cd75dbf3866e84fa1 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 26 Nov 2010 17:02:28 -0800 Subject: [PATCH] Removed legacy message.js and GuacamoleMessage --- .../guacamole/net/tunnel/Connect.java | 59 ++++++ .../guacamole/net/tunnel/Inbound.java | 7 - guacamole/web-client/web/index.html | 1 - .../web-client/web/javascript/message.js | 175 ------------------ 4 files changed, 59 insertions(+), 183 deletions(-) create mode 100644 guacamole/web-client/src/net/sourceforge/guacamole/net/tunnel/Connect.java delete mode 100644 guacamole/web-client/web/javascript/message.js diff --git a/guacamole/web-client/src/net/sourceforge/guacamole/net/tunnel/Connect.java b/guacamole/web-client/src/net/sourceforge/guacamole/net/tunnel/Connect.java new file mode 100644 index 000000000..010661894 --- /dev/null +++ b/guacamole/web-client/src/net/sourceforge/guacamole/net/tunnel/Connect.java @@ -0,0 +1,59 @@ +package net.sourceforge.guacamole.net.tunnel; + +/* + * Guacamole - Clientless Remote Desktop + * Copyright (C) 2010 Michael Jumper + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import net.sourceforge.guacamole.GuacamoleException; + +import java.io.Reader; +import java.io.IOException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import net.sourceforge.guacamole.net.GuacamoleServlet; + +import net.sourceforge.guacamole.net.GuacamoleSession; + +public class Connect extends GuacamoleServlet { + + protected boolean shouldCreateSession() { + return true; + } + + @Override + protected void handleRequest(GuacamoleSession session, HttpServletRequest request, HttpServletResponse response) throws GuacamoleException { + + // Disconnect if already connected + if (session.isConnected()) + session.disconnect(); + + // Obtain new connection + session.connect(); + + // Send data + try { + char[] connect = "connect:vnc,localhost,5901,potato;".toCharArray(); + session.getClient().write(connect, 0, connect.length); + } + catch (GuacamoleException e) { + throw new GuacamoleException("Error sending data to server: " + e.getMessage(), e); + } + + } + +} + diff --git a/guacamole/web-client/src/net/sourceforge/guacamole/net/tunnel/Inbound.java b/guacamole/web-client/src/net/sourceforge/guacamole/net/tunnel/Inbound.java index 7fdca3001..1398bb9aa 100644 --- a/guacamole/web-client/src/net/sourceforge/guacamole/net/tunnel/Inbound.java +++ b/guacamole/web-client/src/net/sourceforge/guacamole/net/tunnel/Inbound.java @@ -30,16 +30,9 @@ import net.sourceforge.guacamole.net.GuacamoleSession; public class Inbound extends GuacamoleServlet { - protected boolean shouldCreateSession() { - return true; - } - @Override protected void handleRequest(GuacamoleSession session, HttpServletRequest request, HttpServletResponse response) throws GuacamoleException { - if (!session.isConnected()) - session.connect(); - // Send data try { diff --git a/guacamole/web-client/web/index.html b/guacamole/web-client/web/index.html index 8530d5734..1efe8344f 100644 --- a/guacamole/web-client/web/index.html +++ b/guacamole/web-client/web/index.html @@ -77,7 +77,6 @@ - diff --git a/guacamole/web-client/web/javascript/message.js b/guacamole/web-client/web/javascript/message.js deleted file mode 100644 index bafbb447d..000000000 --- a/guacamole/web-client/web/javascript/message.js +++ /dev/null @@ -1,175 +0,0 @@ - -/* - * Guacamole - Clientless Remote Desktop - * Copyright (C) 2010 Michael Jumper - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -function GuacamoleMessage(xml) { - - var server = null; - var framebuffer = null; - var errors = new Array(); - var updates = new Array(); - - - this.getServer = function() { return server; }; - this.getFramebuffer = function() { return framebuffer; }; - this.getErrors = function() { return errors; }; - this.hasErrors = function() { return errors.length > 0; }; - this.getUpdates = function() { return updates; }; - - if (xml) { - - // Parse document - var root = xml.documentElement; - if (root) { - - // Parse errors - var errorElements = root.getElementsByTagName("error"); - if (errorElements.length >= 1) { - for (var errorIndex=0; errorIndex