I am trying to configure an IoFilter Chain using Mina and Spring. My
FilterChain contains a StateMachine IoFilter. I would like to know how
to write an applicationContext.xml file to configure such a StateMachine
IoFilter.
 
Programmatically, I would do the following:
 
StateMachine sm =
StateMachineFactory.getInstance(IoFilterTransition.class).create(Passwor
dProtection.PASSWORD_AUTHENTICATION, new PasswordProtection());

 

        IoSessionStateContextLookup stateContextLookup = new
IoSessionStateContextLookup(new StateContextFactory() 

        {

            public StateContext create() 

            {

                return new
PasswordProtection.PasswordProtectionContext();

            }

        }, "passwordProtectionContext");

            

        StateMachineProxyBuilder proxyBuilder = new
StateMachineProxyBuilder();

        proxyBuilder.setStateContextLookup(stateContextLookup);

        proxyBuilder.setIgnoreUnhandledEvents(true);

        proxyBuilder.setIgnoreStateContextLookupFailure(true);

        IoFilter stateMachineIofilter =
proxyBuilder.create(IoFilter.class, sm);

 

So how should I go about configuring that in a Spring
applicationContext.xml file? I have looked at the chat example in mina
2.0 but it doesn't help much for such a particular case.

 

Your help is greatly appreciated,

 
Simon 
 

Reply via email to