Hello Grant,

I'm not sure I follow.  The problem isn't that it doesn't send chunked
> encoding.  It's that it thinks all JSON messages are chunked due to the
> JacksonRepresentation not setting the size value correctly.
>
Actually, using chunked encoding for representations is not a problem, and
as a feature of HTTP this must simply work.
Now, I must explain why, by design, a JacksonRepresentation is not required
to know the size of the representation to be generated. This applies also
for all extensions that automatically generates representation from beans
such as Xstream, etc.
Computing the size of the representation to be generated requires to store
the array of bytes in memory, before sending it to the socket. In case your
application handles a lot of hits, you can imagine the major inconvenient :
your JVM will surely crash because of an OutOfMemory exception or things
like that.
In order to avoid that, we consider to connect both tasks of writing of
bytes to the socket and consuming the bytes generated by the
JacksonRepresentation. This requires a little bit more calculations (using
buffers, etc) while lowering the memory footprint especially when
serializing big objects.

As, I'm not sure to be fluent enough in english, please feel free for more
details, or explanations.

I actually have an if clause in there to check whether to use SSL or not (I
> snipped it out of the msg b/c it didn't seem relevant.
> Would simply specifying HTTP or HTTPS automagically still do the right
> thing and pick the appropriate Netty service?
>
Yes, it must be automagic :) :
component.getServers().add(Protocol.HTTPS, port);

best regards,
Thierry Boileau

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2927988

Reply via email to