You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Piero Sartini <li...@pierosartini.de> on 2008/02/27 01:50:13 UTC
[S2.1.1] How to use an Interceptor from a plugin?
Hello,
I am trying to write an authentication plugin for struts2. Goal is to reuse it
across several projects so a plugin seems the way to go..
There is an Interceptor defined in struts-plugin.xml, lets call it
AuthenticationInterceptor. Problem is that I am not able to use it in my main
struts.xml from the project that includes my plugin.
Is it that I am allowed use this interceptor in my plugin only?
Also tried to define a package in the plugin and extend it in my main project,
but this does not work as well.
Is it possible to use the plugin system from struts2 for my purpose? If not,
maybe there is some better way?
Piero
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [struts] [S2.1.1] How to use an Interceptor from a plugin?
Posted by Piero Sartini <li...@pierosartini.de>.
> If you don't intend to have your application's package extend the
> package defined in your plugin (which doesn't scale to multiple
> plugins), what's the benefit of having this be a plugin as opposed to
> just a .jar file?
I hoped that the plugin architecture will help me with the configuration part
of the module. There are some interfaces that have to be implemented from the
main application.
Now, my problem is how to configure this. Is it possible to use the
struts2-mechanism of <bean> and <constant> without writing an own
BeanSelectionProvider?
Piero
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [struts] [S2.1.1] How to use an Interceptor from a plugin?
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Dale Newfield wrote:
> Jeromy Evans wrote:
>> You're following the right approach.
>
> If you don't intend to have your application's package extend the
> package defined in your plugin (which doesn't scale to multiple
> plugins), what's the benefit of having this be a plugin as opposed to
> just a .jar file?
>
> -Dale
You're right there's no benefit in this case. In general, the advantage
of the plugin is that it can define beans and set constants within the
Xwork Container (in addition to defining default packages).
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [struts] [S2.1.1] How to use an Interceptor from a plugin?
Posted by Dale Newfield <Da...@Newfield.org>.
Jeromy Evans wrote:
> You're following the right approach.
If you don't intend to have your application's package extend the
package defined in your plugin (which doesn't scale to multiple
plugins), what's the benefit of having this be a plugin as opposed to
just a .jar file?
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2.1.1] How to use an Interceptor from a plugin?
Posted by Piero Sartini <li...@pierosartini.de>.
Am Mittwoch, 27. Februar 2008 01:59:36 schrieb Jeromy Evans:
> You're following the right approach.
> ..
> In any case, the approach works so you probably just have a minor config
> error. Post your config (struts-plugin.xml and struts.xml) if the
> statement above doesn't help.
Thank you, that helped! It was indeed a minor config error like you suspected.
Piero
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2.1.1] How to use an Interceptor from a plugin?
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
You're following the right approach.
Is the interceptor defined in your package?
Normally either the plugin defines a package in struts-plugin.xml and
your application extends that package, or your application needs to
define the interceptor with an <interceptor name=..." tag>. Also don't
forget you need an interceptor-ref either in your default package or
application's package/action. Also ensure your plugin in the classpath.
In any case, the approach works so you probably just have a minor config
error. Post your config (struts-plugin.xml and struts.xml) if the
statement above doesn't help.
regards,
Jeromy Evans
Piero Sartini wrote:
> Hello,
>
> I am trying to write an authentication plugin for struts2. Goal is to reuse it
> across several projects so a plugin seems the way to go..
>
> There is an Interceptor defined in struts-plugin.xml, lets call it
> AuthenticationInterceptor. Problem is that I am not able to use it in my main
> struts.xml from the project that includes my plugin.
>
> Is it that I am allowed use this interceptor in my plugin only?
> Also tried to define a package in the plugin and extend it in my main project,
> but this does not work as well.
>
> Is it possible to use the plugin system from struts2 for my purpose? If not,
> maybe there is some better way?
>
> Piero
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org