diff --git a/applications/content/src/org/ofbiz/content/cms/CmsEvents.java b/applications/content/src/org/ofbiz/content/cms/CmsEvents.java index 5ce8b585df..7897d4214c 100644 --- a/applications/content/src/org/ofbiz/content/cms/CmsEvents.java +++ b/applications/content/src/org/ofbiz/content/cms/CmsEvents.java @@ -94,6 +94,23 @@ public class CmsEvents { } } // if called through the default request, there is no request in pathinfo + + // if path info is null; check for a default content + if (pathInfo == null) { + List defaultContents = null; + try { + defaultContents = delegator.findByAnd("WebSiteContent", UtilMisc.toMap("webSiteId", webSiteId, + "webSiteContentTypeId", "DEFAULT_PAGE"), UtilMisc.toList("-fromDate")); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + defaultContents = EntityUtil.filterByDate(defaultContents); + GenericValue defaultContent = EntityUtil.getFirst(defaultContents); + if (defaultContent != null) { + pathInfo = defaultContent.getString("contentId"); + } + } + // check for path alias first if (pathInfo != null) { // clean up the pathinfo for parsing @@ -137,8 +154,6 @@ public class CmsEvents { } // process through CMS -- using the mapKey (for now) - GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); - Timestamp fromDate = UtilDateTime.nowTimestamp(); Locale locale = UtilHttp.getLocale(request); // get the contentId/mapKey from URL diff --git a/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java b/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java index 1698e9fecf..58b4eaa3ca 100644 --- a/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java +++ b/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java @@ -44,6 +44,7 @@ import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.collections.MapStack; import org.ofbiz.base.util.template.FreeMarkerWorker; +import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.content.content.UploadContentAndImage; import org.ofbiz.content.email.NotificationServices; import org.ofbiz.entity.GenericDelegator; @@ -759,7 +760,8 @@ public class DataResourceWorker { // resource type } else if (dataResourceTypeId.equals("URL_RESOURCE")) { String text = null; - URL url = new URL(dataResource.getString("objectInfo")); + URL url = FlexibleLocation.resolveLocation(dataResource.getString("objectInfo")); + if (url.getHost() != null) { // is absolute InputStream in = url.openStream(); int c;