Something like this:

<action name="personImage"
class="com.secmgmt.struts2.actions.getpic.StreamImageAction">
                        <result name="success" type="stream">
                                <param name="contentType">image/jpeg</param>
                                <param name="inputName">inputStream</param>
                                <param
name="contentDisposition">filename="image.jpg"</param>
                                <param name="bufferSize">1024</param>
                        </result>
</action>


And you do your HREF like this:

<img width="200" src="<s:url action='personImage'><s:param name='id'
value='person.id'/></s:url>" alt="No Image Found"/>

Just have your SteamImageAction increment some sort of counter, or record
the request, and have a getInputStream() method that returns an open input
stream with the image file on the other end...

M.

-----Original Message-----
From: Andrew Davidson [mailto:a...@santacruzintegration.com] 
Sent: Thursday, April 30, 2009 1:23 PM
To: 'Tomcat Users List'
Subject: RE: looking for a web usesage / analytics package

Hi Hassan

I would never have thought to create a servlet that returns the image. This
is a great idea.

Thanks

Andy

> -----Original Message-----
> From: Hassan Schroeder [mailto:hassan.schroe...@gmail.com]
> Sent: Wednesday, April 29, 2009 3:54 PM
> To: Tomcat Users List
> Subject: Re: looking for a web usesage / analytics package
> 
> On Wed, Apr 29, 2009 at 3:24 PM, Andrew Davidson
> <a...@santacruzintegration.com> wrote:
> 
> > My problem is that I need to create a tracking jpg. I need a way to
> count
> > the number of times this image is loaded.
> 
> If that's all, why not just write a Filter to grab each request and stuff
> the relevant data in a DB? Or alternatively, why isn't the "image" just
> a servlet that returns the graphic part and records the request?
> 
> Either one would give you records you could post-process in a variety
> of ways...
> 
> FWIW,
> --
> Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to