Re: how to render visad display as image

Hello, Amaral,

Strictly seen, your question doesn't have anything to do with VisAD, except that VisAD and Servlets are written in Java.

But I'll try to point you to the right direction...

Amaral wrote:
Hi, anybody
I would appreciate some help in the following problem: a) my servlet gets data samples from the user and returns jpeg images of visad displays. The servlet handles the samples to a visad class; b) The visad class makes a x-y display and generates an image file jpeg in the http server from the visad display;
c) my servlet redirects the user to an html filhe that display the jpg file.
Questios: 1. How can I make each call to the servlet delete the old file and replace it by the new one:

If you're saving your image in first place, then you only have to keep saving on the same file again and again, thus avoiding the need to delete the file.

I know, however, that sometimes the new page doesn't show the updated image. This is because your servlet hasn't fully saved the file to disk, but has already flushed the html stuff down the line.

You either write some code to wait for the image to be ready (put a lock somewhere, but don't ask me how) OR (and that's what I've done) send the image, and only the image, down the servlet output stream.

For that you'll need to set the content type to image/jpg, but that's beyond the scope of this list.

2. Except for using applets which would delay a lot, is the another way to work the problem.
Thanks. amaral



  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: