Thanks for that James. I've got the aspectj stuff working now. The
reason why I've been looking into aspectj is to log the length of time
users of my site spend on individual pages. I want to log when each page
is rendered for a particular user's session, giving me a record of how
long a user spent on any individual page (this information is important
to me because the application is a touch-screen application, and if any
screen is slowing down or frightening users away because of its
complexity I want to know about it)
As this is a stereotypical cross-cutting concern, I've been looking for
a nice way to log this using tapestry's own internals. However, if I
understand aop correctly I'll have to compile tapestry itself using ajc
with my aspect to weave the aspect into the tapestry code. This could be
a little over the top - I'm wondering is there some less invasive way to
record page loads per session without resorting to copying and pasting
the same code into every page to accomplish this? Is there something in
hivemind that'll allow me to record this information?
Thanks
Denis
James Carman wrote:
> 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]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]