org.w3c.jigsaw.http.mux
Class MuxClient

java.lang.Object
  extended by org.w3c.jigsaw.http.Client
      extended by org.w3c.jigsaw.http.mux.MuxClient
All Implemented Interfaces:
java.lang.Runnable, EventHandler

public class MuxClient
extends Client
implements java.lang.Runnable


Field Summary
protected  java.lang.Thread thread
          The thread powering that client connection.
 
Fields inherited from class org.w3c.jigsaw.http.Client
buffer, cont, currentURI, debug, identifier, prev_body_count, reqcount, server
 
Method Summary
protected  void bind(MuxSession session)
          Bind that client to the given connection.
 java.net.InetAddress getInetAddress()
          Client implementation - Get the IP address of this client.
protected  java.lang.Thread getThread()
          Get the thread powering that client.
protected  boolean idleConnection()
          Client implementation - The current connection is now idle.
 void run()
          Run HTTP on the newly created mux session.
protected  void stopConnection()
          Client implementation - The current connection was terminated.
protected  boolean tryKeepConnection(Request request, Reply reply)
          Request has been processed into Reply, should we keep connection alive ? Test wether we can keep the connection alive, after the given reply has been emited.
protected  void usedConnection()
          Client implementation - The current connection is now in use.
 
Methods inherited from class org.w3c.jigsaw.http.Client
chunkTransfer, emitReply, error, getIdentifier, getInputStream, getMajorVersion, getMinorVersion, getNextRequest, getOutputStream, getRequestCount, getServer, handleTimerEvent, initialize, interruptConnection, isInterrupted, isRunning, log, processRequest, sendContinue, sendContinue, startConnection, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

thread

protected java.lang.Thread thread
The thread powering that client connection.

Method Detail

tryKeepConnection

protected boolean tryKeepConnection(Request request,
                                    Reply reply)
Description copied from class: Client
Request has been processed into Reply, should we keep connection alive ? Test wether we can keep the connection alive, after the given reply has been emited.

Overrides:
tryKeepConnection in class Client
Parameters:
request - The request to examine.
reply - Its computed reply.

getInetAddress

public java.net.InetAddress getInetAddress()
Client implementation - Get the IP address of this client.

Specified by:
getInetAddress in class Client
Returns:
An InetAddress instance, or null if the client is not currently running.

run

public void run()
Run HTTP on the newly created mux session.

Specified by:
run in interface java.lang.Runnable

idleConnection

protected boolean idleConnection()
Client implementation - The current connection is now idle. We always close the mux session at that time, since creating a new mux session has nearly no overhead.

Specified by:
idleConnection in class Client
Returns:
A boolean, if true, the client will consider itself interrupted, and terminate the connection it is current handling.

usedConnection

protected void usedConnection()
Client implementation - The current connection is now in use. Nothing special done.

Specified by:
usedConnection in class Client

stopConnection

protected void stopConnection()
Client implementation - The current connection was terminated. We make sure the underlying mux session is closed properly, and terminate the underlying thread.

Specified by:
stopConnection in class Client

bind

protected void bind(MuxSession session)
             throws java.io.IOException
Bind that client to the given connection.

Parameters:
session - The mux session to handle.
Throws:
java.io.IOException

getThread

protected java.lang.Thread getThread()
Get the thread powering that client.

Specified by:
getThread in class Client
Returns:
A Thread instance, or null.