mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +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 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
protected void authenticatedService(
|
||||
UserContext context,
|
||||
HttpServletRequest request, HttpServletResponse response)
|
||||
throws GuacamoleException {
|
||||
|
||||
// Get name
|
||||
// Get name and type
|
||||
String name = request.getParameter("name");
|
||||
String type = request.getParameter("type");
|
||||
|
||||
// Get the ID of the parent connection group
|
||||
String parentID = request.getParameter("parentID");
|
||||
@@ -61,6 +56,11 @@ public class Create extends AuthenticatingHttpServlet {
|
||||
// Create connection skeleton
|
||||
ConnectionGroup connectionGroup = new DummyConnectionGroup();
|
||||
connectionGroup.setName(name);
|
||||
|
||||
if("balancing".equals(type))
|
||||
connectionGroup.setType(ConnectionGroup.Type.BALANCING);
|
||||
else if("organizational".equals(type))
|
||||
connectionGroup.setType(ConnectionGroup.Type.ORGANIZATIONAL);
|
||||
|
||||
// Add connection
|
||||
directory.add(connectionGroup);
|
||||
|
@@ -33,21 +33,16 @@ import net.sourceforge.guacamole.net.basic.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
|
||||
protected void authenticatedService(
|
||||
UserContext context,
|
||||
HttpServletRequest request, HttpServletResponse response)
|
||||
throws GuacamoleException {
|
||||
|
||||
// Get ID, name, and protocol
|
||||
// Get ID, name, and type
|
||||
String identifier = request.getParameter("id");
|
||||
String name = request.getParameter("name");
|
||||
String type = request.getParameter("type");
|
||||
|
||||
// Attempt to get connection group directory
|
||||
Directory<String, ConnectionGroup> directory =
|
||||
@@ -56,6 +51,11 @@ public class Update extends AuthenticatingHttpServlet {
|
||||
// Create connection group skeleton
|
||||
ConnectionGroup connectionGroup = directory.get(identifier);
|
||||
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
|
||||
directory.update(connectionGroup);
|
||||
|
Reference in New Issue
Block a user