struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgie...@apache.org
Subject svn commit: r560894 - in /struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template: FreemarkerTemplateEngine.java JspTemplateEngine.java Template.java VelocityTemplateEngine.java
Date Mon, 30 Jul 2007 09:05:34 GMT
Author: rgielen
Date: Mon Jul 30 02:05:32 2007
New Revision: 560894

URL: http://svn.apache.org/viewvc?view=rev&rev=560894
Log:
Code cleanups / generification

Modified:
    struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
    struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java
    struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/Template.java
    struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java

Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java?view=diff&rev=560894&r1=560893&r2=560894
==============================================================================
--- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
(original)
+++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
Mon Jul 30 02:05:32 2007
@@ -84,14 +84,13 @@
         Configuration config = freemarkerManager.getConfiguration(servletContext);
 
         // get the list of templates we can use
-        List templates = templateContext.getTemplate().getPossibleTemplates(this);
+        List<Template> templates = templateContext.getTemplate().getPossibleTemplates(this);
 
         // find the right template
         freemarker.template.Template template = null;
         String templateName = null;
         Exception exception = null;
-        for (Object template1 : templates) {
-            Template t = (Template) template1;
+        for (Template t : templates) {
             templateName = getFinalTemplateName(t);
             if (freemarkerCaching) {
                 if (!isTemplateMissing(templateName)) {

Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java?view=diff&rev=560894&r1=560893&r2=560894
==============================================================================
--- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java
(original)
+++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java
Mon Jul 30 02:05:32 2007
@@ -20,19 +20,16 @@
  */
 package org.apache.struts2.components.template;
 
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.PageContext;
-
+import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.components.Include;
 import org.apache.struts2.components.UIBean;
 
-import com.opensymphony.xwork2.util.ValueStack;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.PageContext;
+import java.util.List;
 
 /**
  * JSP based template engine.
@@ -50,11 +47,10 @@
         ValueStack stack = templateContext.getStack();
         stack.push(tag);
         PageContext pageContext = (PageContext) stack.getContext().get(ServletActionContext.PAGE_CONTEXT);
-        List templates = template.getPossibleTemplates(this);
+        List<Template> templates = template.getPossibleTemplates(this);
         Exception exception = null;
         boolean success = false;
-        for (Iterator iterator = templates.iterator(); iterator.hasNext();) {
-            Template t = (Template) iterator.next();
+        for (Template t : templates) {
             try {
                 Include.include(getFinalTemplateName(t), pageContext.getOut(),
                         pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse());

Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/Template.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/Template.java?view=diff&rev=560894&r1=560893&r2=560894
==============================================================================
--- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/Template.java
(original)
+++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/Template.java
Mon Jul 30 02:05:32 2007
@@ -59,8 +59,8 @@
         return name;
     }
 
-    public List getPossibleTemplates(TemplateEngine engine) {
-        List list = new ArrayList(3);
+    public List<Template> getPossibleTemplates(TemplateEngine engine) {
+        List<Template> list = new ArrayList<Template>(3);
         Template template = this;
         String parentTheme;
         list.add(template);

Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java?view=diff&rev=560894&r1=560893&r2=560894
==============================================================================
--- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java
(original)
+++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java
Mon Jul 30 02:05:32 2007
@@ -20,16 +20,7 @@
  */
 package org.apache.struts2.components.template;
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.opensymphony.xwork2.inject.Inject;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts2.ServletActionContext;
@@ -37,7 +28,13 @@
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.context.Context;
 
-import com.opensymphony.xwork2.inject.Inject;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Velocity based template engine.
@@ -64,14 +61,13 @@
         VelocityEngine velocityEngine = velocityManager.getVelocityEngine();
 
         // get the list of templates we can use
-        List templates = templateContext.getTemplate().getPossibleTemplates(this);
+        List<Template> templates = templateContext.getTemplate().getPossibleTemplates(this);
 
         // find the right template
         org.apache.velocity.Template template = null;
         String templateName = null;
         Exception exception = null;
-        for (Iterator iterator = templates.iterator(); iterator.hasNext();) {
-            Template t = (Template) iterator.next();
+        for (Template t : templates) {
             templateName = getFinalTemplateName(t);
             try {
                 // try to load, and if it works, stop at the first one



Mime
View raw message