mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	Removed connect() from GuacamoleSocket. Added ConfiguredSocket for providing restricted pre-configured (finished with handshake and connect) GuacamoleSockets.
This commit is contained in:
		| @@ -22,7 +22,6 @@ package net.sourceforge.guacamole; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.util.Properties; | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
|  | ||||
| public class GuacamoleProperties { | ||||
|  | ||||
|   | ||||
| @@ -3,11 +3,9 @@ package net.sourceforge.guacamole.io; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.io.Reader; | ||||
| import java.io.Writer; | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
| import net.sourceforge.guacamole.protocol.GuacamoleInstruction; | ||||
| import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation; | ||||
| import net.sourceforge.guacamole.protocol.Configuration; | ||||
|  | ||||
| /* | ||||
|  *  Guacamole - Clientless Remote Desktop | ||||
|   | ||||
| @@ -2,12 +2,9 @@ | ||||
| package net.sourceforge.guacamole.io; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.io.Reader; | ||||
| import java.io.Writer; | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
| import net.sourceforge.guacamole.protocol.GuacamoleInstruction; | ||||
| import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation; | ||||
| import net.sourceforge.guacamole.protocol.Configuration; | ||||
|  | ||||
| /* | ||||
|  *  Guacamole - Clientless Remote Desktop | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
|  | ||||
| package net.sourceforge.guacamole.net; | ||||
|  | ||||
| import net.sourceforge.guacamole.protocol.Configuration; | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
| import net.sourceforge.guacamole.io.GuacamoleReader; | ||||
| import net.sourceforge.guacamole.io.GuacamoleWriter; | ||||
| @@ -29,7 +28,6 @@ public interface GuacamoleSocket { | ||||
|     public GuacamoleReader getReader(); | ||||
|     public GuacamoleWriter getWriter(); | ||||
|  | ||||
|     public void connect(Configuration config) throws GuacamoleException; | ||||
|     public void disconnect() throws GuacamoleException; | ||||
|     public void close() throws GuacamoleException; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -23,7 +23,6 @@ import java.util.UUID; | ||||
| import java.util.concurrent.locks.ReentrantLock; | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
| import net.sourceforge.guacamole.io.GuacamoleReader; | ||||
| import net.sourceforge.guacamole.net.GuacamoleSocket; | ||||
| import net.sourceforge.guacamole.io.GuacamoleWriter; | ||||
|  | ||||
| public class GuacamoleTunnel { | ||||
|   | ||||
| @@ -35,7 +35,7 @@ import java.net.SocketAddress; | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
|  | ||||
|  | ||||
| public class TCPGuacamoleSocket extends AbstractGuacamoleSocket { | ||||
| public class TCPGuacamoleSocket implements GuacamoleSocket { | ||||
|  | ||||
|     private GuacamoleReader reader; | ||||
|     private GuacamoleWriter writer; | ||||
| @@ -72,7 +72,7 @@ public class TCPGuacamoleSocket extends AbstractGuacamoleSocket { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void disconnect() throws GuacamoleException { | ||||
|     public void close() throws GuacamoleException { | ||||
|         try { | ||||
|             sock.close(); | ||||
|         } | ||||
|   | ||||
| @@ -1,15 +1,11 @@ | ||||
| 
 | ||||
| package net.sourceforge.guacamole.net; | ||||
| package net.sourceforge.guacamole.protocol; | ||||
| 
 | ||||
| import net.sourceforge.guacamole.io.GuacamoleReader; | ||||
| import net.sourceforge.guacamole.io.GuacamoleWriter; | ||||
| import java.io.IOException; | ||||
| import java.io.Reader; | ||||
| import java.io.Writer; | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
| import net.sourceforge.guacamole.protocol.GuacamoleInstruction; | ||||
| import net.sourceforge.guacamole.net.GuacamoleSocket; | ||||
| import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation; | ||||
| import net.sourceforge.guacamole.protocol.Configuration; | ||||
| 
 | ||||
| /* | ||||
|  *  Guacamole - Clientless Remote Desktop | ||||
| @@ -29,14 +25,17 @@ import net.sourceforge.guacamole.protocol.Configuration; | ||||
|  *  along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| public abstract class AbstractGuacamoleSocket implements GuacamoleSocket { | ||||
| public class ConfiguredSocket implements GuacamoleSocket { | ||||
| 
 | ||||
|     @Override | ||||
|     public void connect(Configuration config) throws GuacamoleException { | ||||
|     private GuacamoleSocket socket; | ||||
| 
 | ||||
|     public ConfiguredSocket(GuacamoleSocket socket, Configuration config) throws GuacamoleException { | ||||
| 
 | ||||
|         this.socket = socket; | ||||
| 
 | ||||
|         // Get reader and writer | ||||
|         GuacamoleReader reader = getReader(); | ||||
|         GuacamoleWriter writer = getWriter(); | ||||
|         GuacamoleReader reader = socket.getReader(); | ||||
|         GuacamoleWriter writer = socket.getWriter(); | ||||
| 
 | ||||
|         // Send protocol | ||||
|         writer.writeInstruction(new GuacamoleInstruction(Operation.CLIENT_SELECT, config.getProtocol())); | ||||
| @@ -66,4 +65,19 @@ public abstract class AbstractGuacamoleSocket implements GuacamoleSocket { | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public GuacamoleWriter getWriter() { | ||||
|         return socket.getWriter(); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public GuacamoleReader getReader() { | ||||
|         return socket.getReader(); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void close() throws GuacamoleException { | ||||
|         socket.close(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @@ -31,7 +31,6 @@ import javax.servlet.http.HttpServletResponse; | ||||
| import javax.servlet.http.HttpSession; | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
| import net.sourceforge.guacamole.io.GuacamoleReader; | ||||
| import net.sourceforge.guacamole.net.GuacamoleSocket; | ||||
| import net.sourceforge.guacamole.io.GuacamoleWriter; | ||||
|  | ||||
|  | ||||
| @@ -47,6 +46,7 @@ public abstract class GuacamoleTunnelServlet extends HttpServlet { | ||||
|         service(request, response); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException { | ||||
|  | ||||
|         try { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user