Hi Simon,

In such a case, you can modify your IoFilter to fire a virtual
messageReceived event so your IoHandler can get notified when the
credential exchange completes.  For example:

public static final Object AUTHENTICATION_SUCCEEDED = new Object();

public void messageReceived(NextFilter nextFilter, IoSession session,
Object message) {
        // authenticate
        ....
        nextFilter.messageReceived(session, AUTHENTICATION_SUCCEEDED);
}

Otherwise, you could modify your IoFilter to set some state attribute to
the associated session and to check if the state attribute exists in
filterWrite() and queue up write requests until authentication process
completes.

HTH,

On Sat, 2008-03-29 at 06:14 +0900, Simon Trudeau wrote:
> I have a design question and maybe some of you might be able to help :
> 
>  
> 
> Here's my situation:
> 
>  
> 
> *     Client C1 connects to Server S1
> *     Session creation event propagates along the filter chain up to
> the ConnectFuture where I set the default session information such as
> server password
> *     S1 sends password prompt to C1
> *     One of C1 IoFilter handles the password handshake with the
> server.
> 
>  
> 
> Here's my problem:
> 
> I can only set connection credential (password) in the IoSession once it
> is created. I only know when it gets created through the callback
> mechanism with the ConnectFuture. Although at this point a TCP
> connection is established, since the password exchange hasn't yet taken
> place, my client cannot yet send an ordinary request to the server. So,
> how can I get notified at the session level that the password exchange
> has succeeded so that I can start sending ordinary requests. 
> 
>  
> 
> I was looking for some kind of custom Callback mechanism that I could
> implement but I didn't found any. I don't think I can trigger at the
> IoHandler level or the Filter level because I have many clients sharing
> those at the same time. I need something like the ConnectFuture that
> would be at the session level and would trigger when my password
> exchange will have succeeded.
> 
>  
> 
> Any ideas? I would really appreciate how you guys are solving this kind
> of issue.
> 
>  
> 
> Thanks,
> 
>  
> 
> Simon 
> 
>  
> 
-- 
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to