You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Pierre-Louis Bonicoli <pb...@anevia.com> on 2007/07/09 18:04:57 UTC

RequestResponseFilter example based on ProtocolCodecFilter tutorial

Hi,
I have modified the 'imagine' example from tutorial about 
ProtocolCodecFilter :
i add a RequestResponseFilter (on the ImageClient side) : now an 
ImageRequest specify the number of ImageResponse to receive.

The flow is now :
ImageRequest --(encode)--> network --(decode)--> ImageRequest -> 
ImageResponse--(encode)
--> network--(decode)-->ImageResponse is PARTIAL or PARTIAL_LAST

The number of total response to receive for each request ID is stored in 
an IoSession attribute and the number of response received too.
I'll be happy if this example can help someone.

Apply the patch :
1) mkdir test ; cd test ; wget 
http://mina.apache.org/tutorial-on-protocolcodecfilter.data/mina-codec-tutorial-src.zip
2) unzip mina-codec-tutorial-src.zip
3) copy the patch here
4) Apply the patch : patch -p1 < imagine.patch

Building
5) cd src/org/apache/mina/example/imagine/
6) export JAVA_HOME=/usr/lib/jvm/java-6-sun
7) ant

Execute
7) /usr/lib/jvm/java-6-sun/bin/java -classpath 
./build:.:${HOME}/mina_trunk/mina/core/target/classes 
org.apache.mina.example.imagine.server.ImageServer
8) /usr/lib/jvm/java-6-sun/bin/java -classpath 
./build:.:${HOME}/mina_trunk/mina/core/target/classes 
org.apache.mina.example.imagine.client.ImageClient

(you should adapt paths)

Any remarks are welcome.
Please let me know if you find any errors and if comments are needed, 
please notify me :)

Pierre



Re: RequestResponseFilter example based on ProtocolCodecFilter tutorial

Posted by Trustin Lee <tr...@gmail.com>.
Hi Pierre-Louis,

On 7/10/07, Pierre-Louis Bonicoli <pb...@anevia.com> wrote:
> Hi,
> I have modified the 'imagine' example from tutorial about
> ProtocolCodecFilter :
> i add a RequestResponseFilter (on the ImageClient side) : now an
> ImageRequest specify the number of ImageResponse to receive.
>
> The flow is now :
> ImageRequest --(encode)--> network --(decode)--> ImageRequest ->
> ImageResponse--(encode)
> --> network--(decode)-->ImageResponse is PARTIAL or PARTIAL_LAST
>
> The number of total response to receive for each request ID is stored in
> an IoSession attribute and the number of response received too.
> I'll be happy if this example can help someone.
>
> Apply the patch :
> 1) mkdir test ; cd test ; wget
> http://mina.apache.org/tutorial-on-protocolcodecfilter.data/mina-codec-tutorial-src.zip
> 2) unzip mina-codec-tutorial-src.zip
> 3) copy the patch here
> 4) Apply the patch : patch -p1 < imagine.patch
>
> Building
> 5) cd src/org/apache/mina/example/imagine/
> 6) export JAVA_HOME=/usr/lib/jvm/java-6-sun
> 7) ant
>
> Execute
> 7) /usr/lib/jvm/java-6-sun/bin/java -classpath
> ./build:.:${HOME}/mina_trunk/mina/core/target/classes
> org.apache.mina.example.imagine.server.ImageServer
> 8) /usr/lib/jvm/java-6-sun/bin/java -classpath
> ./build:.:${HOME}/mina_trunk/mina/core/target/classes
> org.apache.mina.example.imagine.client.ImageClient
>
> (you should adapt paths)
>
> Any remarks are welcome.
> Please let me know if you find any errors and if comments are needed,
> please notify me :)

I'm very surprised that you used RequestResponseFilter without any
help.  I'd like to apologize any problems you might have experienced
while creating this patch because of my laziness.  I had to write a
tutorial long time ago.

Thank you for your contribution, and let me review and apply it.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6