tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alexis" <alz...@gmail.com>
Subject Re: storing images
Date Fri, 06 May 2011 01:32:40 GMT
Yes for the ajax.

If im getting it well, i have no need to tie the user with an image instance. image1 is the
same for every users.

Isnt servletcontext shared within the webapp? Meaning that every session access the same servletcontext?

Regards

Enviado desde blackberry

-----Original Message-----
From: Martin Gainty <mgainty@hotmail.com>
Date: Thu, 5 May 2011 21:26:12 
To: Tomcat Users List<users@tomcat.apache.org>
Reply-To: "Tomcat Users List" <users@tomcat.apache.org>
Subject: RE: storing images


achieved if you correspond the userid-imageid parameter with the acquired image identifier
e.g.
?code=1.1 puts user1 image 1 on servlet and returns <img src=servlet?get=1.1>
 ?code=1.2 puts user1 image 2 on servlet and returns <img src=servlet?get=1.2>
 ?code=2.1 puts user2 image 1 on servlet and returns <img src=servlet?get=2.1>

are you using XMLHTTPRequest for ajax ?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.




> Subject: Re: storing images
> To: users@tomcat.apache.org
> From: alzrck@gmail.com
> Date: Fri, 6 May 2011 00:19:06 +0000
> 
> 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.
> 
> 
> Regards
> 
> 
> Enviado desde blackberry
> 
> -----Original Message-----
> From: Christopher Schultz <chris@christopherschultz.net>
> Date: Thu, 05 May 2011 20:00:57 
> To: Tomcat Users List<users@tomcat.apache.org>
> Reply-To: "Tomcat Users List" <users@tomcat.apache.org>
> Subject: Re: storing images
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Alexis,
> 
> 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk3DOjkACgkQ9CaO5/Lv0PDzmgCeK2tN3eH+aVY6ElmFiKRe+cj7
> WZcAn0Yj9qSklAynFdBeyRsL/wl0TpWD
> =41U2
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  
Mime
View raw message