NIHVIVO-658 Removed response parameter from FreeMarkerHttpServlet.getFreeMarkerComponentsForJsp, since not needed.

This commit is contained in:
rjy7 2010-06-25 14:38:49 +00:00
parent 22eb6677f5
commit f77cf70224
4 changed files with 12 additions and 14 deletions

View file

@ -28,7 +28,7 @@ public class FreeMarkerComponentGenerator extends FreeMarkerHttpServlet {
private static ServletContext context = null;
FreeMarkerComponentGenerator(HttpServletRequest request, HttpServletResponse response) {
FreeMarkerComponentGenerator(HttpServletRequest request) {
VitroRequest vreq = new VitroRequest(request);
Configuration config = getConfig(vreq);

View file

@ -105,6 +105,8 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
@SuppressWarnings("unchecked")
protected Configuration getConfigForTheme(String themeDir) {
// The template loader is theme-specific because it specifies the theme template directory as a location to
// load templates from. Thus configurations are associated with themes rather than portals.
Map<String, Configuration> themeToConfigMap = (Map<String, Configuration>) (getServletContext().getAttribute("themeToConfigMap"));
if (themeToConfigMap.containsKey(themeDir)) {
@ -355,17 +357,6 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
return copyright;
}
// Default case is to set title first, because it's used in the body. However, in some cases
// the title is based on values computed during compilation of the body (e.g., IndividualListController).
// Individual controllers can override this method to set title and body together. End result must be:
// body is added to root with key "body"
// title is set as a shared variable with key "title"
// This can be achieved by making sure setBody() and setTitle() are called.
// protected void setTitleAndBody() {
// setTitle();
// setBody();
// }
// Subclasses will override. This serves as a default.
protected String getTitle(String siteName) {
return siteName;
@ -437,10 +428,10 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
// TEMPORARY method for transition from JSP to FreeMarker.
// It's a static method because it needs to be called from JSPs that don't go through a servlet.
public static void getFreeMarkerComponentsForJsp(HttpServletRequest request, HttpServletResponse response) {
public static void getFreeMarkerComponentsForJsp(HttpServletRequest request) {
// We need to create a FreeMarkerHttpServlet object in order to call the instance methods
// to set up the data model.
new FreeMarkerComponentGenerator(request, response);
new FreeMarkerComponentGenerator(request);
}
}

View file

@ -67,6 +67,10 @@ public class TestController extends FreeMarkerHttpServlet {
getBerries(body);
body.put("bookTitle", "Pride and Prejudice");
body.put("bookTitle", "Persuasion");
// Create the template to see the examples live.
String bodyTemplate = "test.ftl";
return mergeBodyToTemplate(bodyTemplate, body, config);

View file

@ -25,6 +25,9 @@
<p><strong>Animal:</strong> ${animal}</p>
<p><strong>Book Title:</strong> ${bookTitle}</p>
<h2>Zoo 1</h2>
<ul>
<#list zoo1.animals as animal>