struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r493148 - in /struts/struts2/trunk/plugins/codebehind/src: main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java
Date Fri, 05 Jan 2007 19:20:10 GMT
Author: mrdon
Date: Fri Jan  5 11:20:09 2007
New Revision: 493148

URL: http://svn.apache.org/viewvc?view=rev&rev=493148
Log:
Changed to use constructor injection since two injections depended on each other
WW-1595

Modified:
    struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
    struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java

Modified: struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java?view=diff&rev=493148&r1=493147&r2=493148
==============================================================================
--- struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
(original)
+++ struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
Fri Jan  5 11:20:09 2007
@@ -61,20 +61,13 @@
     protected ObjectFactory objectFactory;
     
     protected static final Log LOG = LogFactory.getLog(CodebehindUnknownHandler.class);
-    
-    @Inject("struts.codebehind.pathPrefix")
-    public void setPathPrefix(String prefix) {
-        this.templatePathPrefix=prefix;
-    }
-    
-    @Inject("struts.codebehind.defaultPackage")
-    public void setDefaultPackage(String pkg) {
-        this.defaultPackageName = pkg;
-    }
-    
+
     @Inject
-    public void setConfiguration(Configuration config) {
-        this.configuration = config;
+    public CodebehindUnknownHandler(@Inject("struts.codebehind.defaultPackage") String defaultPackage,

+                                    @Inject Configuration configuration) {
+
+        this.configuration = configuration;
+        this.defaultPackageName = defaultPackage;
         resultsByExtension = new LinkedHashMap<String,ResultTypeConfig>();
         PackageConfig parentPackage = configuration.getPackageConfig(defaultPackageName);
         Map<String,ResultTypeConfig> results = parentPackage.getAllResultTypeConfigs();
@@ -82,6 +75,12 @@
         resultsByExtension.put("jsp", results.get("dispatcher"));
         resultsByExtension.put("vm", results.get("velocity"));
         resultsByExtension.put("ftl", results.get("freemarker"));
+       
+    }                                
+
+    @Inject("struts.codebehind.pathPrefix")
+    public void setPathPrefix(String prefix) {
+        this.templatePathPrefix=prefix;
     }
     
     @Inject

Modified: struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java?view=diff&rev=493148&r1=493147&r2=493148
==============================================================================
--- struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java
(original)
+++ struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java
Fri Jan  5 11:20:09 2007
@@ -43,10 +43,8 @@
     public void setUp() throws Exception {
         super.setUp();
         mockServletContext = new Mock(ServletContext.class);
-        handler = new CodebehindUnknownHandler();
-        handler.setDefaultPackage("codebehind-default");
+        handler = new CodebehindUnknownHandler("codebehind-default", configuration);
         handler.setPathPrefix("/");
-        handler.setConfiguration(configuration);
         handler.setObjectFactory(container.getInstance(ObjectFactory.class));
         handler.setServletContext((ServletContext)mockServletContext.proxy());
     }



Mime
View raw message