tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alexis" <>
Subject Re: storing images
Date Fri, 06 May 2011 00:19:06 GMT
What i did (im testing and profiling it) is.

As the images are around 10/12 and each image has around 30 to 35k.

Im storing the images as servletcontext attribute.

So calling to the servlet with ?code=1 builds and stores image1 on servlet context. And returns
html with <img src=servlet?get=1>

So ajax sends that to the jsp that calls servlet?get and that returns the image.

It's working now, what im profiling is to verify no matter how many users are requesting images,
image1 is the same for every user and if one user builds up the image again, all others gets
the new one.

As those images are stored on servletcontext, all are shared among the webapp so images are
not duplicated or triplicated or n-cated.

I dont know if it's a good solution, but up to know it's working and really fast.


Enviado desde blackberry

-----Original Message-----
From: Christopher Schultz <>
Date: Thu, 05 May 2011 20:00:57 
To: Tomcat Users List<>
Reply-To: "Tomcat Users List" <>
Subject: Re: storing images

Hash: SHA1


On 5/5/2011 2:19 PM, alexis wrote:
> I have a servlet that basically does
> . creates an image
> . store the image on disk
> . returns an html <img> tag pointing to the stored image.
> there's no way to return binary content (the image) from the servlet to the ajax script.

What about JSON? Not that I think it's a terribly good idea, but it's
just a thought.

Another thought is possibly using a database, relational or otherwise,
rather than the file system. Of course, you'd have to write your own
servlet to access the image from the database instead of the filesystem,
so I'm not sure it buys you much over the other solutions presented already.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message