- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 19 Aug 2009 08:14:14 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv25234/src/org/w3c/unicorn/action
Modified Files:
Tag: dev2
IndexAction.java ObserveAction.java
Log Message:
worked on the new interface
Index: IndexAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/Attic/IndexAction.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -d -r1.1.2.10 -r1.1.2.11
--- IndexAction.java 17 Aug 2009 17:54:32 -0000 1.1.2.10
+++ IndexAction.java 19 Aug 2009 08:14:12 -0000 1.1.2.11
@@ -1,8 +1,6 @@
package org.w3c.unicorn.action;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Locale;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -12,6 +10,7 @@
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.w3c.unicorn.language.Language;
+import org.w3c.unicorn.util.Property;
import org.w3c.unicorn.Framework;
public class IndexAction extends Action {
@@ -19,12 +18,10 @@
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger("Index");
private VelocityContext velocityContext;
- //private ArrayList<String> templateList;
@Override
public void init() throws ServletException {
super.init();
- //templateList = new ArrayList<String>();
}
@@ -33,12 +30,17 @@
resp.setContentType("text/html; charset=UTF-8");
// Language negotiation
- String langParameter = req.getParameter("lang");
+ String langParameter = req.getParameter(Property.get("UNICORN_PARAMETER_PREFIX") + "lang");
if (langParameter == null || !Framework.getLanguageProperties().containsKey(langParameter))
langParameter = Language.negociate(req.getLocales());
velocityContext = new VelocityContext(Language.getContext(langParameter));
+ Framework.getTemplate("index").merge(velocityContext, resp.getWriter());
+ resp.getWriter().close();
+
+
+
// Contains a message ?
/*if (messages == null) {
@@ -97,43 +99,8 @@
private static VelocityEngine engine = new VelocityEngine();*/
- Framework.getTemplate("index").merge(velocityContext, resp.getWriter());
- resp.getWriter().close();
- try {
- //Properties aProperties = new Properties();
-
- /*aProperties.(
- Property.getProps("velocity.properties")
- );
+
- aProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, Property
- .get("PATH_TO_TEMPLATES"));*/
-
- /*Properties aProperties = Property.getProps("velocity.properties");
-
- aProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, Property
- .get("PATH_TO_TEMPLATES"));
-
- velocityEngine.init(aProperties);
-
- Template template = velocityEngine.getTemplate("index.vm", "UTF-8");
- Writer writer = resp.getWriter();
- template.merge(velocityContext, writer);*/
- //Template template = Framework.getVelocityEngine().getTemplate("index.vm", "UTF-8");
- //Writer writer = resp.getWriter();
- //template.merge(velocityContext, writer);
-
- //Framework.getTemplate("index").merge(velocityContext, resp.getWriter());
- } catch (ResourceNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ParseErrorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
}
@Override
Index: ObserveAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/Attic/ObserveAction.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -d -r1.1.2.6 -r1.1.2.7
--- ObserveAction.java 13 Aug 2009 13:42:41 -0000 1.1.2.6
+++ ObserveAction.java 19 Aug 2009 08:14:12 -0000 1.1.2.7
@@ -134,7 +134,7 @@
mapOfOutputParameter.put("lang", templateLang);
if (null == aLocale) {
- aUnicornCall.setLang(LocalizedString.DEFAULT_LANGUAGE);
+ aUnicornCall.setLang(Property.get("DEFAULT_LANGUAGE"));
} else {
aUnicornCall.setLang(templateLang + "," + aLocale);
}
@@ -250,7 +250,7 @@
}
if (null == aLocale) {
- aUnicornCall.setLang(LocalizedString.DEFAULT_LANGUAGE);
+ aUnicornCall.setLang(Property.get("DEFAULT_LANGUAGE"));
} else {
aUnicornCall.setLang(templateLang + "," + aLocale);
}
@@ -476,7 +476,7 @@
}
}
- return LocalizedString.DEFAULT_LANGUAGE;
+ return Property.get("DEFAULT_LANGUAGE");
}
/**
Received on Wednesday, 19 August 2009 08:14:23 UTC