3.0 beta 2

how to push an automatically refreshed BufferedImage generated in a servlet into the browser?

I am involved in an application that generates a BufferedImage .A servlet is doing the process.i want to refresh the image every 1 minute.for this i am using some infinite while loop and suspending the servlet every i minute.i have to push this refreshed image into the browser.this has to be done with javascript.how is this possible? if anyone has any idea please tell me.Thanks in Advance
July 8,
maybe u can try this:

var imageRequest = new AW.HTTP.Request;
imageRequest.response = function(xml) {
     // get the src of new image generated
     // like: /images/image_0048448464849849.gif
     var resolver = xml.createNSResolver( xml.ownerDocument == null ? xml.documentElement : xml.ownerDocument.documentElement));
      var value = xml.evaluate('//root//imageSRC', xml, resolver, XPathResult.ANY_TYPE, null).stringValue;
      example XML
     // create new image
     var im = new Image();
     im.src = value;
     // set new image
     document.getElementById('myImage').src = im.src;
     // done
<img src='/images/blank.jpg' id='myImage' name='myImage'>

U can't return the bytes in browsser, because u need SRC for image, u can't do nothing with bytes.
Paulo Cesar Silva Reis (PC from Brazil).
July 8,
or maybe u can write in response setting the content type, like:


And set the IMG SRC to servlet, to refresh u can re-set the src like:
document.getElementById("image").src =  document.getElementById("image").src+"?"+new Date().getTime();

hope this help.
Paulo Cesar Silva Reis (PC from Brazil).
July 8,

This topic is archived.

See also:

Back to support forum


Version 2

Looking for AW 2.6 ?
The old site is here.