Interceptors order

View: New views
3 Messages — Rating Filter:   Alert me  

Interceptors order

by Lionel-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi !

I'm trying to write my first interceptor with stripes 1.5.

My interceptor needs to run "inside" Stripersist:
I want to activate hibernate statistics in requestInit after Stripersist has
initialized the session, and log the statistics before Stripersist closes
the session.

Here is the annotion I used:
@Intercepts({LifecycleStage.RequestInit,
LifecycleStage.ResolutionExecution} )

If I don't specify the interceptors in web.xml, the are called in the wrong
order (mine before stripersist).
If I specify the order in web.xml, I get this warning :
Interceptor class org.stripesstuff.stripersist.Stripersist is configured to
run more than once for RequestComplete, which is right.
Did I miss something ?

Lionel




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Interceptors order

by Aaron Porter-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lionel,
What it sounds like is happening is you explicitly listing interceptors
but you've also got Extension.Packages defined for Stripersist so the
Stripersist interceptor is being registered twice. As you've discovered,
currently there is no way to specify order of auto-discovered interceptors.

I think you've got three options:
1. You can your interceptor before ActionBeanResolution and after
ResolutionExecution. There is a possible problem doing that - if an
exception is thrown before ResolutionExecution completes the second call
won't be made to your interceptor.
2. You can create a Hibernate interceptor which wouldn't require any
configuration in stripes. I'm not sure if you can set that up in
persistence.xml or if you have to use hibernate.cfg.xml.
3. You can subclass Stripersist and override intercept.

Aaron

Lionel wrote:

> Hi !
>
> I'm trying to write my first interceptor with stripes 1.5.
>
> My interceptor needs to run "inside" Stripersist:
> I want to activate hibernate statistics in requestInit after Stripersist has
> initialized the session, and log the statistics before Stripersist closes
> the session.
>
> Here is the annotion I used:
> @Intercepts({LifecycleStage.RequestInit,
> LifecycleStage.ResolutionExecution} )
>
> If I don't specify the interceptors in web.xml, the are called in the wrong
> order (mine before stripersist).
> If I specify the order in web.xml, I get this warning :
> Interceptor class org.stripesstuff.stripersist.Stripersist is configured to
> run more than once for RequestComplete, which is right.
> Did I miss something ?
>
> Lionel
>
>
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@...
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>  


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Interceptors order

by Lionel-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aaron Porter wrote:
> I think you've got three options:
> 1. You can your interceptor before ActionBeanResolution and after
> ResolutionExecution. There is a possible problem doing that - if an
> exception is thrown before ResolutionExecution completes the second
> call won't be made to your interceptor.
> 2. You can create a Hibernate interceptor which wouldn't require any
> configuration in stripes. I'm not sure if you can set that up in
> persistence.xml or if you have to use hibernate.cfg.xml.
> 3. You can subclass Stripersist and override intercept.

I'm lazy, so I choosed solution 4: move my interceptor to another package et
remove com.striperstuff from Extension.packages :)




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users
LightInTheBox - Buy quality products at wholesale price