mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Added example from guacamole-example
This commit is contained in:
@@ -631,7 +631,7 @@ EXCLUDE_SYMBOLS =
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATH = example
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
@@ -645,7 +645,7 @@ EXAMPLE_PATTERNS =
|
||||
# commands irrespective of the value of the RECURSIVE tag.
|
||||
# Possible values are YES and NO. If left blank NO is used.
|
||||
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
|
||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain image that are included in the documentation (see
|
||||
|
@@ -0,0 +1,65 @@
|
||||
|
||||
package net.sourceforge.guacamole.net.example;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import net.sourceforge.guacamole.GuacamoleException;
|
||||
import net.sourceforge.guacamole.properties.GuacamoleProperties;
|
||||
import net.sourceforge.guacamole.net.GuacamoleSocket;
|
||||
import net.sourceforge.guacamole.net.GuacamoleTunnel;
|
||||
import net.sourceforge.guacamole.net.InetGuacamoleSocket;
|
||||
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
|
||||
import net.sourceforge.guacamole.protocol.ConfiguredGuacamoleSocket;
|
||||
import net.sourceforge.guacamole.servlet.GuacamoleSession;
|
||||
import net.sourceforge.guacamole.servlet.GuacamoleTunnelServlet;
|
||||
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
public class DummyGuacamoleTunnelServlet extends GuacamoleTunnelServlet {
|
||||
|
||||
@Override
|
||||
protected GuacamoleTunnel doConnect(HttpServletRequest request) throws GuacamoleException {
|
||||
|
||||
HttpSession httpSession = request.getSession(true);
|
||||
|
||||
String hostname = GuacamoleProperties.getProperty(GuacamoleProperties.GUACD_HOSTNAME);
|
||||
int port = GuacamoleProperties.getProperty(GuacamoleProperties.GUACD_PORT);
|
||||
|
||||
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
||||
config.setProtocol("vnc");
|
||||
config.setParameter("hostname", "localhost");
|
||||
config.setParameter("port", "5901");
|
||||
config.setParameter("password", "potato");
|
||||
|
||||
GuacamoleSocket socket = new ConfiguredGuacamoleSocket(
|
||||
new InetGuacamoleSocket(hostname, port),
|
||||
config
|
||||
);
|
||||
|
||||
GuacamoleTunnel tunnel = new GuacamoleTunnel(socket);
|
||||
|
||||
// Attach tunnel
|
||||
GuacamoleSession session = new GuacamoleSession(httpSession);
|
||||
session.attachTunnel(tunnel);
|
||||
|
||||
return tunnel;
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user