Add controlling enable-clipboard-integration property.

This commit is contained in:
Michael Jumper
2014-03-03 09:39:09 -08:00
parent 65451a37f8
commit 3c8d72653e

View File

@@ -29,8 +29,8 @@ import javax.servlet.http.HttpSession;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.GuacamoleServerException; import org.glyptodon.guacamole.GuacamoleServerException;
import org.glyptodon.guacamole.net.auth.UserContext; import org.glyptodon.guacamole.net.auth.UserContext;
import org.slf4j.Logger; import org.glyptodon.guacamole.properties.BooleanGuacamoleProperty;
import org.slf4j.LoggerFactory; import org.glyptodon.guacamole.properties.GuacamoleProperties;
/** /**
* Servlet which dumps the current contents of the clipboard. * Servlet which dumps the current contents of the clipboard.
@@ -39,22 +39,31 @@ import org.slf4j.LoggerFactory;
*/ */
public class CaptureClipboard extends AuthenticatingHttpServlet { public class CaptureClipboard extends AuthenticatingHttpServlet {
/**
* Logger for this class.
*/
private Logger logger = LoggerFactory.getLogger(CaptureClipboard.class);
/** /**
* The amount of time to wait for clipboard changes, in milliseconds. * The amount of time to wait for clipboard changes, in milliseconds.
*/ */
private static final int CLIPBOARD_TIMEOUT = 250; private static final int CLIPBOARD_TIMEOUT = 250;
/**
* Whether clipboard integration is enabled.
*/
public static final BooleanGuacamoleProperty INTEGRATION_ENABLED = new BooleanGuacamoleProperty() {
@Override
public String getName() { return "enable-clipboard-integration"; }
};
@Override @Override
protected void authenticatedService( protected void authenticatedService(
UserContext context, UserContext context,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws GuacamoleException { throws GuacamoleException {
// Only bother if actually enabled
if (GuacamoleProperties.getProperty(INTEGRATION_ENABLED, false)) {
// Get clipboard // Get clipboard
final HttpSession session = request.getSession(true); final HttpSession session = request.getSession(true);
final ClipboardState clipboard = getClipboardState(session); final ClipboardState clipboard = getClipboardState(session);
@@ -70,4 +79,6 @@ public class CaptureClipboard extends AuthenticatingHttpServlet {
} }
}
} }