Skip to content

Commit ae3b657

Browse files
committed
Fixed: Improve ViewHandler interface (OFBIZ-13179)
After the migration on new interface to use the function prepareViewContext for FreeMarkerViewHandler, some calls present on groovy class weren't migrate and called the older function FreeMarkerViewHandler.prepOfbizRoot. Thanks Jacques Leroux for the detection
1 parent bec8add commit ae3b657

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

applications/content/src/main/groovy/org/apache/ofbiz/content/cms/CmsEditAddPrep.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ if (dataResourceId) {
6767
dataResource = from('DataResource').where('dataResourceId', dataResourceId).cache(true).queryOne()
6868
SimpleMapProcessor.runSimpleMapProcessor('component://content/minilang/ContentManagementMapProcessors.xml',
6969
'dataResourceOut', dataResource, contentAssocDataResourceViewFrom, [], Locale.getDefault())
70-
templateRoot = [:]
71-
FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response)
70+
templateRoot = new FreeMarkerViewHandler().prepareViewContext(request, response, null)
7271
txt = DataResourceWorker.getDataResourceText(dataResource, 'text/html', Locale.getDefault(), templateRoot, delegator, true)
7372

7473
if (txt) {

applications/content/src/main/groovy/org/apache/ofbiz/content/layout/EditSubContent.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ if (currentValue) {
3434
rootDir = request.getSession().getServletContext().getRealPath('/')
3535
wrapper = FreeMarkerWorker.getDefaultOfbizWrapper()
3636
WrappingTemplateModel.setDefaultObjectWrapper(wrapper)
37-
templateRoot = [:]
38-
FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response)
37+
templateRoot = new FreeMarkerViewHandler().prepareViewContext(request, response, null)
3938
ctx = [:]
4039
ctx.rootDir = rootDir
4140
// webSiteId and https need to go here, too

framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/FreeMarkerViewHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public Map<String, Object> prepareViewContext(HttpServletRequest request, HttpSe
8686

8787
// add the request parameters -- this now uses a Map from UtilHttp
8888
Map<String, Object> requestParameters = UtilHttp.getParameterMap(request);
89-
if (viewMap.isSecureContext()) {
89+
if (viewMap != null && viewMap.isSecureContext()) {
9090
requestParameters = SecuredFreemarker.sanitizeParameterMap(requestParameters);
9191
}
9292
root.put("requestParameters", requestParameters);

0 commit comments

Comments
 (0)