On Wed, 2007-08-15 at 09:16 -0400, [EMAIL PROTECTED] wrote:
> Hi Oleg,
>
> When I use code like that, it works, but it runs slowly on server, 5-10
> seconds to read whole xml.
>
> Code of server:
>
> String dealWithPayload(HttpServletRequest req)
> {
> char[] buf = null;
> try
> {
> buf = new char[req.getContentLength()];
>
> req.getReader().read(buf);
> }
> catch (IOException e)
> {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> return new String(buf);
> }
>
> Thanks again.
>
> Jacky
>
Jacky
This is a horribly inefficient way of reading input streams. Not to
mention this code will not work for chunk-coded entities where the
length of the incoming content may be unknown (req.getContentLength()
returns -1).
Oleg
>
>
> *********************************************************************
> The information in this e-mail is intended solely for the addressee(s)
> named, and is confidential. Any other distribution, disclosure or
> copying is strictly prohibited. If you have received this communication
> in error, please reply by e-mail to the sender and delete or destroy all
> copies of this message.
>
> Les renseignements contenus dans le pr'esent message 'electronique sont
> confidentiels et concernent exclusivement le(s) destinataire(s)
> 'esign'e(s). Il est strictement interdit de distribuer ou de copier ce
> message. Si vous avez recu ce message par erreur, veuillez r'epondre
> par courriel `a l'exp'editeur et effacer ou d'etruire toutes les copies du
> pr'esent message..
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]