directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Therning <>
Subject Re: [mina] Spring integration
Date Mon, 07 Nov 2005 19:50:32 GMT
Trustin Lee wrote:

> Hi Niklas,
> 2005/11/2, Niklas Therning <
> <>>:
>     Personally I would like to see Mina becoming more DI friendly
>     without having
>     to resort to Spring specific FactoryBeans. I will take a look at
>     the code to
>     see what would have to be refactored. Most of what I've seen so
>     far only
>     requires trivial changes (like the setBlacklist() method in the
>     BlacklistFilter class). FilterChains on the other hand will be a
>     bit harder
>     I think.
> It  would be great if we can, but do you have any idea how we can
> provide getter and setters for bind and connect operations?  Please
> let me know do you have any ideas.

For bind one idea is to have a Binding class which simply maps a
SocketAddress to an IoHandler. setBindings would take an array of
Binding objects:

public void setBindings(Binding[] bindings)

I don't think it would be necessary to provide something similar for
connect since connect is something you do programmatically at runtime.
Please correct me if I'm wrong.

BTW, I have some refactoring suggestions regarding binding. Let's say I
have an HTTP IoHandler implementation and I want to support both SSL and
non SSL traffic. Right now there's no way for me to use a single
SocketAcceptor and say that traffic coming in on port 80 should not go
through an SSLFilter while traffic coming on port 443 should. It would
be cool if this would be possible. To be able to do this right now I
would either have to use two SocketAcceptors, one for 80 and one for
443, which have different filter chains or add logic in my IoHandler to
add the SSLFilter to its filter chain if the client came in on port 443
(I guess a custom filter could also do this).

So, I would like to have a bind method which takes a triplet:

bind(SocketAddress address, IoFilterChain filterChain, IoHandler handler)

There would still be a root filter chain on the IoAcceptor which would
be called before the extra chain associated with the port.


> For BlacklistFilter, I thought your Spring integration patch already
> contains it.  If it's not ready, I'll check in the fix.  Please let me
> know.
The patch for BlacklistFilter isn't included in the Spring integration
patch I just uploaded to JIRA. The blacklist setter looks like this:

+    public void setBlacklist( InetAddress[] addresses )
+    {
+        blacklist.clear();
+        for( int i = 0; i < addresses.length; i++ )
+        {
+            blacklist.add( addresses[i] );
+        }
+    }

Please add it if you think it looks ok.


View raw message