Ok - I'm having a bad start to the day and this is driving me nuts. I'm using the Convention plugin, and below I've attached a copy of my struts.xml. As you can see I've got two custom interceptors which I'm adding to a copy of the param-prepare-param stack.
Through logging I can see that my two custome interceptors are being initialized (their constructors are being called) but thereafter neither of the interceptors intercept() method is being invoked.
Using the config-browser plugin I see that my custom interceptors are *not* in the stack for the default, admin or diagnostic namespaces. Further none of the namespaces are using the param-prepare-param stack the first Parameter interceptor is missing as well. It looks like I'm using the bog-standard struts-default stack.
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.
Are you setting the parent package constant or otherwise telling the Convention plugin what package to use (or interceptors) in your "conventional" and/or annotated actions?
Glen Divers
Ranch Hand
Joined: Jan 21, 2010
Posts: 61
posted
0
David Newton wrote:Are you setting the parent package constant or otherwise telling the Convention plugin what package to use (or interceptors) in your "conventional" and/or annotated actions?
Hi Dave
No, I wasn't - I've added the @ParentPackage annotation to my actions and now, most of them are picking up the correct stack. The ones that aren't picking up the correct stack are those that are using JSON results. For those to work you have to specify @ParentPackage(value="json-default") which extends struts-default, so those actions are not using the correct interceptor stack. I'll try adding the @Interceptor annotation to those, but it all seems to be getting a bit kludgy.
If the only thing the json package does is declare result types why not just extend that in your package? (I don't recall what else it does--if it does more, just duplicate it.)
Still, it seems easier to set the constant rather than annotate each action.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.