> Emmanuel Lecharny [mailto:[EMAIL PROTECTED] wrote
>
> Hi,

Hi!

I have already used them for some session specific initialization.

> those methods are called when a new filter is registred into the chain.
> However, the few filters implementing those methods typically check
> that
> the added filter is not already present in the chain :
>
> ProtocolCodecFilter, ExecutorFilter, KeepAliveFilter :
>     public void onPreAdd(IoFilterChain parent, String name,
>             NextFilter nextFilter) throws Exception {
>         if (parent.contains(this)) {
>             throw new IllegalArgumentException(
>                     "You can't add the same filter instance more than
> once.  Create another instance and add it.");
>
> but SslFilter does some intrigating things, which seems to me deserves
> to be found in a init() method.

An init() method doesn't know anything about the session so far.

> IMO, pre/post operation are just a bit too much. The way it should be
> done is :
> - init the filter
> - add/remove a filter from the chain

I can't imagine a good reason to use postAdd or preRemove, but a lot for preAdd 
and postRemove.

> and that's it.
>
> Anyone has a better vision of what those method are good for ?

They are good to initialize or cleanup session specific contexts.

regards

Steve

Reply via email to