org.w3c.www.protocol.http
Class HttpIDMConnection

java.lang.Object
  |
  +--org.w3c.www.protocol.http.HttpConnection
        |
        +--org.w3c.www.protocol.http.HttpBasicConnection
              |
              +--org.w3c.www.protocol.http.HttpIDMConnection
All Implemented Interfaces:
org.ssonet.net.CertificateListener, idman.rules.ChainEvaluationListener, org.ssonet.net.ConnectionListener, org.w3c.www.http.HttpStreamObserver, org.w3c.util.LRUAble, org.ssonet.net.SSONETContextListener

public class HttpIDMConnection
extends org.w3c.www.protocol.http.HttpBasicConnection
implements org.w3c.www.http.HttpStreamObserver, org.ssonet.net.SSONETContextListener, idman.rules.ChainEvaluationListener, org.ssonet.net.CertificateListener, org.ssonet.net.ConnectionListener


Field Summary
protected  boolean cached
           
 org.ssonet.net.CertificateListener certificateListener
          the default certificate listener
 idman.mngt.Context context
          The connection context used in the id manager
static boolean debug
           
static boolean debugProfiling
           
protected  int id
           
(package private)  java.net.InetAddress inetaddr
           
(package private)  java.io.InputStream input
           
protected  org.w3c.util.LRUAble lru_next
           
protected  org.w3c.util.LRUAble lru_prev
           
protected  java.lang.Object monitor
           
(package private)  java.io.OutputStream output
           
(package private)  org.w3c.www.mime.MimeParser parser
           
(package private)  int port
           
(package private)  org.w3c.www.mime.MimeParserFactory reply_factory
           
protected  org.w3c.www.protocol.http.HttpServer server
           
(package private) static java.lang.reflect.Method sock_m
           
(package private)  java.lang.Thread th
           
(package private)  int timeout
           
 
Fields inherited from interface org.ssonet.net.CertificateListener
INVALID, NOT_TESTED, VALID
 
Fields inherited from interface org.ssonet.net.ConnectionListener
FINISHED_STATE, INIT_STATE, MECHANISMS_NEGOTIATION, NOT_STARTED_STATE, RUNNING_STATE, SECURITY_GOAL_NEGOTIATION
 
Constructor Summary
(package private) HttpIDMConnection(org.w3c.www.protocol.http.HttpServer server, int id, java.net.InetAddress addr, int port, int timeout, org.w3c.www.mime.MimeParserFactory reply_factory)
          Create a new connection.
(package private) HttpIDMConnection(org.w3c.www.protocol.http.HttpServer server, int id, java.net.InetAddress addr, int port, int timeout, org.w3c.www.mime.MimeParserFactory reply_factory, java.lang.String role)
           
 
Method Summary
(package private) static void ()
           
 int checkCertificate(org.ssonet.net.SSONETContext context, java.security.cert.X509Certificate cert)
          Check Servers certificate, register the certifiate with the id manager, and find out clients pseudonym.
 void close()
           
 void connectionStateChanged(org.ssonet.net.SSONETContext c, int state)
           
 void contextChanged(org.ssonet.net.SSONETContext c)
          Notifies about context changes.
protected  idman.mngt.Context createContext(java.lang.String role)
          Creates a context for this connection
 boolean decideSecurityGoal(int securityGoal, org.ssonet.net.ActionConfiguration ownConfiguration, org.ssonet.net.SSONETContext context)
          Handles a solvable conflict during security goal negotiation
 boolean doWarning(java.lang.String chainname, idman.rules.Condition cond, java.lang.String id, byte[] content, idman.mngt.Context context, java.lang.String parameter)
          Receive warnings from ChainEvaluator for finding the Pseudonym for receiving requests.
 org.w3c.util.LRUAble getNext()
           
 java.io.OutputStream getOutputStream()
          Get the connection output stream.
 org.w3c.www.mime.MimeParser getParser()
          Get the MIME parser to read from this connection.
 org.w3c.util.LRUAble getPrev()
           
protected  org.w3c.www.protocol.http.HttpServer getServer()
           
 void markIdle(boolean close)
          The connection is now idle again.
 boolean markUsed()
          Mark this connection as being used.
 void negotiationRequestReceived(org.ssonet.net.SSONETContext context, int negotiationType)
          Handles a new negotiation request.
 void notifyClose(java.io.InputStream in)
          The entity stream we observe has been closed.
 void notifyEOF(java.io.InputStream in)
          The entity stream we observe has reached its end.
 void notifyFailure(java.io.InputStream in)
          The entity stream we were to observe refuse to be observed.
 void notifyInputAvailable(java.io.InputStream in)
          Some data available on input, while writing to the server.
 void replaceContext(org.ssonet.net.SSONETContext o, org.ssonet.net.SSONETContext n)
          Method of SSONETContextListener.
 void setNext(org.w3c.util.LRUAble)
           
 void setPrev(org.w3c.util.LRUAble)
           
 java.lang.String toString()
          Print this connection into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

public static boolean debug

debugProfiling

public static boolean debugProfiling

context

public idman.mngt.Context context
The connection context used in the id manager


certificateListener

public org.ssonet.net.CertificateListener certificateListener
the default certificate listener


monitor

protected java.lang.Object monitor

sock_m

static java.lang.reflect.Method sock_m

parser

org.w3c.www.mime.MimeParser parser

output

java.io.OutputStream output

input

java.io.InputStream input

reply_factory

org.w3c.www.mime.MimeParserFactory reply_factory

th

java.lang.Thread th

inetaddr

java.net.InetAddress inetaddr

port

int port

timeout

int timeout

id

protected int id

lru_next

protected org.w3c.util.LRUAble lru_next

lru_prev

protected org.w3c.util.LRUAble lru_prev

server

protected org.w3c.www.protocol.http.HttpServer server

cached

protected boolean cached
Constructor Detail

HttpIDMConnection

HttpIDMConnection(org.w3c.www.protocol.http.HttpServer server,
                  int id,
                  java.net.InetAddress addr,
                  int port,
                  int timeout,
                  org.w3c.www.mime.MimeParserFactory reply_factory)
            throws java.io.IOException
Create a new connection. To be used only by HttpIDMServer instances.


HttpIDMConnection

HttpIDMConnection(org.w3c.www.protocol.http.HttpServer server,
                  int id,
                  java.net.InetAddress addr,
                  int port,
                  int timeout,
                  org.w3c.www.mime.MimeParserFactory reply_factory,
                  java.lang.String role)
            throws java.io.IOException
Method Detail

toString

public java.lang.String toString()
Print this connection into a String.

Overrides:
toString in class org.w3c.www.protocol.http.HttpBasicConnection
Returns:
A String containing the external representation for the connection.

notifyEOF

public void notifyEOF(java.io.InputStream in)
The entity stream we observe has reached its end. Notify the server that it can now reuse the connection safely for some other pending requests.

Specified by:
notifyEOF in interface org.w3c.www.http.HttpStreamObserver
Overrides:
notifyEOF in class org.w3c.www.protocol.http.HttpBasicConnection
Parameters:
in - The stream that has reached its end of file.

notifyFailure

public void notifyFailure(java.io.InputStream in)
The entity stream we were to observe refuse to be observed. The connection will not be reusable, so we should detach it from the managing server, without closing it, since the entity reader will close it itself.

Specified by:
notifyFailure in interface org.w3c.www.http.HttpStreamObserver
Overrides:
notifyFailure in class org.w3c.www.protocol.http.HttpBasicConnection
Parameters:
in - The stream that has been closed.

notifyClose

public void notifyClose(java.io.InputStream in)
The entity stream we observe has been closed. After making sure the entire entity has been read, we can safely hand out the connection to the server, for later reuse.

Specified by:
notifyClose in interface org.w3c.www.http.HttpStreamObserver
Overrides:
notifyClose in class org.w3c.www.protocol.http.HttpBasicConnection
Parameters:
in - The stream that has been closed.

markUsed

public boolean markUsed()
Mark this connection as being used. The server, which keeps track of idle connections, has decided to use this connection to run some request. Mark this connection as used and unregister it from the server's list of idle connections.

Some assumptions are checked before handing out the connection for use, which can throw an RuntimeException.

Overrides:
markUsed in class org.w3c.www.protocol.http.HttpBasicConnection
Returns:
A boolean, true if the connection can be used or reused, false otherwise (the connection was detected idle, and destroy itself).
Throws:
java.lang.RuntimeException - If the connection is in an invalid state.

markIdle

public void markIdle(boolean close)
The connection is now idle again. Mark the connection as idle, and register it to the server's list of idle connection (if this connection can be reused). If the connection cannot be reused, detach it from the server and forget about it (the caller will close it by closing the entity stream).

Overrides:
markIdle in class org.w3c.www.protocol.http.HttpBasicConnection
Parameters:
close - Should this connection be physically closed (it is not reusable), or should we try to keep track of it for later reuse.
Throws:
java.lang.RuntimeException - If the connection is in an invalid state.

notifyInputAvailable

public void notifyInputAvailable(java.io.InputStream in)
Some data available on input, while writing to the server. This callback gets called when the client is emitting data to the server and the server has sent us something before we actually sent all our bytes.

Take any appropriate action.

Overrides:
notifyInputAvailable in class org.w3c.www.protocol.http.HttpBasicConnection

getParser

public org.w3c.www.mime.MimeParser getParser()
Get the MIME parser to read from this connection. All access to the connection's input stream should go through the MIME parser to ensure buffering coherency.

Overrides:
getParser in class org.w3c.www.protocol.http.HttpBasicConnection
Returns:
A MimeParser instance suitable to parse the reply input stream.
Throws:
java.lang.RuntimeException - If the connection was not connected.

getOutputStream

public java.io.OutputStream getOutputStream()
Get the connection output stream.

Overrides:
getOutputStream in class org.w3c.www.protocol.http.HttpBasicConnection
Returns:
The output stream to send data on this connection.
Throws:
java.lang.RuntimeException - If the connection was not previously opened.

createContext

protected idman.mngt.Context createContext(java.lang.String role)
Creates a context for this connection


checkCertificate

public int checkCertificate(org.ssonet.net.SSONETContext context,
                            java.security.cert.X509Certificate cert)
Check Servers certificate, register the certifiate with the id manager, and find out clients pseudonym.

Specified by:
checkCertificate in interface org.ssonet.net.CertificateListener

doWarning

public boolean doWarning(java.lang.String chainname,
                         idman.rules.Condition cond,
                         java.lang.String id,
                         byte[] content,
                         idman.mngt.Context context,
                         java.lang.String parameter)
Receive warnings from ChainEvaluator for finding the Pseudonym for receiving requests.

Specified by:
doWarning in interface idman.rules.ChainEvaluationListener

negotiationRequestReceived

public void negotiationRequestReceived(org.ssonet.net.SSONETContext context,
                                       int negotiationType)
Handles a new negotiation request. Does nothing.

Specified by:
negotiationRequestReceived in interface org.ssonet.net.ConnectionListener
Parameters:
context - the SSONETContext used by the server for this request.
negotiationType - SECURITY_GOAL_NEGOTIATION if the negotiation requested is a security goal (and mechanisms) negotiation,

MECHANISMS_NEGOTIATION if the negotiation requested is only a mechanisms negotiation.


decideSecurityGoal

public boolean decideSecurityGoal(int securityGoal,
                                  org.ssonet.net.ActionConfiguration ownConfiguration,
                                  org.ssonet.net.SSONETContext context)
Handles a solvable conflict during security goal negotiation

Specified by:
decideSecurityGoal in interface org.ssonet.net.ConnectionListener

replaceContext

public void replaceContext(org.ssonet.net.SSONETContext o,
                           org.ssonet.net.SSONETContext n)
Method of SSONETContextListener. Replaces an old context.

Specified by:
replaceContext in interface org.ssonet.net.SSONETContextListener

contextChanged

public void contextChanged(org.ssonet.net.SSONETContext c)
Notifies about context changes. Not used.

Specified by:
contextChanged in interface org.ssonet.net.SSONETContextListener

connectionStateChanged

public void connectionStateChanged(org.ssonet.net.SSONETContext c,
                                   int state)
Specified by:
connectionStateChanged in interface org.ssonet.net.ConnectionListener

close

public void close()
Specified by:
close in class org.w3c.www.protocol.http.HttpConnection

static void ()

getNext

public org.w3c.util.LRUAble getNext()
Specified by:
getNext in interface org.w3c.util.LRUAble

getPrev

public org.w3c.util.LRUAble getPrev()
Specified by:
getPrev in interface org.w3c.util.LRUAble

setNext

public void setNext(org.w3c.util.LRUAble)
Specified by:
setNext in interface org.w3c.util.LRUAble

setPrev

public void setPrev(org.w3c.util.LRUAble)
Specified by:
setPrev in interface org.w3c.util.LRUAble

getServer

protected final org.w3c.www.protocol.http.HttpServer getServer()


Copyright © 2003 DRIM Team. All Rights Reserved.