diff --git a/guacamole/web/COPYING b/guacamole/COPYING
similarity index 100%
rename from guacamole/web/COPYING
rename to guacamole/COPYING
diff --git a/guacamole/web/doc/example/guacamole.properties b/guacamole/doc/example/guacamole.properties
similarity index 100%
rename from guacamole/web/doc/example/guacamole.properties
rename to guacamole/doc/example/guacamole.properties
diff --git a/guacamole/web/doc/example/user-mapping.xml b/guacamole/doc/example/user-mapping.xml
similarity index 100%
rename from guacamole/web/doc/example/user-mapping.xml
rename to guacamole/doc/example/user-mapping.xml
diff --git a/guacamole/graphics/LICENSE.txt b/guacamole/graphics/LICENSE.txt
deleted file mode 100644
index 7392e79ea..000000000
--- a/guacamole/graphics/LICENSE.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-The Guacamole Logo
-Copyright (C) 2010 Michael Jumper
-
-Licensed under the Creative Commons Attribution-ShareAlike license.
-
-The full text of the license is available here:
-
- http://creativecommons.org/licenses/by-sa/3.0/
-
diff --git a/guacamole/graphics/guacamole-logo.svg b/guacamole/graphics/guacamole-logo.svg
deleted file mode 100644
index 3934e647d..000000000
--- a/guacamole/graphics/guacamole-logo.svg
+++ /dev/null
@@ -1,2996 +0,0 @@
-
-
-
-
-
-
diff --git a/guacamole/web/guacamole-default-webapp/pom.xml b/guacamole/pom.xml
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/pom.xml
rename to guacamole/pom.xml
diff --git a/guacamole/web/guacamole-default-webapp/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicFileAuthenticationProvider.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicFileAuthenticationProvider.java
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicFileAuthenticationProvider.java
rename to guacamole/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicFileAuthenticationProvider.java
diff --git a/guacamole/web/guacamole-default-webapp/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicGuacamoleSessionProvider.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicGuacamoleSessionProvider.java
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicGuacamoleSessionProvider.java
rename to guacamole/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicGuacamoleSessionProvider.java
diff --git a/guacamole/web/guacamole-default-webapp/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicLogin.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicLogin.java
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicLogin.java
rename to guacamole/src/main/java/net/sourceforge/guacamole/net/authentication/basic/BasicLogin.java
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/META-INF/context.xml b/guacamole/src/main/webapp/META-INF/context.xml
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/META-INF/context.xml
rename to guacamole/src/main/webapp/META-INF/context.xml
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/WEB-INF/web.xml b/guacamole/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/WEB-INF/web.xml
rename to guacamole/src/main/webapp/WEB-INF/web.xml
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/agpl-3.0-standalone.html b/guacamole/src/main/webapp/agpl-3.0-standalone.html
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/agpl-3.0-standalone.html
rename to guacamole/src/main/webapp/agpl-3.0-standalone.html
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/css/guacamole.css b/guacamole/src/main/webapp/guac-web-lib/css/guacamole.css
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/css/guacamole.css
rename to guacamole/src/main/webapp/guac-web-lib/css/guacamole.css
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/mouse/blank.cur b/guacamole/src/main/webapp/guac-web-lib/images/mouse/blank.cur
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/mouse/blank.cur
rename to guacamole/src/main/webapp/guac-web-lib/images/mouse/blank.cur
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/mouse/blank.gif b/guacamole/src/main/webapp/guac-web-lib/images/mouse/blank.gif
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/mouse/blank.gif
rename to guacamole/src/main/webapp/guac-web-lib/images/mouse/blank.gif
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/mouse/dot.gif b/guacamole/src/main/webapp/guac-web-lib/images/mouse/dot.gif
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/mouse/dot.gif
rename to guacamole/src/main/webapp/guac-web-lib/images/mouse/dot.gif
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/noimage92.png b/guacamole/src/main/webapp/guac-web-lib/images/noimage92.png
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/noimage92.png
rename to guacamole/src/main/webapp/guac-web-lib/images/noimage92.png
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/spinner92.gif b/guacamole/src/main/webapp/guac-web-lib/images/spinner92.gif
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/images/spinner92.gif
rename to guacamole/src/main/webapp/guac-web-lib/images/spinner92.gif
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/guacamole.js b/guacamole/src/main/webapp/guac-web-lib/javascript/guacamole.js
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/guacamole.js
rename to guacamole/src/main/webapp/guac-web-lib/javascript/guacamole.js
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/keyboard.js b/guacamole/src/main/webapp/guac-web-lib/javascript/keyboard.js
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/keyboard.js
rename to guacamole/src/main/webapp/guac-web-lib/javascript/keyboard.js
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/keymap.js b/guacamole/src/main/webapp/guac-web-lib/javascript/keymap.js
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/keymap.js
rename to guacamole/src/main/webapp/guac-web-lib/javascript/keymap.js
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/layer.js b/guacamole/src/main/webapp/guac-web-lib/javascript/layer.js
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/layer.js
rename to guacamole/src/main/webapp/guac-web-lib/javascript/layer.js
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/mouse.js b/guacamole/src/main/webapp/guac-web-lib/javascript/mouse.js
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/mouse.js
rename to guacamole/src/main/webapp/guac-web-lib/javascript/mouse.js
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/oskeyboard.js b/guacamole/src/main/webapp/guac-web-lib/javascript/oskeyboard.js
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guac-web-lib/javascript/oskeyboard.js
rename to guacamole/src/main/webapp/guac-web-lib/javascript/oskeyboard.js
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/guacamole.css b/guacamole/src/main/webapp/guacamole.css
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/guacamole.css
rename to guacamole/src/main/webapp/guacamole.css
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/images/agpl-logo.png b/guacamole/src/main/webapp/images/agpl-logo.png
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/images/agpl-logo.png
rename to guacamole/src/main/webapp/images/agpl-logo.png
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/images/checker.png b/guacamole/src/main/webapp/images/checker.png
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/images/checker.png
rename to guacamole/src/main/webapp/images/checker.png
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/images/guacamole-64-icon.png b/guacamole/src/main/webapp/images/guacamole-64-icon.png
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/images/guacamole-64-icon.png
rename to guacamole/src/main/webapp/images/guacamole-64-icon.png
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/images/guacamole-icon-64.png b/guacamole/src/main/webapp/images/guacamole-icon-64.png
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/images/guacamole-icon-64.png
rename to guacamole/src/main/webapp/images/guacamole-icon-64.png
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/images/guacamole-logo.png b/guacamole/src/main/webapp/images/guacamole-logo.png
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/images/guacamole-logo.png
rename to guacamole/src/main/webapp/images/guacamole-logo.png
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/images/login-logo.png b/guacamole/src/main/webapp/images/login-logo.png
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/images/login-logo.png
rename to guacamole/src/main/webapp/images/login-logo.png
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/images/noguacamole-logo.png b/guacamole/src/main/webapp/images/noguacamole-logo.png
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/images/noguacamole-logo.png
rename to guacamole/src/main/webapp/images/noguacamole-logo.png
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/index.html b/guacamole/src/main/webapp/index.html
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/index.html
rename to guacamole/src/main/webapp/index.html
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/keyboard.css b/guacamole/src/main/webapp/keyboard.css
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/keyboard.css
rename to guacamole/src/main/webapp/keyboard.css
diff --git a/guacamole/web/guacamole-default-webapp/src/main/webapp/layouts/en-us-qwerty.xml b/guacamole/src/main/webapp/layouts/en-us-qwerty.xml
similarity index 100%
rename from guacamole/web/guacamole-default-webapp/src/main/webapp/layouts/en-us-qwerty.xml
rename to guacamole/src/main/webapp/layouts/en-us-qwerty.xml
diff --git a/guacamole/web/.gitignore b/guacamole/web/.gitignore
deleted file mode 100644
index 92ffcee35..000000000
--- a/guacamole/web/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Build directories
-target/
diff --git a/guacamole/web/guacamole-common/pom.xml b/guacamole/web/guacamole-common/pom.xml
deleted file mode 100644
index 70ee49b8c..000000000
--- a/guacamole/web/guacamole-common/pom.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
- 4.0.0
- net.sourceforge.guacamole
- guacamole-common
- jar
- 0.3.0rc1
- guacamole-common
- http://guacamole.sourceforge.net/
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.6
- 1.6
-
-
-
-
-
-
-
- org.apache.maven.wagon
- wagon-ssh-external
-
-
-
-
-
-
-
- javax.servlet
- servlet-api
- 2.5
- provided
-
-
-
-
-
- guac-dev
- http://guac-dev.org/repo
-
-
-
-
-
- guac-dev
- scpexe://guac-dev.org/var/www/repo
-
-
-
-
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/Client.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/Client.java
deleted file mode 100644
index e57d479a0..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/Client.java
+++ /dev/null
@@ -1,30 +0,0 @@
-
-package net.sourceforge.guacamole;
-
-/*
- * 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;
-
-public abstract class Client {
-
- public abstract void write(char[] chunk, int off, int len) throws GuacamoleException;
- public abstract char[] read() throws GuacamoleException;
- public abstract void disconnect() throws GuacamoleException;
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/GuacamoleClient.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/GuacamoleClient.java
deleted file mode 100644
index f0748d8df..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/GuacamoleClient.java
+++ /dev/null
@@ -1,129 +0,0 @@
-
-package net.sourceforge.guacamole;
-
-/*
- * 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 java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.InputStreamReader;
-
-import java.io.OutputStream;
-import java.io.Writer;
-import java.io.OutputStreamWriter;
-
-import net.sourceforge.guacamole.GuacamoleException;
-
-public class GuacamoleClient extends Client {
-
- private Socket sock;
- private Reader input;
- private Writer output;
-
- public GuacamoleClient(String hostname, int port) throws GuacamoleException {
-
- try {
- sock = new Socket(InetAddress.getByName(hostname), port);
- input = new InputStreamReader(sock.getInputStream());
- output = new OutputStreamWriter(sock.getOutputStream());
- }
- catch (IOException e) {
- throw new GuacamoleException(e);
- }
-
- }
-
- public void write(char[] chunk, int off, int len) throws GuacamoleException {
- try {
- output.write(chunk, off, len);
- output.flush();
- }
- catch (IOException e) {
- throw new GuacamoleException(e);
- }
- }
-
- public void disconnect() throws GuacamoleException {
- try {
- sock.close();
- }
- catch (IOException e) {
- throw new GuacamoleException(e);
- }
- }
-
- private int usedLength = 0;
- private char[] buffer = new char[20000];
-
- public char[] read() throws GuacamoleException {
-
- try {
-
- // While we're blocking, or input is available
- for (;;) {
-
- // If past threshold, resize buffer before reading
- if (usedLength > buffer.length/2) {
- char[] biggerBuffer = new char[buffer.length*2];
- System.arraycopy(buffer, 0, biggerBuffer, 0, usedLength);
- buffer = biggerBuffer;
- }
-
- // Attempt to fill buffer
- int numRead = input.read(buffer, usedLength, buffer.length - usedLength);
- if (numRead == -1)
- return null;
-
- int prevLength = usedLength;
- usedLength += numRead;
-
- for (int i=usedLength-1; i>=prevLength; i--) {
-
- char readChar = buffer[i];
-
- // If end of instruction, return it.
- if (readChar == ';') {
-
- // Get instruction
- char[] chunk = new char[i+1];
- System.arraycopy(buffer, 0, chunk, 0, i+1);
-
- // Reset buffer
- usedLength -= i+1;
- System.arraycopy(buffer, i+1, buffer, 0, usedLength);
-
- // Return instruction string
- return chunk;
- }
-
- }
-
- } // End read loop
-
- }
- catch (IOException e) {
- throw new GuacamoleException(e);
- }
-
- }
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/GuacamoleException.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/GuacamoleException.java
deleted file mode 100644
index 3a09c5ac7..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/GuacamoleException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-
-package net.sourceforge.guacamole;
-
-/*
- * 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 .
- */
-
-public class GuacamoleException extends Exception {
-
- public GuacamoleException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public GuacamoleException(String message) {
- super(message);
- }
-
- public GuacamoleException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/Configuration.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/Configuration.java
deleted file mode 100644
index 6e78eb296..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/Configuration.java
+++ /dev/null
@@ -1,129 +0,0 @@
-
-package net.sourceforge.guacamole.net;
-
-/*
- * 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 javax.servlet.ServletContext;
-import net.sourceforge.guacamole.GuacamoleException;
-
-public abstract class Configuration {
-
- protected String humanReadableList(Object... values) {
-
- String list = "";
- for (int i=0; i= 1)
- list += ", ";
-
- if (i == values.length -1)
- list += " or ";
-
- list += "\"" + values[i] + "\"";
- }
-
- return list;
-
- }
-
- protected String readParameter(String name) throws GuacamoleException {
- String value = GuacamoleProperties.getProperty(name);
- return value;
- }
-
- protected String readParameter(String name, String defaultValue, String... allowedValues) throws GuacamoleException {
-
- String value = GuacamoleProperties.getProperty(name);
-
- // Use default if not specified
- if (value == null) {
- if (defaultValue == null)
- throw new GuacamoleException("Parameter \"" + name + "\" is required.");
-
- return defaultValue;
- }
-
- // If not restricted to certain values, just return whatever is given.
- if (allowedValues.length == 0)
- return value;
-
- // If restricted, only return value within given list
- for (String allowedValue : allowedValues)
- if (value.equals(allowedValue))
- return value;
-
- throw new GuacamoleException("Parameter \"" + name + "\" must be " + humanReadableList((Object) allowedValues));
- }
-
- protected boolean readBooleanParameter(String name, Boolean defaultValue) throws GuacamoleException {
-
- String value = GuacamoleProperties.getProperty(name);
-
- // Use default if not specified
- if (value == null) {
- if (defaultValue == null)
- throw new GuacamoleException("Parameter \"" + name + "\" is required.");
-
- return defaultValue;
- }
-
- value = value.trim();
- if (value.equals("true"))
- return true;
-
- if (value.equals("false"))
- return false;
-
- throw new GuacamoleException("Parameter \"" + name + "\" must be \"true\" or \"false\".");
-
- }
-
- protected int readIntParameter(String name, Integer defaultValue, Integer... allowedValues) throws GuacamoleException {
-
- String parmString = GuacamoleProperties.getProperty(name);
-
- // Use default if not specified
- if (parmString== null) {
- if (defaultValue == null)
- throw new GuacamoleException("Parameter \"" + name + "\" is required.");
-
- return defaultValue;
- }
-
- try {
- int value = Integer.parseInt(parmString);
-
- // If not restricted to certain values, just return whatever is given.
- if (allowedValues.length == 0)
- return value;
-
- // If restricted, only return value within given list
- for (int allowedValue : allowedValues)
- if (value == allowedValue)
- return value;
-
- throw new GuacamoleException("Parameter \"" + name + "\" must be " + humanReadableList((Object) allowedValues));
- }
- catch (NumberFormatException e) {
- throw new GuacamoleException("Parameter \"" + name + "\" must be an integer.", e);
- }
-
- }
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleConfiguration.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleConfiguration.java
deleted file mode 100644
index a6bfeeb52..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-
-package net.sourceforge.guacamole.net;
-
-/*
- * 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.net.authentication.GuacamoleSessionProvider;
-import java.lang.reflect.InvocationTargetException;
-import javax.servlet.http.HttpSession;
-import net.sourceforge.guacamole.GuacamoleException;
-
-public class GuacamoleConfiguration extends Configuration {
-
- private String guacd_hostname;
- private int guacd_port;
- private GuacamoleSessionProvider sessionProvider;
-
- public GuacamoleConfiguration() throws GuacamoleException {
-
- guacd_hostname = readParameter("guacd-hostname");
- guacd_port = readIntParameter("guacd-port", null);
-
- // Get session provider instance
- try {
- String sessionProviderClassName = readParameter("session-provider");
- Object obj = Class.forName(sessionProviderClassName).getConstructor().newInstance();
- if (!(obj instanceof GuacamoleSessionProvider))
- throw new GuacamoleException("Specified session provider class is not a GuacamoleSessionProvider");
-
- sessionProvider = (GuacamoleSessionProvider) obj;
- }
- catch (ClassNotFoundException e) {
- throw new GuacamoleException("Session provider class not found", e);
- }
- catch (NoSuchMethodException e) {
- throw new GuacamoleException("Default constructor for session provider not present", e);
- }
- catch (SecurityException e) {
- throw new GuacamoleException("Creation of session provider disallowed; check your security settings", e);
- }
- catch (InstantiationException e) {
- throw new GuacamoleException("Unable to instantiate session provider", e);
- }
- catch (IllegalAccessException e) {
- throw new GuacamoleException("Unable to access default constructor of session provider", e);
- }
- catch (InvocationTargetException e) {
- throw new GuacamoleException("Internal error in constructor of session provider", e.getTargetException());
- }
-
- }
-
- public int getProxyPort() {
- return guacd_port;
- }
-
- public String getProxyHostname() {
- return guacd_hostname;
- }
-
- public GuacamoleSession createSession(HttpSession session) throws GuacamoleException {
- return sessionProvider.createSession(session);
- }
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleProperties.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleProperties.java
deleted file mode 100644
index 6c4340dd1..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleProperties.java
+++ /dev/null
@@ -1,55 +0,0 @@
-
-package net.sourceforge.guacamole.net;
-
-/*
- * 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 java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import net.sourceforge.guacamole.GuacamoleException;
-
-public class GuacamoleProperties {
-
- private static final Properties properties;
- private static GuacamoleException exception;
-
- static {
-
- properties = new Properties();
-
- try {
-
- InputStream stream = GuacamoleProperties.class.getResourceAsStream("/guacamole.properties");
- if (stream == null)
- throw new IOException("Resource /guacamole.properties not found.");
-
- properties.load(stream);
- }
- catch (IOException e) {
- exception = new GuacamoleException("Error reading guacamole.properties", e);
- }
-
- }
-
- public static String getProperty(String name) throws GuacamoleException {
- if (exception != null) throw exception;
- return properties.getProperty(name);
- }
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleServlet.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleServlet.java
deleted file mode 100644
index a1e713132..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleServlet.java
+++ /dev/null
@@ -1,83 +0,0 @@
-
-package net.sourceforge.guacamole.net;
-
-/*
- * 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 java.io.IOException;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import net.sourceforge.guacamole.GuacamoleException;
-
-public abstract class GuacamoleServlet extends HttpServlet {
-
- private GuacamoleConfiguration config;
-
- @Override
- public void init() throws ServletException {
- try {
- this.config = new GuacamoleConfiguration();
- }
- catch (GuacamoleException e) {
- throw new ServletException(e);
- }
- }
-
- @Override
- protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- try {
- handleRequest(req, resp);
- }
- catch (GuacamoleException e) {
- throw new ServletException(e);
- }
- }
-
- @Override
- protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- try {
- handleRequest(req, resp);
- }
- catch (GuacamoleException e) {
- throw new ServletException(e);
- }
- }
-
- private final void handleRequest(HttpServletRequest request, HttpServletResponse response) throws GuacamoleException {
-
- HttpSession httpSession = request.getSession(shouldCreateSession());
-
- if (httpSession != null) {
- GuacamoleSession session = config.createSession(httpSession);
- handleRequest(session, request, response);
- }
- else
- throw new GuacamoleException("No session");
- }
-
- protected abstract void handleRequest(GuacamoleSession session, HttpServletRequest request, HttpServletResponse response) throws GuacamoleException;
-
- protected boolean shouldCreateSession() {
- return false;
- }
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleSession.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleSession.java
deleted file mode 100644
index 2eb01326b..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/GuacamoleSession.java
+++ /dev/null
@@ -1,209 +0,0 @@
-
-package net.sourceforge.guacamole.net;
-
-/*
- * 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 java.util.concurrent.locks.ReentrantLock;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionBindingEvent;
-import javax.servlet.http.HttpSessionBindingListener;
-import net.sourceforge.guacamole.Client;
-import net.sourceforge.guacamole.GuacamoleClient;
-import net.sourceforge.guacamole.GuacamoleException;
-
-public class GuacamoleSession {
-
- private GuacamoleConfiguration config;
- private final HttpSession session;
- private SessionClient client;
- private ReentrantLock instructionStreamLock;
-
- private String protocol;
- private String hostname;
- private int port;
- private String password;
-
- public class SessionClient extends Client implements HttpSessionBindingListener {
-
- private Client client;
- private ReentrantLock authorizedLock;
-
- public SessionClient(Client client) {
- this.client = client;
-
- authorizedLock = new ReentrantLock();
- authorizedLock.lock();
- }
-
- public void authorize() {
- authorizedLock.unlock();
- }
-
- public void waitForAuthorization() {
- if (authorizedLock.isLocked()) {
- try {
- authorizedLock.lock();
- authorizedLock.unlock();
- }
- catch (Throwable t) {
- throw new Error("Internal error waiting for authorization", t);
- }
- }
- }
-
- public void valueBound(HttpSessionBindingEvent event) {
- // Do nothing
- }
-
- public void valueUnbound(HttpSessionBindingEvent event) {
- try {
- disconnect();
- }
- catch (GuacamoleException e) {
- // Ignore
- }
- }
-
- public void write(char[] data, int off, int len) throws GuacamoleException {
- client.write(data, off, len);
- }
-
- public char[] read() throws GuacamoleException {
- return client.read();
- }
-
- public void disconnect() throws GuacamoleException {
- client.disconnect();
- }
-
- }
-
- public GuacamoleSession(HttpSession session) throws GuacamoleException {
-
- if (session == null)
- throw new GuacamoleException("User has no session.");
-
- this.session = session;
- synchronized (session) {
-
- // Read configuration parameters
- config = new GuacamoleConfiguration();
-
- client = (SessionClient) session.getAttribute("CLIENT");
- instructionStreamLock = (ReentrantLock) session.getAttribute("INSTRUCTION_STREAM_LOCK");
- }
- }
-
- public void connect() throws GuacamoleException {
- synchronized (session) {
-
- if (client != null)
- client.disconnect();
-
-
- client = new SessionClient(
- new GuacamoleClient (
- config.getProxyHostname(),
- config.getProxyPort()
- )
- );
-
- session.setAttribute("CLIENT", client);
-
- instructionStreamLock = new ReentrantLock();
- session.setAttribute("INSTRUCTION_STREAM_LOCK", instructionStreamLock);
-
- }
- }
-
- public boolean isConnected() {
- synchronized (session) {
- return client != null;
- }
- }
-
- public GuacamoleConfiguration getConfiguration() {
- return config;
- }
-
- public SessionClient getClient() {
- synchronized (session) {
- return client;
- }
- }
-
- public void invalidate() {
- session.invalidate();
- }
-
- public void disconnect() throws GuacamoleException {
- if (client != null) {
- client.disconnect();
-
- session.removeAttribute("CLIENT");
- client = null;
- }
- }
-
- public ReentrantLock getInstructionStreamLock() {
- return instructionStreamLock;
- }
-
- public void setConnection(String protocol, String hostname, int port) {
- this.protocol = protocol;
- this.hostname = hostname;
- this.port = port;
- }
-
- public String getProtocol() {
- return protocol;
- }
-
- public String getHostname() {
- return hostname;
- }
-
- public int getPort() {
- return port;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getConnectMessage() throws GuacamoleException {
-
- if (getProtocol() == null)
- throw new GuacamoleException("Protocol not specified");
-
- if (getHostname() == null)
- throw new GuacamoleException("Hostname not specified");
-
- if (getPassword() == null)
- return "connect:" + getProtocol() + "," + getHostname() + "," + getPort() + ";";
- else
- return "connect:" + getProtocol() + "," + getHostname() + "," + getPort() + "," + getPassword() + ";";
- }
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/authentication/GuacamoleSessionProvider.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/authentication/GuacamoleSessionProvider.java
deleted file mode 100644
index bbe82a2de..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/authentication/GuacamoleSessionProvider.java
+++ /dev/null
@@ -1,30 +0,0 @@
-
-package net.sourceforge.guacamole.net.authentication;
-
-import javax.servlet.http.HttpSession;
-import net.sourceforge.guacamole.GuacamoleException;
-import net.sourceforge.guacamole.net.GuacamoleSession;
-
-/*
- * 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 .
- */
-
-public interface GuacamoleSessionProvider {
-
- public GuacamoleSession createSession(HttpSession session) throws GuacamoleException;
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/authentication/NullGuacamoleSessionProvider.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/authentication/NullGuacamoleSessionProvider.java
deleted file mode 100644
index a46d0fe57..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/authentication/NullGuacamoleSessionProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-
-package net.sourceforge.guacamole.net.authentication;
-
-import javax.servlet.http.HttpSession;
-import net.sourceforge.guacamole.GuacamoleException;
-import net.sourceforge.guacamole.net.GuacamoleSession;
-
-/*
- * 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 .
- */
-
-public class NullGuacamoleSessionProvider implements GuacamoleSessionProvider {
-
- public GuacamoleSession createSession(HttpSession session) throws GuacamoleException {
- throw new GuacamoleException("Null provider will not create sessions");
- }
-
-}
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Connect.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Connect.java
deleted file mode 100644
index 79aa94d40..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Connect.java
+++ /dev/null
@@ -1,59 +0,0 @@
-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 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 {
-
- @Override
- 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 = session.getConnectMessage().toCharArray();
- session.getClient().write(connect, 0, connect.length);
- session.getClient().authorize();
- }
- catch (GuacamoleException e) {
- throw new GuacamoleException("Error sending data to server: " + e.getMessage(), e);
- }
-
- }
-
-}
-
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Inbound.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Inbound.java
deleted file mode 100644
index 415d639bf..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Inbound.java
+++ /dev/null
@@ -1,59 +0,0 @@
-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 Inbound extends GuacamoleServlet {
-
- @Override
- protected void handleRequest(GuacamoleSession session, HttpServletRequest request, HttpServletResponse response) throws GuacamoleException {
-
- session.getClient().waitForAuthorization();
-
- // Send data
- try {
-
- Reader input = request.getReader();
- char[] buffer = new char[8192];
-
- int length;
- while ((length = input.read(buffer, 0, buffer.length)) != -1)
- session.getClient().write(buffer, 0, length);
-
- }
- catch (IOException e) {
- throw new GuacamoleException("I/O Error sending data to server: " + e.getMessage(), e);
- }
- catch (GuacamoleException e) {
- throw new GuacamoleException("Error sending data to server: " + e.getMessage(), e);
- }
-
- }
-
-}
-
diff --git a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Outbound.java b/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Outbound.java
deleted file mode 100644
index 76aa34c76..000000000
--- a/guacamole/web/guacamole-common/src/main/java/net/sourceforge/guacamole/net/tunnel/Outbound.java
+++ /dev/null
@@ -1,99 +0,0 @@
-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 java.io.Writer;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.concurrent.locks.ReentrantLock;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import net.sourceforge.guacamole.Client;
-import net.sourceforge.guacamole.net.GuacamoleServlet;
-import net.sourceforge.guacamole.GuacamoleException;
-import net.sourceforge.guacamole.net.GuacamoleSession;
-
-
-public class Outbound extends GuacamoleServlet {
-
- @Override
- protected void handleRequest(GuacamoleSession session, HttpServletRequest request, HttpServletResponse response) throws GuacamoleException {
-
- session.getClient().waitForAuthorization();
-
- ReentrantLock instructionStreamLock = session.getInstructionStreamLock();
- instructionStreamLock.lock();
-
- try {
-
- response.setContentType("text/plain");
- Writer out = response.getWriter();
-
- try {
-
- // Query new update from server
- Client client = session.getClient();
-
- // For all messages, until another stream is ready (we send at least one message)
- char[] message;
- while ((message = client.read()) != null) {
-
- // Get message output bytes
- out.write(message, 0, message.length);
- out.flush();
- response.flushBuffer();
-
- // No more messages another stream can take over
- if (instructionStreamLock.hasQueuedThreads())
- break;
-
- }
-
- if (message == null) {
- session.disconnect();
- throw new GuacamoleException("Disconnected.");
- }
-
- }
- catch (GuacamoleException e) {
- out.write("error:" + e.getMessage() + ";");
- out.flush();
- response.flushBuffer();
- }
-
- // End-of-instructions marker
- out.write(';');
- out.flush();
- response.flushBuffer();
-
- }
- catch (UnsupportedEncodingException e) {
- throw new GuacamoleException("UTF-8 not supported by Java.", e);
- }
- catch (IOException e) {
- throw new GuacamoleException("I/O error writing to servlet output stream.", e);
- }
- finally {
- instructionStreamLock.unlock();
- }
-
- }
-
-}
-