|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.jigsaw.http.Client org.w3c.jigsaw.http.socket.SocketClient
public class SocketClient
This class implements the object that handles client connections. One such object exists per open connections at any given time.
The basic architecture is the following: the httpd instance accepts new connections on its port. When such a connection is accepted a Client object is requested to the client pool (which can implement what ever strategy is suitable). Each request is than managed by looking up an resource and invoking the resource methods corresponding to the request.
httpd
,
Request
,
Reply
Field Summary | |
---|---|
protected boolean |
alive
Is this client still alive ? |
protected int |
bindcount
Number of times this client was bound to a connection. |
protected org.w3c.jigsaw.http.socket.SocketOutputBuffer |
bufout
Our reusable output buffer. |
protected boolean |
done
are we done? |
protected boolean |
idle
Our we idle (waiting for next request ?) |
protected java.net.Socket |
socket
The socket currently handled by the client. |
protected java.lang.Thread |
thread
The thread that we have been attached to. |
Fields inherited from class org.w3c.jigsaw.http.Client |
---|
buffer, cont, currentURI, debug, identifier, prev_body_count, reqcount, server |
Constructor Summary | |
---|---|
protected |
SocketClient(httpd server,
SocketClientFactory pool,
SocketClientState state)
Create an empty client, that will be ready to work. |
Method Summary | |
---|---|
protected void |
bind(java.net.Socket socket)
SocketClientFactory interface - Bind the socket to this client. |
int |
getBindCount()
Get the total number of times this client was bound to a socket. |
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 idle. |
void |
join()
If this client is allocated a thread, join it. |
protected void |
kill(boolean now)
SocketClientFactory interface - Kill this client. |
void |
run()
Run for our newly attached connection. |
protected void |
stopConnection()
Client implementation - This connection has been stopped. |
java.lang.String |
toString()
Print that client into a String. |
protected void |
unbind()
SocketClientFactory interface - Unbind this client. |
protected void |
usedConnection()
Client implementation - The current connection is 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, tryKeepConnection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.net.Socket socket
protected boolean alive
protected int bindcount
protected java.lang.Thread thread
protected org.w3c.jigsaw.http.socket.SocketOutputBuffer bufout
protected boolean idle
protected boolean done
Constructor Detail |
---|
protected SocketClient(httpd server, SocketClientFactory pool, SocketClientState state)
bind
to some socket before proceeding.
server
- The server to which this client is attached.id
- The client identifier.Client
,
ClientFactory
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public void join()
public void run()
run
in interface java.lang.Runnable
public java.net.InetAddress getInetAddress()
getInetAddress
in class Client
protected void stopConnection()
stopConnection
in class Client
protected java.lang.Thread getThread()
getThread
in class Client
protected boolean idleConnection()
idleConnection
in class Client
protected void usedConnection()
usedConnection
in class Client
protected void bind(java.net.Socket socket)
socket
- The socket this client should now handle.protected void unbind()
protected void kill(boolean now)
public final int getBindCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |