« Return to Thread: help with DWR returning large string from server to Browser

Re: help with DWR returning large string from server to Browser

by David Marginian-2 :: Rate this Message:

Reply to Author | View in Thread

Bingjin,
   This is not really a DWR issue it is a browser issue.  The fact is
all DWR can do is send data to the browser and set the value on a text
field.  Browser's were simply not designed to handle large amounts of
data.  To illustrate this try creating a simple html file with a
textarea field.  Dump 1.5 megs of static data into the textarea and see
how the browser reacts.  IE will choke for several seconds.  There is
more overhead when using DWR (because we have the data in memory and
have to set the textarea's value). which is why it is slower but not
much can be done about that.

   Whenever you think you need to display this much data in the browser
you probably need to re-think your design.  I don't know your specific
situation but chances are you don't need to display the entire log
file.  I would create a list box on the page with several options (last
500, last 1000, last 1500, first 500, first 1000, etc.) and allow the
user to choose a value.  Then I would read the log file according to the
options selected and only return the data read.  I would limit the
options to those that perform reasonably well.  I have done this before
in a similar situation (displaying log files).


Bingjin He (bihe) wrote:

> Hi There,
> I am using DWR to return JAVA object to javascript. In this case, I am
> reading from a log file, and return the log contents to be dispalyed
> in the textarea inside a browser. I have no problem with this approach
> when the log file size is small. But when the size is big(~1M), my
> browser hangs. I suspect DWR can not handle returning big size object
> from Java to browser. Can anyone confirm this and suggest alternatives?
>  
> thanks in advance
> --bingjin


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...

 « Return to Thread: help with DWR returning large string from server to Browser