|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Convention Plugin & Struts PackagesI'm having a bad day today, I cannot get Struts 2 using the Convention plugin to recogize the fact that the package "secure" (which extends struts-default) uses a different interceptor stack. I know I'm doing something stupid, but I can't see what.
When I call an action in the secure namespace the login interceptor fails to fire and the action executes as "normal". Inspecting the output from config-browser, I can see that the action I'm calling is located in the "/secure" namespace, but the interceptor list is the default-struts stack, not the secureStack. Have I got my struts.xml correct, or do I need to do anything additional with annotations to make this work. Regards <struts> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="true" /> <package name="default" namespace="/" extends="struts-default"> </package> <package name="secure" namespace="/secure" extends="struts-default"> <interceptors> <interceptor name="login" class="com.myApp.interceptors.LoginInterceptor" /> <interceptor-stack name="secureStack"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="i18n"/> <interceptor-ref name="prepare"/> <interceptor-ref name="chain"/> <interceptor-ref name="debugging"/> <interceptor-ref name="scopedModelDriven"/> <interceptor-ref name="modelDriven"/> <interceptor-ref name="fileUpload"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="multiselect"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="params"> dojo\..*,^struts\..* </interceptor-ref> <interceptor-ref name="login"/> <interceptor-ref name="conversionError"/> <interceptor-ref name="validation"> input,back,cancel,browse </interceptor-ref> <interceptor-ref name="workflow"> input,back,cancel,browse </interceptor-ref> </interceptor-stack> </interceptors> <default-interceptor-ref name="secureStack"/> </package> </struts> |
|
|
RE: Convention Plugin & Struts PackagesHey Roger,
You need to use @ParentPackage I believe. Or use this struts.convention.default.parent.package Check out: http://struts.apache.org/2.1.6/docs/convention-plugin.html#ConventionPlu gin-ParentPackageannotation Hope this helps Cookie -----Original Message----- From: RogerV [mailto:roger.varley@...] Sent: 29 October 2009 12:53 To: user@... Subject: Convention Plugin & Struts Packages I'm having a bad day today, I cannot get Struts 2 using the Convention plugin to recogize the fact that the package "secure" (which extends struts-default) uses a different interceptor stack. I know I'm doing something stupid, but I can't see what. When I call an action in the secure namespace the login interceptor fails to fire and the action executes as "normal". Inspecting the output from config-browser, I can see that the action I'm calling is located in the "/secure" namespace, but the interceptor list is the default-struts stack, not the secureStack. Have I got my struts.xml correct, or do I need to do anything additional with annotations to make this work. Regards <struts> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="true" /> <package name="default" namespace="/" extends="struts-default"> </package> <package name="secure" namespace="/secure" extends="struts-default"> <interceptors> <interceptor name="login" class="com.myApp.interceptors.LoginInterceptor" /> <interceptor-stack name="secureStack"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="i18n"/> <interceptor-ref name="prepare"/> <interceptor-ref name="chain"/> <interceptor-ref name="debugging"/> <interceptor-ref name="scopedModelDriven"/> <interceptor-ref name="modelDriven"/> <interceptor-ref name="fileUpload"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="multiselect"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="params"> dojo\..*,^struts\..* </interceptor-ref> <interceptor-ref name="login"/> <interceptor-ref name="conversionError"/> <interceptor-ref name="validation"> input,back,cancel,browse </interceptor-ref> <interceptor-ref name="workflow"> input,back,cancel,browse </interceptor-ref> </interceptor-stack> </interceptors> <default-interceptor-ref name="secureStack"/> </package> </struts> -- View this message in context: http://www.nabble.com/Convention-Plugin---Struts-Packages-tp26112472p261 12472.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: Convention Plugin & Struts PackagesThanks Cookie, adding @ParentPackage to all my secure actions has solved the problem and I'm now getting the secureStack interceptors. It seems a pain to have to do it this way (I know I could simplify by creating a base action for each package and extend), particularly when I have multiple packages. It's a shame that Struts doesn't seem able to infer this from the info in struts.xml and the java package locations. Regards |
|
|
RE: Convention Plugin & Struts PackagesIf you use
struts.convention.default.parent.package In either the web.xml or struts.xml, I think what you specify there will be the default for all actions. I have a link in the previous email but I think it must have been removed : struts.apache.org/2.1.6/docs/convention-plugin.html#ConventionPlugin-Par entPackageannotation Cookie -----Original Message----- From: RogerV [mailto:roger.varley@...] Sent: 29 October 2009 13:22 To: user@... Subject: RE: Convention Plugin & Struts Packages James Cook-13 wrote: > > Hey Roger, > > You need to use @ParentPackage I believe. Or use this > > struts.convention.default.parent.package > > Hope this helps > > Cookie > Thanks Cookie, adding @ParentPackage to all my secure actions has solved the problem and I'm now getting the secureStack interceptors. It seems a pain to have to do it this way (I know I could simplify by creating a base action for each package and extend), particularly when I have multiple packages. It's a shame that Struts doesn't seem able to infer this from the info in struts.xml and the java package locations. Regards -- View this message in context: http://www.nabble.com/Convention-Plugin---Struts-Packages-tp26112472p261 12955.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Convention Plugin & Struts Packagesalso, the @ParentPackage can be applied to a whole package by putting
it in a package-info.java file. I will add that to the docs. musachy On Thu, Oct 29, 2009 at 7:01 AM, James Cook <James.Cook@...> wrote: > If you use > > struts.convention.default.parent.package > > In either the web.xml or struts.xml, I think what you specify there will > be the default for all actions. > > I have a link in the previous email but I think it must have been > removed : > > struts.apache.org/2.1.6/docs/convention-plugin.html#ConventionPlugin-Par > entPackageannotation > > Cookie > > -----Original Message----- > From: RogerV [mailto:roger.varley@...] > Sent: 29 October 2009 13:22 > To: user@... > Subject: RE: Convention Plugin & Struts Packages > > > > James Cook-13 wrote: >> >> Hey Roger, >> >> You need to use @ParentPackage I believe. Or use this >> >> struts.convention.default.parent.package >> >> Hope this helps >> >> Cookie >> > > Thanks Cookie, adding @ParentPackage to all my secure actions has solved > the > problem and I'm now getting the secureStack interceptors. It seems a > pain to > have to do it this way (I know I could simplify by creating a base > action > for each package and extend), particularly when I have multiple > packages. > It's a shame that Struts doesn't seem able to infer this from the info > in > struts.xml and the java package locations. > > Regards > -- > View this message in context: > http://www.nabble.com/Convention-Plugin---Struts-Packages-tp26112472p261 > 12955.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Convention Plugin & Struts PackagesOn Thursday 29 October 2009 19:33:49 Musachy Barroso wrote:
> also, the @ParentPackage can be applied to a whole package by putting > it in a package-info.java file. I will add that to the docs. > I've seen package-info.java mentioned in couple of places in the Convention docs. This is probably another stupid question, but what is a package- info.java file? Regards --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Convention Plugin & Struts PackagesIt is a file where you put annotations that are applied to the
package. See: http://onjava.com/pub/a/onjava/2004/04/21/declarative.html?page=3 musachy On Thu, Oct 29, 2009 at 11:51 AM, Roger <roger.varley@...> wrote: > On Thursday 29 October 2009 19:33:49 Musachy Barroso wrote: >> also, the @ParentPackage can be applied to a whole package by putting >> it in a package-info.java file. I will add that to the docs. >> > I've seen package-info.java mentioned in couple of places in the Convention > docs. This is probably another stupid question, but what is a package- > info.java file? > > Regards > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
| Free embeddable forum powered by Nabble | Forum Help |