本文整理汇总了Java中org.glyptodon.guacamole.protocol.GuacamoleConfiguration.setProtocol方法的典型用法代码示例。如果您正苦于以下问题:Java GuacamoleConfiguration.setProtocol方法的具体用法?Java GuacamoleConfiguration.setProtocol怎么用?Java GuacamoleConfiguration.setProtocol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.glyptodon.guacamole.protocol.GuacamoleConfiguration
的用法示例。
在下文中一共展示了GuacamoleConfiguration.setProtocol方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseConfigParams
import org.glyptodon.guacamole.protocol.GuacamoleConfiguration; //导入方法依赖的package包/类
private GuacamoleConfiguration parseConfigParams(HttpServletRequest request) {
GuacamoleConfiguration config = new GuacamoleConfiguration();
Map<String, String[]> params = request.getParameterMap();
for (String name : params.keySet()) {
String value = request.getParameter(name);
if (!name.startsWith(PARAM_PREFIX) || value == null || value.length() == 0) {
continue;
}
else if (name.equals(PARAM_PREFIX + "protocol")) {
config.setProtocol(request.getParameter(name));
}
else {
config.setParameter(name.substring(PARAM_PREFIX.length()), request.getParameter(name));
}
}
if (config.getProtocol() == null) config.setProtocol(defaultProtocol);
return config;
}
示例2: doConnect
import org.glyptodon.guacamole.protocol.GuacamoleConfiguration; //导入方法依赖的package包/类
@Override
protected GuacamoleTunnel doConnect(final HttpServletRequest request) throws GuacamoleException {
final HttpSession httpSession = request.getSession(true);
final String sessionId = readBody(request);
final LoginDialog credentials = (LoginDialog) request.getSession().getAttribute(sessionId);
credentials.createNewSession(request.getSession());
// guacd connection information
final String hostname = "192.168.178.32";
final String user = credentials.getUserName();
final String password = credentials.getPassword();
final int port = 4822;
// RDP connection information
final GuacamoleConfiguration config = new GuacamoleConfiguration();
// config.setProtocol("rdp");
// config.setParameter("security", "any");
// config.setParameter("ignore-cert", "true");
// config.setParameter("hostname", "192.168.178.24");
// config.setParameter("port", "3389");
// config.setParameter("username", "Administrator");
// config.setParameter("password", "1Nv3sdw1n.");
config.setProtocol("ssh");
config.setParameter("hostname", hostname);
config.setParameter("port", "22");
config.setParameter("username", user);
config.setParameter("password", password);
// Connect to guacd, proxying a connection to the VNC server above
final GuacamoleSocket socket = new ConfiguredGuacamoleSocket(new InetGuacamoleSocket(hostname, port), config);
// Create tunnel from now-configured socket
final GuacamoleTunnel tunnel = new SimpleGuacamoleTunnel(socket);
// Attach tunnel
final GuacamoleSession session = new GuacamoleSession(httpSession);
session.attachTunnel(tunnel);
return tunnel;
}