mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
Removed legacy message.js and GuacamoleMessage
This commit is contained in:
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
||||
|
@@ -77,7 +77,6 @@
|
||||
<script type="text/javascript" src="javascript/keyboard.js"></script>
|
||||
<script type="text/javascript" src="javascript/mouse.js"></script>
|
||||
<script type="text/javascript" src="javascript/layer.js"></script>
|
||||
<script type="text/javascript" src="javascript/message.js"></script>
|
||||
<script type="text/javascript" src="javascript/guacamole.js"></script>
|
||||
<script type="text/javascript" src="javascript/oskeyboard.js"></script>
|
||||
|
||||
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<errorElements.length; errorIndex++)
|
||||
errors.push(new GuacamoleError(errorElements[errorIndex].textContent));
|
||||
}
|
||||
|
||||
// Parse server element
|
||||
var servers = root.getElementsByTagName("server");
|
||||
if (servers.length == 1)
|
||||
server = new Server(servers[0].attributes['name'].value);
|
||||
|
||||
// Parse framebuffer element
|
||||
var framebuffers = root.getElementsByTagName("framebuffer");
|
||||
if (framebuffers.length == 1) {
|
||||
var width = framebuffers[0].attributes['width'].value;
|
||||
var height = framebuffers[0].attributes['height'].value;
|
||||
framebuffer = new Framebuffer(width, height);
|
||||
}
|
||||
|
||||
// Parse clipboard update elements
|
||||
var clipboards = root.getElementsByTagName("clipboard");
|
||||
if (clipboards.length == 1) {
|
||||
var data = clipboards[0].textContent;
|
||||
updates.push(new ClipboardUpdate(data));
|
||||
}
|
||||
|
||||
// Parse framebuffer update elements
|
||||
var updateElements = root.getElementsByTagName("update");
|
||||
for (var i=0; i<updateElements.length; i++) {
|
||||
|
||||
var update = updateElements[i];
|
||||
var type = update.attributes['type'].value;
|
||||
var x = parseInt(update.attributes['x'].value);
|
||||
var y = parseInt(update.attributes['y'].value);
|
||||
var index = parseInt(update.attributes['index'].value);
|
||||
|
||||
var image_uuid;
|
||||
var url;
|
||||
|
||||
// Image type update
|
||||
if (type == "image") {
|
||||
|
||||
// Use in-band image if given, otherwise use out-of-band
|
||||
if (update.textContent)
|
||||
url = "data:image/png;base64," + update.textContent;
|
||||
else {
|
||||
image_uuid = update.attributes['image'].value;
|
||||
url = "stream.png?image=" + image_uuid;
|
||||
}
|
||||
|
||||
updates.push(new FramebufferUpdate(index, x, y, url));
|
||||
} // end if image update
|
||||
|
||||
// CopyRect
|
||||
else if (type == "copyrect") {
|
||||
|
||||
var srcx = update.attributes['srcx'].value;
|
||||
var srcy = update.attributes['srcy'].value;
|
||||
var width = update.attributes['width'].value;
|
||||
var height = update.attributes['height'].value;
|
||||
|
||||
updates.push(new CopyRectFramebufferUpdate(index, srcx, srcy, width, height, x, y));
|
||||
} // end if copyrect
|
||||
|
||||
// Cursor
|
||||
else if (type == "cursor") {
|
||||
|
||||
// Use in-band image if given, otherwise use out-of-band
|
||||
if (update.textContent)
|
||||
url = "data:image/png;base64," + update.textContent;
|
||||
else {
|
||||
image_uuid = update.attributes['image'].value;
|
||||
url = "stream.png?image=" + image_uuid;
|
||||
}
|
||||
|
||||
updates.push(new CursorFramebufferUpdate(index, x, y, url));
|
||||
}
|
||||
|
||||
} // end for all updates
|
||||
|
||||
} // end if root
|
||||
|
||||
} // end if xml
|
||||
|
||||
}
|
||||
|
||||
function Server(name, width, height) {
|
||||
this.getName = function() { return name; };
|
||||
}
|
||||
|
||||
function Framebuffer(width, height) {
|
||||
|
||||
this.getWidth = function() { return width; };
|
||||
this.getHeight = function() { return height; };
|
||||
|
||||
}
|
||||
|
||||
function GuacamoleError(message) {
|
||||
this.getMessage = function() { return message; };
|
||||
}
|
||||
|
||||
function ClipboardUpdate(data) {
|
||||
this.getData = function() { return data; };
|
||||
}
|
||||
|
||||
function FramebufferUpdate(index, x, y, url) {
|
||||
|
||||
this.getIndex = function() { return index; };
|
||||
this.getX = function() { return x; };
|
||||
this.getY = function() { return y; };
|
||||
this.getURL = function() { return url; };
|
||||
|
||||
}
|
||||
|
||||
function CursorFramebufferUpdate(index, hotspotX, hotspotY, url) {
|
||||
|
||||
this.getIndex = function() { return index; };
|
||||
this.getHotspotX = function() { return hotspotX; };
|
||||
this.getHotspotY = function() { return hotspotY; };
|
||||
this.getURL = function() { return url; };
|
||||
|
||||
}
|
||||
|
||||
function CopyRectFramebufferUpdate(index, srcx, srcy, width, height, dstx, dsty) {
|
||||
|
||||
this.getIndex = function() { return index; };
|
||||
this.getSrcX = function() { return srcx; };
|
||||
this.getSrcY = function() { return srcy; };
|
||||
this.getWidth = function() { return width; };
|
||||
this.getHeight = function() { return height; };
|
||||
this.getDstX = function() { return dstx; };
|
||||
this.getDstY = function() { return dsty; };
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user