struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [5/8] struts git commit: Extracts constants
Date Tue, 01 Aug 2017 13:51:28 GMT
Extracts constants


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/f585d792
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/f585d792
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/f585d792

Branch: refs/heads/master
Commit: f585d7920ebdd2ce5b7164b5425d4567dddeddcb
Parents: b5be431
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Fri Jul 7 11:13:44 2017 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Fri Jul 7 11:13:44 2017 +0200

----------------------------------------------------------------------
 .../convention/AbstractActionNameBuilder.java   |  2 +-
 .../ClasspathConfigurationProvider.java         |  2 +-
 .../struts2/convention/ConventionConstants.java | 20 ++++++++++++
 .../convention/ConventionUnknownHandler.java    |  6 ++--
 .../convention/ConventionsServiceImpl.java      |  2 +-
 .../convention/DefaultResultMapBuilder.java     |  4 +--
 .../PackageBasedActionConfigBuilder.java        | 34 ++++++++++----------
 7 files changed, 45 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/f585d792/plugins/convention/src/main/java/org/apache/struts2/convention/AbstractActionNameBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/AbstractActionNameBuilder.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/AbstractActionNameBuilder.java
index a546e62..df2214f 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/AbstractActionNameBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/AbstractActionNameBuilder.java
@@ -15,7 +15,7 @@ public abstract class AbstractActionNameBuilder implements ActionNameBuilder
{
      * @param   actionSuffix (Optional) Classes that end with these value will be mapped
as actions
      *          (defaults to "Action")
      */
-    @Inject(value = "struts.convention.action.suffix", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_ACTION_SUFFIX, required = false)
     public void setActionSuffix(String actionSuffix) {
         if (StringUtils.isNotBlank(actionSuffix)) {
             this.actionSuffix = TextParseUtil.commaDelimitedStringToSet(actionSuffix);

http://git-wip-us.apache.org/repos/asf/struts/blob/f585d792/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
index 32aec96..79334e7 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
@@ -53,7 +53,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider,
Di
         this.devMode = BooleanUtils.toBoolean(mode);
     }
 
-    @Inject("struts.convention.classes.reload")
+    @Inject(ConventionConstants.CONVENTION_CLASSES_RELOAD)
     public void setReload(String reload) {
         this.reload = BooleanUtils.toBoolean(reload);
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/f585d792/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionConstants.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionConstants.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionConstants.java
index b360d94..ad5f4e8 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionConstants.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionConstants.java
@@ -31,4 +31,24 @@ public class ConventionConstants {
     public static final String CONVENTION_CONVENTIONS_SERVICE = "struts.convention.conventionsService";
     public static final String CONVENTION_ACTION_NAME_LOWERCASE = "struts.convention.action.name.lowercase";
     public static final String CONVENTION_ACTION_NAME_SEPARATOR = "struts.convention.action.name.separator";
+    public static final String CONVENTION_ACTION_SUFFIX = "struts.convention.action.suffix";
+    public static final String CONVENTION_CLASSES_RELOAD = "struts.convention.classes.reload";
+    public static final String CONVENTION_RESULT_PATH = "struts.convention.result.path";
+    public static final String CONVENTION_DEFAULT_PARENT_PACKAGE = "struts.convention.default.parent.package";
+    public static final String CONVENTION_REDIRECT_TO_SLASH = "struts.convention.redirect.to.slash";
+    public static final String CONVENTION_RELATIVE_RESULT_TYPES = "struts.convention.relative.result.types";
+    public static final String CONVENTION_EXCLUDE_PARENT_CLASS_LOADER = "struts.convention.exclude.parentClassLoader";
+    public static final String CONVENTION_ACTION_ALWAYS_MAP_EXECUTE = "struts.convention.action.alwaysMapExecute";
+    public static final String CONVENTION_ACTION_FILE_PROTOCOLS = "struts.convention.action.fileProtocols";
+    public static final String CONVENTION_ACTION_DISABLE_SCANNING = "struts.convention.action.disableScanning";
+    public static final String CONVENTION_ACTION_INCLUDE_JARS = "struts.convention.action.includeJars";
+    public static final String CONVENTION_PACKAGE_LOCATORS_DISABLE = "struts.convention.package.locators.disable";
+    public static final String CONVENTION_ACTION_PACKAGES = "struts.convention.action.packages";
+    public static final String CONVENTION_ACTION_CHECK_IMPLEMENTS_ACTION = "struts.convention.action.checkImplementsAction";
+    public static final String CONVENTION_EXCLUDE_PACKAGES = "struts.convention.exclude.packages";
+    public static final String CONVENTION_PACKAGE_LOCATORS = "struts.convention.package.locators";
+    public static final String CONVENTION_PACKAGE_LOCATORS_BASE_PACKAGE = "struts.convention.package.locators.basePackage";
+    public static final String CONVENTION_ACTION_MAP_ALL_MATCHES = "struts.convention.action.mapAllMatches";
+    public static final String CONVENTION_ACTION_EAGER_LOADING = "struts.convention.action.eagerLoading";
+    public static final String CONVENTION_RESULT_FLAT_LAYOUT = "struts.convention.result.flatLayout";
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/f585d792/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
index cb10f1b..8e87494 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
@@ -94,9 +94,9 @@ public class ConventionUnknownHandler implements UnknownHandler {
     @Inject
     public ConventionUnknownHandler(Configuration configuration, ObjectFactory objectFactory,
                                     ServletContext servletContext, Container container,
-                                    @Inject("struts.convention.default.parent.package") String
defaultParentPackageName,
-                                    @Inject("struts.convention.redirect.to.slash") String
redirectToSlash,
-                                    @Inject("struts.convention.action.name.separator") String
nameSeparator) {
+                                    @Inject(ConventionConstants.CONVENTION_DEFAULT_PARENT_PACKAGE)
String defaultParentPackageName,
+                                    @Inject(ConventionConstants.CONVENTION_REDIRECT_TO_SLASH)
String redirectToSlash,
+                                    @Inject(ConventionConstants.CONVENTION_ACTION_NAME_SEPARATOR)
String nameSeparator) {
         this.configuration = configuration;
         this.objectFactory = objectFactory;
         this.servletContext = servletContext;

http://git-wip-us.apache.org/repos/asf/struts/blob/f585d792/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
index 8e68538..004b28e 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
@@ -49,7 +49,7 @@ public class ConventionsServiceImpl implements ConventionsService {
      *          the constant name of <strong>struts.convention.result.path</strong>.
      */
     @Inject
-    public ConventionsServiceImpl(@Inject("struts.convention.result.path") String resultPath)
{
+    public ConventionsServiceImpl(@Inject(ConventionConstants.CONVENTION_RESULT_PATH) String
resultPath) {
         this.resultPath = resultPath;
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/f585d792/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
index 40ea279..724c09f 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
@@ -131,7 +131,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
      */
     @Inject
     public DefaultResultMapBuilder(ServletContext servletContext, Container container,
-            @Inject("struts.convention.relative.result.types") String relativeResultTypes)
{
+            @Inject(ConventionConstants.CONVENTION_RELATIVE_RESULT_TYPES) String relativeResultTypes)
{
         this.servletContext = servletContext;
         this.relativeResultTypes = new HashSet<>(Arrays.asList(relativeResultTypes.split("\\s*[,]\\s*")));
         this.conventionsService = container.getInstance(ConventionsService.class, container.getInstance(String.class,
ConventionConstants.CONVENTION_CONVENTIONS_SERVICE));
@@ -142,7 +142,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
      *          ${namespace}/${actionName}-${result}.${extension}, otherwise in the form
      *          ${namespace}/${actionName}/${result}.${extension}
      */
-    @Inject("struts.convention.result.flatLayout")
+    @Inject(ConventionConstants.CONVENTION_RESULT_FLAT_LAYOUT)
     public void setFlatResultLayout(String flatResultLayout) {
         this.flatResultLayout = BooleanUtils.toBoolean(flatResultLayout);
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/f585d792/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
index b244392..d45f7bf 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
@@ -108,8 +108,8 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      */
     @Inject
     public PackageBasedActionConfigBuilder(Configuration configuration, Container container,
ObjectFactory objectFactory,
-                                           @Inject("struts.convention.redirect.to.slash")
String redirectToSlash,
-                                           @Inject("struts.convention.default.parent.package")
String defaultParentPackage) {
+                                           @Inject(ConventionConstants.CONVENTION_REDIRECT_TO_SLASH)
String redirectToSlash,
+                                           @Inject(ConventionConstants.CONVENTION_DEFAULT_PARENT_PACKAGE)
String defaultParentPackage) {
 
         // Validate that the parameters are okay
         this.configuration = configuration;
@@ -135,7 +135,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * @param reload Reload configuration when classes change. Defaults to "false" and should
not be used
      * in production.
      */
-    @Inject("struts.convention.classes.reload")
+    @Inject(ConventionConstants.CONVENTION_CLASSES_RELOAD)
     public void setReload(String reload) {
         this.reload = BooleanUtils.toBoolean(reload);
     }
@@ -149,7 +149,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
     /**
      * @param exclude Exclude URLs found by the parent class loader. Defaults to "true",
set to true for JBoss
      */
-    @Inject("struts.convention.exclude.parentClassLoader")
+    @Inject(ConventionConstants.CONVENTION_EXCLUDE_PARENT_CLASS_LOADER)
     public void setExcludeParentClassLoader(String exclude) {
         this.excludeParentClassLoader = BooleanUtils.toBoolean(exclude);
     }
@@ -158,7 +158,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * @param alwaysMapExecute  If this constant is true, and there is an "execute" method(not
annotated), a mapping will be added
      * pointing to it, even if there are other mapping in the class
      */
-    @Inject("struts.convention.action.alwaysMapExecute")
+    @Inject(ConventionConstants.CONVENTION_ACTION_ALWAYS_MAP_EXECUTE)
     public void setAlwaysMapExecute(String alwaysMapExecute) {
         this.alwaysMapExecute = BooleanUtils.toBoolean(alwaysMapExecute);
     }
@@ -167,7 +167,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * File URLs whose protocol are in these list will be processed as jars containing classes
      * @param fileProtocols Comma separated list of file protocols that will be considered
as jar files and scanned
      */
-    @Inject("struts.convention.action.fileProtocols")
+    @Inject(ConventionConstants.CONVENTION_ACTION_FILE_PROTOCOLS)
     public void setFileProtocols(String fileProtocols) {
         if (StringUtils.isNotBlank(fileProtocols)) {
             this.fileProtocols = TextParseUtil.commaDelimitedStringToSet(fileProtocols);
@@ -177,7 +177,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
     /**
      * @param disableActionScanning Disable scanning for actions
      */
-    @Inject(value = "struts.convention.action.disableScanning", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_ACTION_DISABLE_SCANNING, required = false)
     public void setDisableActionScanning(String disableActionScanning) {
         this.disableActionScanning = BooleanUtils.toBoolean(disableActionScanning);
     }
@@ -185,7 +185,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
     /**
      * @param includeJars Comma separated list of regular expressions of jars to be included.
      */
-    @Inject(value = "struts.convention.action.includeJars", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_ACTION_INCLUDE_JARS, required = false)
     public void setIncludeJars(String includeJars) {
         if (StringUtils.isNotEmpty(includeJars)) {
             this.includeJars = includeJars.split("\\s*[,]\\s*");
@@ -195,7 +195,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
     /**
      * @param disablePackageLocatorsScanning If set to true, only the named packages will
be scanned
      */
-    @Inject(value = "struts.convention.package.locators.disable", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_PACKAGE_LOCATORS_DISABLE, required = false)
     public void setDisablePackageLocatorsScanning(String disablePackageLocatorsScanning)
{
         this.disablePackageLocatorsScanning = BooleanUtils.toBoolean(disablePackageLocatorsScanning);
     }
@@ -204,7 +204,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * @param actionPackages (Optional) An optional list of action packages that this should
create
      *                       configuration for.
      */
-    @Inject(value = "struts.convention.action.packages", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_ACTION_PACKAGES, required = false)
     public void setActionPackages(String actionPackages) {
         if (StringUtils.isNotBlank(actionPackages)) {
             this.actionPackages = actionPackages.split("\\s*[,]\\s*");
@@ -215,7 +215,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * @param checkImplementsAction (Optional) Map classes that implement com.opensymphony.xwork2.Action
      *                       as actions
      */
-    @Inject(value = "struts.convention.action.checkImplementsAction", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_ACTION_CHECK_IMPLEMENTS_ACTION, required
= false)
     public void setCheckImplementsAction(String checkImplementsAction) {
         this.checkImplementsAction = BooleanUtils.toBoolean(checkImplementsAction);
     }
@@ -224,7 +224,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * @param actionSuffix (Optional) Classes that end with these value will be mapped as
actions
      *                     (defaults to "Action")
      */
-    @Inject(value = "struts.convention.action.suffix", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_ACTION_SUFFIX, required = false)
     public void setActionSuffix(String actionSuffix) {
         if (StringUtils.isNotBlank(actionSuffix)) {
             this.actionSuffix = TextParseUtil.commaDelimitedStringToSet(actionSuffix);
@@ -235,7 +235,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * @param excludePackages (Optional) A  list of packages that should be skipped when
building
      *                        configuration.
      */
-    @Inject(value = "struts.convention.exclude.packages", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_EXCLUDE_PACKAGES, required = false)
     public void setExcludePackages(String excludePackages) {
         if (StringUtils.isNotBlank(excludePackages)) {
             this.excludePackages = excludePackages.split("\\s*[,]\\s*");
@@ -245,7 +245,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
     /**
      * @param packageLocators (Optional) A list of names used to find action packages.
      */
-    @Inject(value = "struts.convention.package.locators", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_PACKAGE_LOCATORS, required = false)
     public void setPackageLocators(String packageLocators) {
         this.packageLocators = packageLocators.split("\\s*[,]\\s*");
     }
@@ -254,7 +254,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * @param packageLocatorsBasePackage (Optional) If set, only packages that start with
this
      *                                   name will be scanned for actions.
      */
-    @Inject(value = "struts.convention.package.locators.basePackage", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_PACKAGE_LOCATORS_BASE_PACKAGE, required
= false)
     public void setPackageLocatorsBase(String packageLocatorsBasePackage) {
         this.packageLocatorsBasePackage = packageLocatorsBasePackage;
     }
@@ -264,7 +264,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      *                      even if they don't have a default method. The mapping from
      *                      the url to the action will be delegated the action mapper.
      */
-    @Inject(value = "struts.convention.action.mapAllMatches", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_ACTION_MAP_ALL_MATCHES, required = false)
     public void setMapAllMatches(String mapAllMatches) {
         this.mapAllMatches = BooleanUtils.toBoolean(mapAllMatches);
     }
@@ -273,7 +273,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
      * @param eagerLoading (Optional) If set, found action classes will be instantiated by
the ObjectFactory to accelerate future use
      *                      setting it up can clash with Spring managed beans
      */
-    @Inject(value = "struts.convention.action.eagerLoading", required = false)
+    @Inject(value = ConventionConstants.CONVENTION_ACTION_EAGER_LOADING, required = false)
     public void setEagerLoading(String eagerLoading) {
         this.eagerLoading = BooleanUtils.toBoolean(eagerLoading);
     }


Mime
View raw message