You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mh...@recommind.com> on 2008/07/01 17:48:29 UTC

access names of called actions and beans

What's the best approach to output the name of the called
action/actionListener and the name of the corresponding managed beans ?

I want to use a ServletFilter to measure the times for http requests and
print out these names.

Is there anything generic available via FacesContext? I do not want to
touch every  managed bean.

 

Or do I have to overwrite org.apache.myfaces.el.MethodBindingImpl in
order to store the names in requestscope in the "invoke" method?

 

Michael


Re: access names of called actions and beans

Posted by "simon.kitching@chello.at" <si...@chello.at>.
simon.kitching@chello.at schrieb:
> Michael Heinen schrieb:
>> Hi Rafa,
>>
>> how does this global ActionListener work?
>> I defined one in the faces-config and it's processAction method is 
>> called.
>> But the action/actionListener of my commands are not executed anymore!
>>   
> It's like all the other pluggable JSF classes. If you replace the 
> standard implementation, then you need to either provide a complete 
> implementation (no stub methods), or you need to delegate to a 
> complete implementation.
>
> So in your case, you need a constructor that takes an ActionListener 
> instance, and save it away. Then in other methods, delegate to the 
> object that was passed to the constructor.
>
> See the jsf spec for more details.

Sorry, please ignore my email. I was thinking of a different class.


Re: access names of called actions and beans

Posted by "simon.kitching@chello.at" <si...@chello.at>.
Michael Heinen schrieb:
> Hi Rafa,
>
> how does this global ActionListener work?
> I defined one in the faces-config and it's processAction method is called.
> But the action/actionListener of my commands are not executed anymore!
>   
It's like all the other pluggable JSF classes. If you replace the 
standard implementation, then you need to either provide a complete 
implementation (no stub methods), or you need to delegate to a complete 
implementation.

So in your case, you need a constructor that takes an ActionListener 
instance, and save it away. Then in other methods, delegate to the 
object that was passed to the constructor.

See the jsf spec for more details.

Regards, Simon


Re: access names of called actions and beans

Posted by Rafa Pérez <ra...@gmail.com>.
You may extend org.apache.myfaces.application.ActionListenerImpl and
implement javax.faces.event.ActionListener. That way, you can call
super.processAction(actionEvent).

HTH,

Rafa

On Wed, Jul 2, 2008 at 10:38 AM, Michael Heinen <mh...@recommind.com> wrote:
> Hi Rafa,
>
> how does this global ActionListener work?
> I defined one in the faces-config and it's processAction method is called.
> But the action/actionListener of my commands are not executed anymore!
>
> Michael
>
> -----Original Message-----
> From: Rafa Pérez [mailto:rajalin@gmail.com]
> Sent: Mittwoch, 2. Juli 2008 08:29
> To: MyFaces Discussion
> Subject: Re: access names of called actions and beans
>
> You can declare your own global ActionListener in faces-config.xml.
> Every time an action/actionListener is executed, this class will be
> called.
>
> On Tue, Jul 1, 2008 at 9:46 PM, Richard Yee <ri...@gmail.com> wrote:
>> If you are using Spring, you can also easily do it with AOP.
>>
>> -Richard
>>
>> On Tue, Jul 1, 2008 at 12:23 PM, Stephen Friedrich <tr...@eekboom.com>
>> wrote:
>>>
>>> I think it's not really feasible with a servlet only, but an interceptor
>>> can easily do it.
>>> See the posts in this thread for a working example:
>>>
>>> http://seamframework.org/Community/SeamPerformanceProblemRewardingWorkaround
>>>
>>> There's a little bit more configuration to do when you are not using Seam,
>>> but not too complicated either way.
>>>
>>> Michael Heinen wrote:
>>>>
>>>> What's the best approach to output the name of the called
>>>> action/actionListener and the name of the corresponding managed beans ?
>>>>
>>>> I want to use a ServletFilter to measure the times for http requests and
>>>> print out these names.
>>>>
>>>> Is there anything generic available via FacesContext? I do not want to
>>>> touch every  managed bean.
>>>>
>>>>
>>>> Or do I have to overwrite org.apache.myfaces.el.MethodBindingImpl in
>>>> order to store the names in requestscope in the "invoke" method?
>>>>
>>>>
>>>> Michael
>>>>
>>>
>>
>>
>
>

RE: access names of called actions and beans

Posted by Michael Heinen <mh...@recommind.com>.
Hi Rafa,

how does this global ActionListener work?
I defined one in the faces-config and it's processAction method is called.
But the action/actionListener of my commands are not executed anymore!

Michael

-----Original Message-----
From: Rafa Pérez [mailto:rajalin@gmail.com] 
Sent: Mittwoch, 2. Juli 2008 08:29
To: MyFaces Discussion
Subject: Re: access names of called actions and beans

You can declare your own global ActionListener in faces-config.xml.
Every time an action/actionListener is executed, this class will be
called.

On Tue, Jul 1, 2008 at 9:46 PM, Richard Yee <ri...@gmail.com> wrote:
> If you are using Spring, you can also easily do it with AOP.
>
> -Richard
>
> On Tue, Jul 1, 2008 at 12:23 PM, Stephen Friedrich <tr...@eekboom.com>
> wrote:
>>
>> I think it's not really feasible with a servlet only, but an interceptor
>> can easily do it.
>> See the posts in this thread for a working example:
>>
>> http://seamframework.org/Community/SeamPerformanceProblemRewardingWorkaround
>>
>> There's a little bit more configuration to do when you are not using Seam,
>> but not too complicated either way.
>>
>> Michael Heinen wrote:
>>>
>>> What's the best approach to output the name of the called
>>> action/actionListener and the name of the corresponding managed beans ?
>>>
>>> I want to use a ServletFilter to measure the times for http requests and
>>> print out these names.
>>>
>>> Is there anything generic available via FacesContext? I do not want to
>>> touch every  managed bean.
>>>
>>>
>>> Or do I have to overwrite org.apache.myfaces.el.MethodBindingImpl in
>>> order to store the names in requestscope in the "invoke" method?
>>>
>>>
>>> Michael
>>>
>>
>
>


Re: access names of called actions and beans

Posted by Rafa Pérez <ra...@gmail.com>.
You can declare your own global ActionListener in faces-config.xml.
Every time an action/actionListener is executed, this class will be
called.

On Tue, Jul 1, 2008 at 9:46 PM, Richard Yee <ri...@gmail.com> wrote:
> If you are using Spring, you can also easily do it with AOP.
>
> -Richard
>
> On Tue, Jul 1, 2008 at 12:23 PM, Stephen Friedrich <tr...@eekboom.com>
> wrote:
>>
>> I think it's not really feasible with a servlet only, but an interceptor
>> can easily do it.
>> See the posts in this thread for a working example:
>>
>> http://seamframework.org/Community/SeamPerformanceProblemRewardingWorkaround
>>
>> There's a little bit more configuration to do when you are not using Seam,
>> but not too complicated either way.
>>
>> Michael Heinen wrote:
>>>
>>> What's the best approach to output the name of the called
>>> action/actionListener and the name of the corresponding managed beans ?
>>>
>>> I want to use a ServletFilter to measure the times for http requests and
>>> print out these names.
>>>
>>> Is there anything generic available via FacesContext? I do not want to
>>> touch every  managed bean.
>>>
>>>
>>> Or do I have to overwrite org.apache.myfaces.el.MethodBindingImpl in
>>> order to store the names in requestscope in the "invoke" method?
>>>
>>>
>>> Michael
>>>
>>
>
>

Re: access names of called actions and beans

Posted by Richard Yee <ri...@gmail.com>.
If you are using Spring, you can also easily do it with AOP.

-Richard

On Tue, Jul 1, 2008 at 12:23 PM, Stephen Friedrich <tr...@eekboom.com>
wrote:

> I think it's not really feasible with a servlet only, but an interceptor
> can easily do it.
> See the posts in this thread for a working example:
>
> http://seamframework.org/Community/SeamPerformanceProblemRewardingWorkaround
>
> There's a little bit more configuration to do when you are not using Seam,
> but not too complicated either way.
>
>
> Michael Heinen wrote:
>
>> What's the best approach to output the name of the called
>> action/actionListener and the name of the corresponding managed beans ?
>>
>> I want to use a ServletFilter to measure the times for http requests and
>> print out these names.
>>
>> Is there anything generic available via FacesContext? I do not want to
>> touch every  managed bean.
>>
>>
>> Or do I have to overwrite org.apache.myfaces.el.MethodBindingImpl in order
>> to store the names in requestscope in the "invoke" method?
>>
>>
>> Michael
>>
>>
>

Re: access names of called actions and beans

Posted by Stephen Friedrich <tr...@eekboom.com>.
I think it's not really feasible with a servlet only, but an interceptor
can easily do it.
See the posts in this thread for a working example:
http://seamframework.org/Community/SeamPerformanceProblemRewardingWorkaround

There's a little bit more configuration to do when you are not using Seam,
but not too complicated either way.

Michael Heinen wrote:
> What's the best approach to output the name of the called 
> action/actionListener and the name of the corresponding managed beans ?
> 
> I want to use a ServletFilter to measure the times for http requests and 
> print out these names.
> 
> Is there anything generic available via FacesContext? I do not want to 
> touch every  managed bean.
> 
>  
> 
> Or do I have to overwrite org.apache.myfaces.el.MethodBindingImpl in 
> order to store the names in requestscope in the "invoke" method?
> 
>  
> 
> Michael
>