You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Denis McCarthy <dm...@annadaletech.com> on 2007/01/25 11:23:23 UTC

Aspects in tapestry pages using spring

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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: IMonitor deprecated?

Posted by Jesse Kuhnert <jk...@gmail.com>.
Don't know. Never used it before. What do you use it for now?

On 1/27/07, munich@fantasymail.de <mu...@fantasymail.de> wrote:
> "To be removed in 4.1 with no direct replacement."
>
> So what do you do with old Tapestry applications that use it?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


IMonitor deprecated?

Posted by mu...@fantasymail.de.
"To be removed in 4.1 with no direct replacement."

So what do you do with old Tapestry applications that use it?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Aspects in tapestry pages using spring

Posted by Denis McCarthy <dm...@annadaletech.com>.
Thanks for that James - using a filter is a better approach than aspectj 
in this instance. I'm not too hot on hivemind. Is there any service 
point or extension I can use to get the current page's name? I have a 
request filter for implementing the open session in view filter in 
hibernate already, and I can get the actual URL from the 
WebRequest.getPathInfo() method, but I'm not sure how to get the page 
class name itself. Any idea for how to get this using hivemind?
Thanks a lot for your help
Denis

James Carman wrote:
> Well, it depends on your pointcut, I guess.  If it can be woven into
> your code properly, you don't need to recompile Tapestry.  However,
> you might want to look into putting an interceptor on the page service
> or introducing a web request servicer filter.  That's an easy way to
> do cross-cutting concerns.
> 
> On 1/26/07, Denis McCarthy <dm...@annadaletech.com> wrote:
>> 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 <dm...@annadaletech.com> 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: users-unsubscribe@tapestry.apache.org
>> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >>
>> >> >>
>> >> >>
>> >> > --
>> >> > Ivano Pagano
>> >> >
>> >> >
>> >> >
>> >> 
>> ------------------------------------------------------------------------
>> >> >
>> >> > 
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink deprecated?

Posted by Jesse Kuhnert <jk...@gmail.com>.
protected ILink getLink(cycle, parameter)

as documented in IEngineService .

On 1/27/07, munich@fantasymail.de <mu...@fantasymail.de> wrote:
> Deprecated. To be removed in 4.1
>
> protected ILink getLink(IRequestCycle cycle, String serviceName, Object parameter)
>
> What is the replacement for the method above?
>
> Tanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Limit the number of clicks per second inside Tapestry

Posted by mu...@fantasymail.de.
Thanks for the input!

It is primarily intended to get rid auf Apache modules that did that before and to be more flexible in using that information.

Search engines crawlers can usually slow down a website a lot - or experimental crawlers by university students etc....or malicious webcrawlers or people who download your website for offline viewing. 
I think restricting it to 1 page view per second would be enough - certain ip addresses could get a higher "bandwidth".

Instead of sending them to an error page, however, I would just let the request time out.....

The good thing would be you could write your own profiling application and log those ipaddresses and clients that are bandwidth hungry....

The only question is, whether such a Tapestry implementation would be efficient or not....maybe this would consume too much memory itself if there are many visitors on a website?


-------- Original-Nachricht --------
Datum: Sat, 27 Jan 2007 20:38:30 -0800
Von: "Patrick Moore" <tr...@gmail.com>
An: "Tapestry users" <us...@tapestry.apache.org>
Betreff: Re: Limit the number of clicks per second inside Tapestry

> I would hazard a guess that it would be useful to stop automated spam
> entries in blogs and automated sign-up by robots.....
> 
> anything that goes faster than a human could go could be throttled....
> 
> 
> On 1/27/07, Howard Lewis Ship <hl...@gmail.com> wrote
> >
> >
> >
> > I'd love to know what your underlying use-case is.
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Limit the number of clicks per second inside Tapestry

Posted by Patrick Moore <tr...@gmail.com>.
I would hazard a guess that it would be useful to stop automated spam
entries in blogs and automated sign-up by robots.....

anything that goes faster than a human could go could be throttled....


On 1/27/07, Howard Lewis Ship <hl...@gmail.com> wrote
>
>
>
> I'd love to know what your underlying use-case is.
>
>

Re: Limit the number of clicks per second inside Tapestry

Posted by Howard Lewis Ship <hl...@gmail.com>.
I believe you could create a filter (in Tapestry 4) that could
intercept requests and work with a session-based object.  The session
object would need to keep a list of timestamps of recent accesses.
With this, it could determine if a user has slipped over your
threshold, at which point you could, say, redirect the user to a
static HTML page warning them of their transgression.

These filters can be added to Tapestry's WebRequestProcessor pipeline.

I'd love to know what your underlying use-case is.

On 1/27/07, munich@fantasymail.de <mu...@fantasymail.de> wrote:
> If I want to limit the number of clicks page views per second for every user,
> how would I do that inside Tapestry?
>
> Would that go into the BaseEngine ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Limit the number of clicks per second inside Tapestry

Posted by mu...@fantasymail.de.
If I want to limit the number of clicks page views per second for every user,
how would I do that inside Tapestry?

Would that go into the BaseEngine ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


ActionLink deprecated?

Posted by mu...@fantasymail.de.
Deprecated. To be removed in 4.1

protected ILink getLink(IRequestCycle cycle, String serviceName, Object parameter)

What is the replacement for the method above?

Tanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Aspects in tapestry pages using spring

Posted by James Carman <ja...@carmanconsulting.com>.
Well, it depends on your pointcut, I guess.  If it can be woven into
your code properly, you don't need to recompile Tapestry.  However,
you might want to look into putting an interceptor on the page service
or introducing a web request servicer filter.  That's an easy way to
do cross-cutting concerns.

On 1/26/07, Denis McCarthy <dm...@annadaletech.com> wrote:
> 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 <dm...@annadaletech.com> 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: users-unsubscribe@tapestry.apache.org
> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >> >>
> >> >>
> >> >>
> >> > --
> >> > Ivano Pagano
> >> >
> >> >
> >> >
> >> ------------------------------------------------------------------------
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Aspects in tapestry pages using spring

Posted by Denis McCarthy <dm...@annadaletech.com>.
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 <dm...@annadaletech.com> 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: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >>
>> > --
>> > Ivano Pagano
>> >
>> >
>> > 
>> ------------------------------------------------------------------------
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Aspects in tapestry pages using spring

Posted by James Carman <ja...@carmanconsulting.com>.
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 <dm...@annadaletech.com> 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: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >>
> > --
> > Ivano Pagano
> >
> >
> > ------------------------------------------------------------------------
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Aspects in tapestry pages using spring

Posted by Denis McCarthy <dm...@annadaletech.com>.
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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
> -- 
> Ivano Pagano
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Aspects in tapestry pages using spring

Posted by Ivano <i....@mclink.it>.
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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
Ivano Pagano