[gogoego] r3705 committed - run template against a faux template first

1 view
Skip to first unread message

codesite...@google.com

unread,
Jul 9, 2010, 2:27:20 PM7/9/10
to gog...@googlegroups.com
Revision: 3705
Author: carl....@solertium.com
Date: Fri Jul 9 11:20:19 2010
Log: run template against a faux template first
http://code.google.com/p/gogoego/source/detail?r=3705

Modified:

/trunk/modules/com.solertium.gogoego.server.extensions.forms/src/com/solertium/gogoego/server/extensions/forms/processing/HTMLFormProcessor.java

=======================================
---
/trunk/modules/com.solertium.gogoego.server.extensions.forms/src/com/solertium/gogoego/server/extensions/forms/processing/HTMLFormProcessor.java
Tue Sep 8 15:00:39 2009
+++
/trunk/modules/com.solertium.gogoego.server.extensions.forms/src/com/solertium/gogoego/server/extensions/forms/processing/HTMLFormProcessor.java
Fri Jul 9 11:20:19 2010
@@ -23,12 +23,15 @@
package com.solertium.gogoego.server.extensions.forms.processing;

import java.io.IOException;
+import java.util.Calendar;
import java.util.List;

import javax.activation.DataSource;

import org.gogoego.api.applications.ServerApplicationAPI;
import org.gogoego.api.plugins.GoGoEgo;
+import org.gogoego.api.representations.GoGoEgoBaseRepresentation;
+import org.gogoego.api.representations.GoGoEgoStringRepresentation;
import org.restlet.Context;
import org.restlet.data.Form;

@@ -74,9 +77,30 @@
return null;

try {
- return vfs.getString(uri);
- } catch (IOException e) {
- return null;
+ final GoGoEgoStringRepresentation templateRepresentation;
+
+ try {
+ templateRepresentation = new
GoGoEgoStringRepresentation(vfs.getString(uri));
+
templateRepresentation.setModificationDate(Calendar.getInstance().getTime());
+
templateRepresentation.setExpirationDate(Calendar.getInstance().getTime());
+ } catch (IOException e) {
+ return null;
+ }
+
+ final GoGoEgoBaseRepresentation blank = new
GoGoEgoStringRepresentation("");
+ blank.setModificationDate(Calendar.getInstance().getTime());
+ blank.setExpirationDate(Calendar.getInstance().getTime());
+
+ final GoGoEgoBaseRepresentation result =
GoGoEgo.get().applyTemplating(templateRepresentation, blank);
+
+ return result == null ? null : result.getContent();
+ } catch (Exception e) {
+ e.printStackTrace();
+ try {
+ return vfs.getString(uri);
+ } catch (IOException f) {
+ return null;
+ }
}
}

Reply all
Reply to author
Forward
0 new messages