2006/unicorn/src/org/w3c/unicorn/action IndexAction.java,1.1.2.14,1.1.2.15

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv32542/src/org/w3c/unicorn/action

Modified Files:
      Tag: dev2
	IndexAction.java 
Log Message:
removed template caching which is already supported by velocity

Index: IndexAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/Attic/IndexAction.java,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -u -d -r1.1.2.14 -r1.1.2.15
--- IndexAction.java	21 Aug 2009 07:04:44 -0000	1.1.2.14
+++ IndexAction.java	24 Aug 2009 09:16:10 -0000	1.1.2.15
@@ -9,6 +9,7 @@
 import org.apache.velocity.VelocityContext;
 import org.w3c.unicorn.language.Language;
 import org.w3c.unicorn.util.Property;
+import org.w3c.unicorn.util.Templates;
 import org.w3c.unicorn.Framework;
 
 public class IndexAction extends Action {
@@ -32,7 +33,7 @@
 		// Language negotiation
 		String langParameter = req.getParameter(Property.get("UNICORN_PARAMETER_PREFIX") + "lang");
 		if (langParameter == null || !Framework.getLanguageProperties().containsKey(langParameter))
-			langParameter = Language.negociate(req.getLocales()); 
+			langParameter = Language.negociate(req.getLocales());
 		
 		velocityContext = new VelocityContext(Language.getContext(langParameter));
 		
@@ -43,11 +44,17 @@
 		velocityContext.put("current_task", Framework.mapOfTask.get(taskParameter));
 		
 		if (req.getHeader("X-Requested-With") != null && req.getHeader("X-Requested-With").equals("XMLHttpRequest")) {
-			
-			Framework.getTemplate("parameters").merge(velocityContext, resp.getWriter());
+			//for JavaScript testing purposes
+			/*long s = System.currentTimeMillis();
+			long t;
+			do {
+				 t = System.currentTimeMillis();
+			} while ((t - s) < 3000);*/
+			// -----------------
+			Templates.write("parameters.vm", velocityContext, resp.getWriter());
 			resp.getWriter().close();
 		} else {
-			Framework.getTemplate("index").merge(velocityContext, resp.getWriter());
+			Templates.write("index.vm", velocityContext, resp.getWriter());
 			resp.getWriter().close();
 		}
 	}

Received on Monday, 24 August 2009 09:16:22 UTC