I briefly brought up components on some other threads and I figured I'd
open up a new one to discuss what I'm thinking about. Having looked
around a bit and thought about our current configuration, I think that
heading in an even more convention based approach for actions seems best
and it will also handle components nicely.
The method would be to specify a configuration parameter (default would
be in the convention plugin's struts-plugin.xml file) that denotes a
comma-separated list of package locators:
<constant name="struts.conventions.package.locators"
value="struts,action,actions"/>
Any packages that contain one of the locators will be used as the root
of a convention based package. i.e.
package com.example.actions.foo.bar; // will map to /foo/bar
This parameter can be overridden if necessary in the applications
configuration files.
Next, in order to handle different result locations (as SmartURLs
currently does in the component.xml files), we leverage the
package-info.java file and use the BaseResultLocation annotation at the
package level. In addition, all annotations at the package level should
be inherited in sub-packages to make configuration even simpler. i.e.
@org.apache.struts2.convention.annotation.BaseResultLocation("/WEB-INF/jsps")
package com.example.actions
Since this will find all packages in the classpath, it will find things
in /WEB-INF/classes as well as /WEB-INF/lib. This also has the advantage
that all actions are located the same for the application and all
components.
What does everyone think about it?
-bp
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]