net.sourceforge.guacamole.servlet
Class GuacamoleHTTPTunnelServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by net.sourceforge.guacamole.servlet.GuacamoleHTTPTunnelServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class GuacamoleHTTPTunnelServlet
extends javax.servlet.http.HttpServlet

A HttpServlet implementing and abstracting the operations required by the HTTP implementation of the JavaScript Guacamole client's tunnel.

Author:
Michael Jumper
See Also:
Serialized Form

Constructor Summary
GuacamoleHTTPTunnelServlet()
           
 
Method Summary
protected abstract  GuacamoleTunnel doConnect(javax.servlet.http.HttpServletRequest request)
          Called whenever the JavaScript Guacamole client makes a connection request.
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doRead(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String tunnelUUID)
          Called whenever the JavaScript Guacamole client makes a read request.
protected  void doWrite(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String tunnelUUID)
          Called whenever the JavaScript Guacamole client makes a write request.
protected  void handleTunnelRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Dispatches every HTTP GET and POST request to the appropriate handler function based on the query string.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuacamoleHTTPTunnelServlet

public GuacamoleHTTPTunnelServlet()
Method Detail

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException

handleTunnelRequest

protected void handleTunnelRequest(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
                            throws javax.servlet.ServletException
Dispatches every HTTP GET and POST request to the appropriate handler function based on the query string.

Parameters:
request - The HttpServletRequest associated with the GET or POST request received.
response - The HttpServletResponse associated with the GET or POST request received.
Throws:
javax.servlet.ServletException - If an error occurs while servicing the request.

doConnect

protected abstract GuacamoleTunnel doConnect(javax.servlet.http.HttpServletRequest request)
                                      throws GuacamoleException
Called whenever the JavaScript Guacamole client makes a connection request. It it up to the implementor of this function to define what conditions must be met for a tunnel to be configured and returned as a result of this connection request (whether some sort of credentials must be specified, for example).

Parameters:
request - The HttpServletRequest associated with the connection request received. Any parameters specified along with the connection request can be read from this object.
Returns:
A newly constructed GuacamoleTunnel if successful, null otherwise.
Throws:
GuacamoleException - If an error occurs while constructing the GuacamoleTunnel, or if the conditions required for connection are not met.

doRead

protected void doRead(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      String tunnelUUID)
               throws GuacamoleException
Called whenever the JavaScript Guacamole client makes a read request. This function should in general not be overridden, as it already contains a proper implementation of the read operation.

Parameters:
request - The HttpServletRequest associated with the read request received.
response - The HttpServletResponse associated with the write request received. Any data to be sent to the client in response to the write request should be written to the response body of this HttpServletResponse.
tunnelUUID - The UUID of the tunnel to read from, as specified in the write request. This tunnel must be attached to the Guacamole session.
Throws:
GuacamoleException - If an error occurs while handling the read request.

doWrite

protected void doWrite(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response,
                       String tunnelUUID)
                throws GuacamoleException
Called whenever the JavaScript Guacamole client makes a write request. This function should in general not be overridden, as it already contains a proper implementation of the write operation.

Parameters:
request - The HttpServletRequest associated with the write request received. Any data to be written will be specified within the body of this request.
response - The HttpServletResponse associated with the write request received.
tunnelUUID - The UUID of the tunnel to write to, as specified in the write request. This tunnel must be attached to the Guacamole session.
Throws:
GuacamoleException - If an error occurs while handling the write request.


Copyright © 2013. All Rights Reserved.