From 66cff5cd2a22d6cf2fd1787cb1bf7d2f5837dbf7 Mon Sep 17 00:00:00 2001 From: Andrew Zeneski Date: Fri, 9 Mar 2007 20:12:44 +0000 Subject: [PATCH] implemented default page WS content type; changed URL_RESOURCE to support component:// resources git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@516536 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/ofbiz/content/cms/CmsEvents.java | 19 +++++++++++++++++-- .../content/data/DataResourceWorker.java | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) 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;