Here the filters are stored in a Spring
Map. But isn’t the order of the filters meaningful? Shouldn’t we
have to specify the order somewhere?
Trustin Lee [mailto:firstname.lastname@example.org]
Sent: 02 November 2005 01:22
Directory Developers List
Subject: Re: [mina] Spring
2005/11/2, Niklas Therning <email@example.com>:
I've played around a bit with getting Mina to work nicely with Spring.
Right now the Mina classes are quite Dependency Injection unfriendly.
But by implementing a few Spring FactoryBeans it is possible to make
Mina easily configurable using Spring, at least for my needs.
Basically what I want is to be able to define the filters used by my
SocketConnector and SocketAcceptor and, for the SocketAcceptor, also the
bindings. This is what it looks like in Spring XML:
<constructor-arg value="WorkerThread"/><!-- This
is the prefix used by
threads in the pool -->
<!-- My SocketAcceptor -->
Put all hosts to be blacklisted here. -->
<!-- Bind to port 1234 on 127.0.0.1 and use myHandler as the
<!-- My SocketConnector -->
<bean id="myHandler" class="MyHandler"/>
The only thing I've had to change in the original Mina code to make this
work is the "blacklist" property which have been added to the
SocketAcceptorFactoryBean will take care of binding and unbinding as the
Spring context is created and destroyed. No need for a ServiceRegistry
as I see it. Both SocketAcceptorFactoryBean and
SocketConnectorFactoryBean will add all configured filters to the end of
the filter chain.
WDYT? I will happily contribute this code back to the project if you
think it could be useful. The same could also be done for
Thank you so much for your continuous contribution! :D
We appreciate it, of course! Please submit your patch to JIRA and I'll
merge it as soon as I make MINA Maven multiproject.
what we call human nature is actually human habit