You can also use AspectJ within Tapestry using hivemind-aspectj (at
JavaForge).  You still have to make sure you weave the aspects into
your code, but hivemind-aspectj can inject HiveMind services into your
singleton (the default) AspectJ aspects.  That way, you can inject all
of Tapestry's HiveMind goodies into your aspects in case you need them
(which you probably will).  If you want more information, email me
back and I'll see if I can give you an example (the test cases are
quite slim, but they do show how it's used).

On 1/26/07, Denis McCarthy <[EMAIL PROTECTED]> wrote:
Thanks for that - I'm on the right track now. I'm now looking for a
tapestry method to advise, one that invariably fires once and only per
request. Is there such a method?
Thanks
Denis

Ivano wrote:
> Once you have accomplished the task (a), the task (b) can be solved as
> follows.
>
> You need to define the aspect as a SpringBean  (only in spring 2, of
> course) using something like:
>
> <bean id="yourAspect" class="your.company.aspects.AspectClass"
>        factory-method="aspectOf" lazy-init="false">
>        <property name="yourDatasource" ref="myDataSourceBeanId"/>
> </bean>
>
> in your applicationContext.xml file.
>
> Then you need to weave your project classes with the aspect you made
> (e.g. configuring Eclipse to do it if you use that.).
> Don't forget to deploy the aspect class with your application.
>
> Denis McCarthy wrote:
>
>> Hi,
>> I want to log the time users spend on individual pages in tapestry to
>> a database. I'm thinking the best way to do this may be to define an
>> aspect (using aspectj) on the attach() method for each page. I'm using
>> spring for the business/dao layers. As the tapestry pages are not
>> themselves defined in the spring application context I'm having a hard
>> time coming up with a suitable aspect that can be
>> a) defined to run on all attach() methods in any class that extends
>> BasePage, and
>> b) into which I can inject the spring bean which provides an interface
>> to the database where the logs must be stored.
>> I can accomplish a) by using a simple aspectj aspect, and b) by using
>> a spring defined aspect, but I'm not sure how to accomplish both at once.
>>
>> Am I overlooking something stupid?
>> Thanks
>> Denis
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
> --
> Ivano Pagano
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to