Hi ben
Thanks for your idea. In my case, I can't use it, since the generated img
tag must be a static file (a file: url) and not a link to a servlet. That's
why the processing must be when generating the html.
Thanks
Yair


-----Original Message-----
From: ben short [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 26, 2007 1:19 PM
To: Tomcat Users List
Subject: Re: multithreaded with taglibs

Yair,

I created a eshop website that dynamically re sizes images depending
on the url. Here is a simple outline of what happens.

A new product is created by the shop admin. Images are then uploaded
and stored in a database in the uploaded size.

When a product page is viewed the controller ( im using spring ) pulls
the product object from the db and passes it to the view, a jsp page.

The jsp then generates a image tag as show below.

<img width="175px" name="mainImage"
src="productimages/69_s_medium.jpg" title="Kitchen Stove and
Utensils"/>

The browser then renders the page, when it finds a image tag it then
uses another thread to load the image. this is standard browser
behavior.

The productimages url is mapped to another controller, that parses the
url. The first part of the url is the image id, the next part is tells
it that the part after that is a size rather than a dimension. The
controller knows the expected dimensions for a medium image.

The controller then pulls the image from the db and resizes it before
sending it to the browser. The controller is actually smarter than
that, and does on disk caching of resized images and check the last
mod time, but i wont detail that here.

So what is happening here is the browser is rendering the html created
by the jsp page and then making another request to get the images,
which is then making tomcat use another thread to generate the image.
Sound like what your trying to achieve?

Ben

On Nov 26, 2007 10:15 AM, David Cassidy <[EMAIL PROTECTED]> wrote:
> Errr
>
> how will you allow people to access the file over the internet with a
> file:// protocol ?
>
> are you only running the app and the users browser on the same machine ?
>
> file://C:\My Documents\image.gif
>
> ?
>
> Can't see that working over the internet....
>
>
>
> On Sun, 2007-11-25 at 13:56 +0200, Yair Ben-Meir wrote:
> > Thanks, but that's not good for me, I need the page to be with a real
file
> > link (file://), not through a servlet.
> >
> >
> > -----Original Message-----
> > From: Pid [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, November 25, 2007 11:53 AM
> > To: Tomcat Users List
> > Subject: Re: multithreaded with taglibs
> >
> > Yair Ben-Meir wrote:
> > > Let say that the tag will have to generate the image with a text given
as
> > an
> > > attribute, and it takes "time" so I want the page to continue:
> > >
> > > <my:img src="file" text="first"/>
> > >
> > > .
> > >
> > > <my:img src="file" text="first"/>
> >
> > Why are you doing this with a tag, rather than sending the parameter to
> > a servlet that serves an image into it's output stream?
> >
> > You exploit the browsers own request handling capabilities this way.
> >
> > <img src="/img-app/generate?param1=some+text+here" alt="an image" />
> >
> >
> > p
> >
> >
> >
> > > -----Original Message-----
> > > From: David Cassidy [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, November 22, 2007 6:08 PM
> > > To: Tomcat Users List
> > > Subject: Re: multithreaded with taglibs
> > >
> > > Hi
> > >
> > > What is your tag going to produce ?
> > > is it an <IMG SRC="....."> type tag ?
> > >
> > > or how are you allowing the browser to access the image ?
> > >
> > > Ta
> > >
> > > D
> > >
> > > On Thu, 2007-11-22 at 14:57 +0200, Yair Ben-Meir wrote:
> > >> Hi
> > >>
> > >> Is there a way to write a taglib that will do a multithreading work?
> > >> Meaning, that tomcatwill not wait till the first instance of the tag
> > >> will end, and continue to the rest of the page, and maybe start with
> > >> another instance, and than it will insert the result of each instance
> > >> in the right place?
> > >>
> > >>
> > >>
> > >> Example:
> > >>
> > >> <my:img name=""/>
> > >>
> > >> .
> > >>
> > >> <my:img name=""/>
> > >>
> > >>
> > >>
> > >> And let say that each my:img is supposed to download the image and
> > >> save it locally or something like that, and I don't want tomcat to
> > >> wait till the first tag is finished.
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> Thanks
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> Yair Ben-Meir
> > >>
> > >>
> > >>
> > >> Office: 073-7997801
> > >>
> > >> Fax:     073-7997800
> > >>
> > >> Mob:   054-5769681
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to