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
This commit is contained in:
Andrew Zeneski
2007-03-09 20:12:44 +00:00
parent 7d671c5ded
commit 66cff5cd2a
2 changed files with 20 additions and 3 deletions
@@ -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
@@ -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;