mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +00:00
Ticket #263: Fixed issues from code review.
This commit is contained in:
@@ -33,20 +33,15 @@ import net.sourceforge.guacamole.net.basic.AuthenticatingHttpServlet;
|
|||||||
*/
|
*/
|
||||||
public class Create extends AuthenticatingHttpServlet {
|
public class Create extends AuthenticatingHttpServlet {
|
||||||
|
|
||||||
/**
|
|
||||||
* Prefix given to a parameter name when that parameter is a protocol-
|
|
||||||
* specific parameter meant for the configuration.
|
|
||||||
*/
|
|
||||||
public static final String PARAMETER_PREFIX = "_";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void authenticatedService(
|
protected void authenticatedService(
|
||||||
UserContext context,
|
UserContext context,
|
||||||
HttpServletRequest request, HttpServletResponse response)
|
HttpServletRequest request, HttpServletResponse response)
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
|
|
||||||
// Get name
|
// Get name and type
|
||||||
String name = request.getParameter("name");
|
String name = request.getParameter("name");
|
||||||
|
String type = request.getParameter("type");
|
||||||
|
|
||||||
// Get the ID of the parent connection group
|
// Get the ID of the parent connection group
|
||||||
String parentID = request.getParameter("parentID");
|
String parentID = request.getParameter("parentID");
|
||||||
@@ -61,6 +56,11 @@ public class Create extends AuthenticatingHttpServlet {
|
|||||||
// Create connection skeleton
|
// Create connection skeleton
|
||||||
ConnectionGroup connectionGroup = new DummyConnectionGroup();
|
ConnectionGroup connectionGroup = new DummyConnectionGroup();
|
||||||
connectionGroup.setName(name);
|
connectionGroup.setName(name);
|
||||||
|
|
||||||
|
if("balancing".equals(type))
|
||||||
|
connectionGroup.setType(ConnectionGroup.Type.BALANCING);
|
||||||
|
else if("organizational".equals(type))
|
||||||
|
connectionGroup.setType(ConnectionGroup.Type.ORGANIZATIONAL);
|
||||||
|
|
||||||
// Add connection
|
// Add connection
|
||||||
directory.add(connectionGroup);
|
directory.add(connectionGroup);
|
||||||
|
@@ -33,21 +33,16 @@ import net.sourceforge.guacamole.net.basic.AuthenticatingHttpServlet;
|
|||||||
*/
|
*/
|
||||||
public class Update extends AuthenticatingHttpServlet {
|
public class Update extends AuthenticatingHttpServlet {
|
||||||
|
|
||||||
/**
|
|
||||||
* Prefix given to a parameter name when that parameter is a protocol-
|
|
||||||
* specific parameter meant for the configuration.
|
|
||||||
*/
|
|
||||||
public static final String PARAMETER_PREFIX = "_";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void authenticatedService(
|
protected void authenticatedService(
|
||||||
UserContext context,
|
UserContext context,
|
||||||
HttpServletRequest request, HttpServletResponse response)
|
HttpServletRequest request, HttpServletResponse response)
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
|
|
||||||
// Get ID, name, and protocol
|
// Get ID, name, and type
|
||||||
String identifier = request.getParameter("id");
|
String identifier = request.getParameter("id");
|
||||||
String name = request.getParameter("name");
|
String name = request.getParameter("name");
|
||||||
|
String type = request.getParameter("type");
|
||||||
|
|
||||||
// Attempt to get connection group directory
|
// Attempt to get connection group directory
|
||||||
Directory<String, ConnectionGroup> directory =
|
Directory<String, ConnectionGroup> directory =
|
||||||
@@ -56,6 +51,11 @@ public class Update extends AuthenticatingHttpServlet {
|
|||||||
// Create connection group skeleton
|
// Create connection group skeleton
|
||||||
ConnectionGroup connectionGroup = directory.get(identifier);
|
ConnectionGroup connectionGroup = directory.get(identifier);
|
||||||
connectionGroup.setName(name);
|
connectionGroup.setName(name);
|
||||||
|
|
||||||
|
if("balancing".equals(type))
|
||||||
|
connectionGroup.setType(ConnectionGroup.Type.BALANCING);
|
||||||
|
else if("organizational".equals(type))
|
||||||
|
connectionGroup.setType(ConnectionGroup.Type.ORGANIZATIONAL);
|
||||||
|
|
||||||
// Update connection group
|
// Update connection group
|
||||||
directory.update(connectionGroup);
|
directory.update(connectionGroup);
|
||||||
|
Reference in New Issue
Block a user