Author: musachy Date: Thu Feb 12 18:45:14 2009 New Revision: 743831 URL: http://svn.apache.org/viewvc?rev=743831&view=rev Log: Add a setting so file protocols can be set by a constant
Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java struts/struts2/trunk/plugins/convention/src/main/resources/struts-plugin.xml Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java?rev=743831&r1=743830&r2=743831&view=diff ============================================================================== --- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java (original) +++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java Thu Feb 12 18:45:14 2009 @@ -63,6 +63,7 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory; import com.opensymphony.xwork2.util.FileManager; import com.opensymphony.xwork2.util.TextUtils; +import com.opensymphony.xwork2.util.TextParseUtil; /** * <p> @@ -92,6 +93,7 @@ private boolean devMode; private ReloadingClassLoader reloadingClassLoader; private boolean reload; + private Set<String> fileProtocols; /** * Constructs actions based on a list of packages. @@ -137,6 +139,17 @@ } /** + * Comma separated list of file protocols that will be considered as jar files and scanned + * @param fileProtocols + */ + @Inject("struts.convention.action.fileProtocols") + public void setFileProtocols(String fileProtocols) { + if (!StringTools.isTrimmedEmpty(fileProtocols)) { + this.fileProtocols = TextParseUtil.commaDelimitedStringToSet(fileProtocols); + } + } + + /** * @param disableActionScanning Disable scanning for actions */ @Inject(value = "struts.convention.action.disableScanning", required = false) @@ -332,7 +345,7 @@ boolean[] patternUsed = new boolean[includeJars.length]; for (URL url : rawIncludedUrls) { - if ("jar".equalsIgnoreCase(url.getProtocol())) { + if (fileProtocols.contains(url.getProtocol())) { //it is a jar file, make sure it macthes at least a url regex for (int i = 0; i < includeJars.length; i++) { String includeJar = includeJars[i]; Modified: struts/struts2/trunk/plugins/convention/src/main/resources/struts-plugin.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/resources/struts-plugin.xml?rev=743831&r1=743830&r2=743831&view=diff ============================================================================== --- struts/struts2/trunk/plugins/convention/src/main/resources/struts-plugin.xml (original) +++ struts/struts2/trunk/plugins/convention/src/main/resources/struts-plugin.xml Thu Feb 12 18:45:14 2009 @@ -60,7 +60,8 @@ <constant name="struts.convention.relative.result.types" value="dispatcher,velocity,freemarker"/> <constant name="struts.convention.redirect.to.slash" value="true"/> <constant name="struts.mapper.alwaysSelectFullNamespace" value="true"/> - <constant name="struts.convention.action.includeJars" value="" /> + <constant name="struts.convention.action.includeJars" value="" /> + <constant name="struts.convention.action.fileProtocols" value="jar" /> <constant name="struts.convention.classes.reload" value="false" />