i am a bit afraid for using that method that way...
Because that could be pretty heavy.. Encoding is not a cheap operation
and it will generate a byte array that also can be very big.
And then suddenly if we still use PrintWriter we are encoding it twice...
Maybe we should do this:
byte[] bytes = string.getBytes(encoding);
response.setContentLenght(bytes.lenght);
response.setContentType(encoding);
OutputStream os = response.getOutputStream();
Streams.copy(os,bytes);
os.close();
Maybe i can improve it even more by just doing that encoding conversion
earlier (so not after the redirect but before the redirect and only
store the byte[]
that could be cheaper :) for strings that only take most of the time 1 byte)
johan
Janne Hietamäki wrote:
Jan Bares wrote:
You cannot calculate size of the string in bytes? I am not Java
expert, but this must be easy.
Size of the string in bytes is string.getBytes(encoding).length;
Most frameworks don't set the content length, even if it's really bad
for http keep-alive.
Janne
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user