From 3102d8bce3426d9cf41aeaf201c360d342677770 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sat, 9 Apr 2016 14:22:20 -0700 Subject: Switching from Ivy+Ant to Maven. --- src/com/p4square/grow/frontend/ErrorPage.java | 77 --------------------------- 1 file changed, 77 deletions(-) delete mode 100644 src/com/p4square/grow/frontend/ErrorPage.java (limited to 'src/com/p4square/grow/frontend/ErrorPage.java') diff --git a/src/com/p4square/grow/frontend/ErrorPage.java b/src/com/p4square/grow/frontend/ErrorPage.java deleted file mode 100644 index 81abe74..0000000 --- a/src/com/p4square/grow/frontend/ErrorPage.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2013 Jesse Morgan - */ - -package com.p4square.grow.frontend; - -import java.util.HashMap; -import java.util.Map; - -import java.io.IOException; -import java.io.Writer; - -import freemarker.template.Template; - -import org.restlet.data.MediaType; -import org.restlet.ext.freemarker.TemplateRepresentation; -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. - * - * @author Jesse Morgan - */ -public class ErrorPage extends WriterRepresentation { - public static final ErrorPage TEMPLATE_NOT_FOUND = - new ErrorPage("Could not find the requested page template."); - - public static final ErrorPage RENDER_ERROR = - new ErrorPage("Error rendering page."); - - public static final ErrorPage BACKEND_ERROR = - new ErrorPage("Error communicating with backend."); - - public static final ErrorPage NOT_FOUND = - new ErrorPage("The requested URL could not be found."); - - private static Template cTemplate = null; - private static Map cRoot = null; - - private final String mMessage; - - public ErrorPage(String msg) { - this(msg, MediaType.TEXT_HTML); - } - - public ErrorPage(String msg, MediaType mediaType) { - super(mediaType); - - mMessage = msg; - } - - public static synchronized void setTemplate(Template template, Map root) { - cTemplate = template; - cRoot = root; - } - - protected Representation getRepresentation() { - if (cTemplate == null) { - return new StringRepresentation(mMessage); - - } else { - Map root = new HashMap(cRoot); - root.put("errorMessage", mMessage); - return new TemplateRepresentation(cTemplate, root, MediaType.TEXT_HTML); - } - } - - @Override - public void write(Writer writer) throws IOException { - getRepresentation().write(writer); - } -} -- cgit v1.2.3