dcsimg
How to serve PNG content (w/o writing to disk) ?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Denis_Ballant
Posted On:   Friday, September 12, 2003 06:58 AM

Hi, Is there any way to generate PNG image content over the web without requiring the creation of a file on the web server file system ? The problem with files being created on the server file system is that you need to clean them when they are no longer going to be used ? Or they fill up the available disk space. I'm planning to use Tomcat on the server side. The java app shall generate images dynamically. I guess that the image data could be served directly to the client without first writing it to a temporary file on disk. Is that right ? Thanks for your help. Denis Ballant    More>>

Hi,


Is there any way to generate PNG image content over the web without requiring the creation of a file on the web server file system ?


The problem with files being created on the server file system is that you need to clean them when they are no longer going to be used ? Or they fill up the available disk space.


I'm planning to use Tomcat on the server side. The java app shall generate images dynamically. I guess that the image data could be served directly to the client without first writing it to a temporary file on disk. Is that right ?


Thanks for your help.


Denis Ballant

   <<Less

Re: How to serve PNG content (w/o writing to disk) ?

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, September 12, 2003 10:17 AM

Depending on the method you use to generate the content, it might be able to write to an OutputStream? and if so, you can give it your servlet.getOutputStream()..... but you will have to set the content-type first, and hmm, the content-length too, that could be a problem...


Or, perhaps you could write the content to a temp file (http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#createTempFile(java.lang.String, java.lang.String)), that gets automatically deleted ....

Re: How to serve PNG content (w/o writing to disk) ?

Posted By:   Adrian_K  
Posted On:   Friday, September 12, 2003 07:38 AM

Possible...yes its possible...some sites (Yahoo i.e.) use this behaviour in order to authenticate users that fails many times when they try to login....One posibility is use a 'PrintWriter' setting previously the appropiated mime/type"...
About | Sitemap | Contact