NIHVIVO-658 Removed response parameter from FreeMarkerHttpServlet.getFreeMarkerComponentsForJsp, since not needed.
This commit is contained in:
parent
22eb6677f5
commit
f77cf70224
4 changed files with 12 additions and 14 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
@ -354,17 +356,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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -66,6 +66,10 @@ public class TestController extends FreeMarkerHttpServlet {
|
|||
body.put("zoo2", zoo2);
|
||||
|
||||
getBerries(body);
|
||||
|
||||
body.put("bookTitle", "Pride and Prejudice");
|
||||
body.put("bookTitle", "Persuasion");
|
||||
|
||||
|
||||
// Create the template to see the examples live.
|
||||
String bodyTemplate = "test.ftl";
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue