summaryrefslogtreecommitdiff
path: root/src/com/p4square/grow/frontend
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2013-10-18 15:16:42 -0700
committerJesse Morgan <jesse@jesterpm.net>2013-10-18 15:16:42 -0700
commit82e4493f4b376a79867c55ab7daa4cbbfedf1bda (patch)
tree884189d66a9b33b51d5de4b0eee9b220cb2010fc /src/com/p4square/grow/frontend
parenta0d33fcdfe454c6fdac236ce7fc665536ba580d9 (diff)
Fixing config issues when not running in tomcat
Diffstat (limited to 'src/com/p4square/grow/frontend')
-rw-r--r--src/com/p4square/grow/frontend/ErrorPage.java8
-rw-r--r--src/com/p4square/grow/frontend/GrowFrontend.java2
2 files changed, 7 insertions, 3 deletions
diff --git a/src/com/p4square/grow/frontend/ErrorPage.java b/src/com/p4square/grow/frontend/ErrorPage.java
index 721b477..5ae64d9 100644
--- a/src/com/p4square/grow/frontend/ErrorPage.java
+++ b/src/com/p4square/grow/frontend/ErrorPage.java
@@ -18,6 +18,8 @@ import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.representation.WriterRepresentation;
+import com.p4square.fmfacade.FreeMarkerPageResource;
+
/**
* ErrorPage wraps a String or Template Representation and displays the given
* error message.
@@ -35,6 +37,7 @@ public class ErrorPage extends WriterRepresentation {
new ErrorPage("Error communicating with backend.");
private static Template cTemplate = null;
+ private static Map<String, Object> cRoot = null;
private final String mMessage;
@@ -48,8 +51,9 @@ public class ErrorPage extends WriterRepresentation {
mMessage = msg;
}
- public static synchronized void setTemplate(Template template) {
+ public static synchronized void setTemplate(Template template, Map<String, Object> root) {
cTemplate = template;
+ cRoot = root;
}
protected Representation getRepresentation() {
@@ -57,7 +61,7 @@ public class ErrorPage extends WriterRepresentation {
return new StringRepresentation(mMessage);
} else {
- Map<String, Object> root = new HashMap<String, Object>();
+ Map<String, Object> root = new HashMap<String, Object>(cRoot);
root.put("errorMessage", mMessage);
return new TemplateRepresentation(cTemplate, root, MediaType.TEXT_HTML);
}
diff --git a/src/com/p4square/grow/frontend/GrowFrontend.java b/src/com/p4square/grow/frontend/GrowFrontend.java
index ecb2475..327554e 100644
--- a/src/com/p4square/grow/frontend/GrowFrontend.java
+++ b/src/com/p4square/grow/frontend/GrowFrontend.java
@@ -67,7 +67,7 @@ public class GrowFrontend extends FMFacade {
public synchronized void start() throws Exception {
Template errorTemplate = getTemplate("templates/error.ftl");
if (errorTemplate != null) {
- ErrorPage.setTemplate(errorTemplate);
+ ErrorPage.setTemplate(errorTemplate, FreeMarkerPageResource.baseRootObject(getContext()));
}
super.start();