I need to create functionality like PageAware in my plugin. There's non-standard entity I need to deal with xwork actions and I want to encapsulate enity resolving methods in some interceptor, which can inject the dependency in my EntityAware actions. Is it possible?
Community moderators have prevented the ability to post new answers.
<package name="example" extends="default" namespace="/example"> <interceptors> <interceptor name="timer" class=".."/> <interceptor name="logger" class=".."/> <interceptor-stack name="myStack"> <interceptor-ref name="timer"/> <interceptor-ref name="logger"/> </interceptor-stack> </interceptors> <action name="login" class="tutuorial.Login"> <interceptor-ref name="myStack"/> <result name="input">login.jsp</result> <result name="success" type="redirectAction">/secure/home</result> </action> </package>
<package name="example" extends="default" namespace="/example"> <interceptor name="exampleInterceptor" class="com.confluence.plugin.ExampleInterceptor"/> <interceptor-stack name="exampleStack"> <interceptor-ref name="exampleInterceptor"/> <interceptor-ref name="defaultStack"/> </interceptor-stack> <action name="login" class="tutuorial.Login"> <interceptor-ref name="exampleStack"/>
<result name="input">login.jsp</result> <result name="success" type="redirectAction">/secure/home</result> </action> </package>
After that webwork framework will be able to create instances of your interceptor.
I'm not sure, but try your own spring-application context in your plugin, maybe you can achieve your goal via this way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, I tried according to Advanced Configuration with Spring XML Files. It doesn't work.
There are some classpath issues, I think. Log message:
Caused by: Unable to find interceptor class referenced by ref-name customStack
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One more point, I think, this will only work in your bundle. If the code, you want to intercept is not in your bundle, you will have a problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The interceptor code is in my bundle near to actions, but it seems that interceptor stack building is more complicated and is predefined and not extensible for some reason. Even if I create interceptor bean directly from the local spring context.
The message in log is from method "constructInterceptorReference" so that seems to be some OSGi classpath issues
The extension mechanism for interceptors is defined in struts, but I didn't see any examples of such extension in atlassian docs and src.
So, for now I just want to be shure, that it's not possible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you have classpath issues, find and add the missing dependencies to your plugin bundle. Just add the dependency with no scope to your plugin.
In my first post I was somehow on aop interceptors... :(
I'm not sure, if this is working, but you can try the conveyorlib and the conveyor-plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's pretty bad idea for any class instance which represents some service, it may cause non-clear OSGi issues.
This way can be used only for shurely local usage classes(and artefacts in general)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.