mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee" <trus...@gmail.com>
Subject Re: Question for intercepting the request and directly writing back in IoFilter
Date Wed, 27 Dec 2006 03:37:26 GMT
Hi Jian,

Sorry for being late.

On 12/7/06, jian wu <hellojianwu@gmail.com> wrote:
>
> I took a quick look in SSLFilter.java and wrote a simple
> program. It seems that in the IoFilter.messageReceived()
> method, we can simply intercept request and write back
> the response by doing:
> ==========================================
> public void messageReceived(
>   NextFilter nextFilter, IoSession session, Object message) {
>   // ... ...
>   WriteFuture writeFuture = new WriteFuture();
>   nextFilter.filterWrite( session,
>    new WriteRequest( heartbeatResponse, writeFuture ) );
> }
> ==========================================
>
> Is this a good practice? If Yes, I assume that the nextFilter
> passed in actually is bi-directional, on reading side upward
> and on writing side downward


Yep, it's bi-directional, and it's the way we write data in an IoFilter
implementation.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message