Author: husted Date: Tue Nov 14 05:47:30 2006 New Revision: 474783 URL: http://svn.apache.org/viewvc?view=rev&rev=474783 Log: WW-1491 Check list of actionPackages for objects that implement Action, along with classes with names that are suffixed with "Action". We should also add a action annotation, since most POJOs would need to use annotations anyway, and it would be cleaner to have one set of concerns (is it annotated correctly?). Next, I'll try applying zero-configuration to a copy of MailReader.
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java?view=diff&rev=474783&r1=474782&r2=474783 ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java Tue Nov 14 05:47:30 2006 @@ -32,6 +32,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts2.StrutsConstants; +import org.apache.struts2.Action; import com.opensymphony.xwork2.ObjectFactory; import com.opensymphony.xwork2.config.Configuration; @@ -125,7 +126,10 @@ * @param pkgs */ protected void loadPackages(String[] pkgs) { + ResolverUtil<Class> resolver = new ResolverUtil<Class>(); + resolver.findImplementations(Action.class,pkgs); + // TODO: resolver.findAnnotated( ,pkgs); resolver.findSuffix(ACTION, pkgs); Set actionClasses = resolver.getClasses(); for (Object obj : actionClasses) { @@ -179,7 +183,10 @@ } } - actionName = actionName.substring(0, actionName.length() - ACTION.length()); + boolean trimSuffix = (actionName.lastIndexOf(ACTION) > 0); + if (trimSuffix) { + actionName = actionName.substring(0, actionName.length() - ACTION.length()); + } if (actionName.length() > 1) { int lowerPos = actionName.lastIndexOf('/') + 1;