users@jersey.java.net

Writing a MessageBodyWriter

From: Erdinc Yilmazel <erdinc_at_yilmazel.com>
Date: Sun, 8 Mar 2009 01:21:43 +0000

I just wrote my first MessageBodyWriter. Unless I call the flush
method on the Writer that I created using the entityStream in the
writeTo method, I can't get any response from the server. It says the
content length is 0 when I look at the response headers even though I
set it to something else. If I call flush, everything works fine. Is
this the expected behavior? The javadoc of MessageBodyWriter states
that I should not close the output stream.

I am using Jersey 1.0.2 and deploying on Glassfish V3 Prelude.

Thanks