GUAC-746: Allow connection IDs to be sent during handshake.

This commit is contained in:
Michael Jumper
2014-09-05 11:05:38 -07:00
parent 2db4a783d7
commit 61e2eabdb3
2 changed files with 35 additions and 2 deletions

View File

@@ -129,8 +129,13 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket {
GuacamoleReader reader = socket.getReader(); GuacamoleReader reader = socket.getReader();
GuacamoleWriter writer = socket.getWriter(); GuacamoleWriter writer = socket.getWriter();
// Send protocol // Get protocol / connection ID
writer.writeInstruction(new GuacamoleInstruction("select", config.getProtocol())); String select_arg = config.getConnectionID();
if (select_arg == null)
select_arg = config.getProtocol();
// Send requested protocol or connection ID
writer.writeInstruction(new GuacamoleInstruction("select", select_arg));
// Wait for server args // Wait for server args
GuacamoleInstruction args = expect(reader, "args"); GuacamoleInstruction args = expect(reader, "args");

View File

@@ -42,6 +42,12 @@ public class GuacamoleConfiguration implements Serializable {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* The ID of the connection being joined. If this value is present,
* the protocol need not be specified.
*/
private String connectionID;
/** /**
* The name of the protocol associated with this configuration. * The name of the protocol associated with this configuration.
*/ */
@@ -52,6 +58,28 @@ public class GuacamoleConfiguration implements Serializable {
*/ */
private Map<String, String> parameters = new HashMap<String, String>(); private Map<String, String> parameters = new HashMap<String, String>();
/**
* Returns the ID of the connection being joined, if any. If no connection
* is being joined, this returns null, and the protocol must be set.
*
* @return The ID of the connection being joined, or null if no connection
* is being joined.
*/
public String getConnectionID() {
return connectionID;
}
/**
* Sets the ID of the connection being joined, if any. If no connection
* is being joined, this value must be omitted, and the protocol must be
* set instead.
*
* @param connectionID The ID of the connection being joined.
*/
public void setConnectionID(String connectionID) {
this.connectionID = connectionID;
}
/** /**
* Returns the name of the protocol to be used. * Returns the name of the protocol to be used.
* @return The name of the protocol to be used. * @return The name of the protocol to be used.