gr.uoa.di.madgik.grs.proxy.http
Class HTTPConnectionHandler

java.lang.Object
  extended by gr.uoa.di.madgik.grs.proxy.http.HTTPConnectionHandler
All Implemented Interfaces:
gr.uoa.di.madgik.commons.server.http.IHTTPConnectionManagerEntry

public class HTTPConnectionHandler
extends java.lang.Object
implements gr.uoa.di.madgik.commons.server.http.IHTTPConnectionManagerEntry

A connection handler that can be registered with the HTTPConnectionManager in order to receive incoming HTTP connection from clients. This entry is set to serve connections for the gRS2 component

Author:
Alex Antoniadis

Nested Class Summary
 
Nested classes/interfaces inherited from interface gr.uoa.di.madgik.commons.server.http.IHTTPConnectionManagerEntry
gr.uoa.di.madgik.commons.server.http.IHTTPConnectionManagerEntry.NamedEntry
 
Constructor Summary
HTTPConnectionHandler()
           
 
Method Summary
 gr.uoa.di.madgik.commons.server.http.IHTTPConnectionManagerEntry.NamedEntry GetName()
          
 void HandleConnection(java.net.Socket socket, java.lang.String request, java.io.BufferedOutputStream out, java.lang.String key)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPConnectionHandler

public HTTPConnectionHandler()
Method Detail

GetName

public gr.uoa.di.madgik.commons.server.http.IHTTPConnectionManagerEntry.NamedEntry GetName()

The connection manager entry this handler can serve. The entry returned is marked with gr.uoa.di.madgik.commons.server.IHTTPConnectionManagerEntry.NamedEntry#gRS2

Specified by:
GetName in interface gr.uoa.di.madgik.commons.server.http.IHTTPConnectionManagerEntry
See Also:
gr.uoa.di.madgik.commons.server.IHTTPConnectionManagerEntry#GetName()

HandleConnection

public void HandleConnection(java.net.Socket socket,
                             java.lang.String request,
                             java.io.BufferedOutputStream out,
                             java.lang.String key)

After a request of the correct type has reached HTTPConnectionManager, it is forwarded here where the specific IBuffer and its serving IMirror is located. The request is forwarded to the IMirror and the operation is completed in this thread of execution. In the IMirror thread of execution, the mirroring protocol is initiated and served.
The IMirror that is expected by this handler is one that manages HTTP connections, the HTTPWriterMirror over which the HTTPWriterMirror#setSocket(Socket) and HTTPWriterMirror.setKey(String) is set before a call to HTTPWriterMirror#handle() is invoked.
If the state of the HTTPWriterMirror thread is not Thread.State.NEWm then the connection is discarded as there is already a mirroring process in progress

Specified by:
HandleConnection in interface gr.uoa.di.madgik.commons.server.http.IHTTPConnectionManagerEntry
See Also:
gr.uoa.di.madgik.commons.server.IHTTPConnectionManagerEntry#HandleConnection(java.net.Socket)