Simon Trudeau wrote:
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
I think it is doable but will be quite complex. In my project I'm using
a custom factory instead. In your case the factory would contain the
code above. Then you would call the static factory method from your
Spring config file to create the IoHandler or IoFilter implementation.
HTH
--
Niklas Therning
www.spamdrain.net