Author: jleroux
Date: Tue Nov 24 21:10:24 2015 New Revision: 1716261 URL: http://svn.apache.org/viewvc?rev=1716261&view=rev Log: Implements "Can not display product category name in Unicode." https://issues.apache.org/jira/browse/OFBIZ-6739 Rerported by Thanakrit Wongyued I found problem to display product category name in Unicode (Thai UTF-8) . The problem is services in CategoryContentWrapper are create content mimeType in "text/html". Then i try to fixed this problem by replace "text/html" with "text/html; charset=utf-8". After that i recompile and restart OFBiz the problem is disappear. jleroux: uses a new defaultMimeType content property, defaulting to "text/html; charset=utf-8", retrieved by EntityUtilProperties.getPropertyValue() Modified: ofbiz/trunk/applications/content/config/content.properties ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java Modified: ofbiz/trunk/applications/content/config/content.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/content.properties?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/content/config/content.properties (original) +++ ofbiz/trunk/applications/content/config/content.properties Tue Nov 24 21:10:24 2015 @@ -34,4 +34,7 @@ content.upload.max.files=250 content.upload.always.local.file=true # content output folder (relative to ofbiz.home) -content.output.path=runtime/output \ No newline at end of file +content.output.path=runtime/output + +# default mime type used in *ContentWrapper classes +defaultMimeType=text/html; charset=utf-8 \ No newline at end of file Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java Tue Nov 24 21:10:24 2015 @@ -39,6 +39,7 @@ import org.ofbiz.content.content.Content import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.util.EntityQuery; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.LocalDispatcher; /** @@ -72,7 +73,7 @@ public class OrderContentWrapper impleme this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); this.order = order; this.locale = UtilHttp.getLocale(request); - this.mimeTypeId = "text/html"; + this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", (Delegator) request.getAttribute("delegator")); } public StringUtil.StringWrapper get(String orderContentTypeId, String encoderType) { @@ -81,7 +82,8 @@ public class OrderContentWrapper impleme public static String getOrderContentAsText(GenericValue order, String orderContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getOrderContentAsText(order, orderContentTypeId, UtilHttp.getLocale(request), "text/html", order.getDelegator(), dispatcher, encoderType); + String mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", order.getDelegator()); + return getOrderContentAsText(order, orderContentTypeId, UtilHttp.getLocale(request), mimeTypeId, order.getDelegator(), dispatcher, encoderType); } public static String getOrderContentAsText(GenericValue order, String orderContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { @@ -141,7 +143,7 @@ public class OrderContentWrapper impleme } if (UtilValidate.isEmpty(mimeTypeId)) { - mimeTypeId = "text/html"; + mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator); } GenericValue orderContent = EntityQuery.use(delegator).from("OrderContent") Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy Tue Nov 24 21:10:24 2015 @@ -21,13 +21,15 @@ // parameters or use orderId, invoiceId, or returnId to look them up. // if none of these parameters are available then fromPartyId is used or "ORGANIZATION_PARTY" from general.properties as fallback +import java.sql.Timestamp; + import org.ofbiz.base.util.*; import org.ofbiz.entity.*; import org.ofbiz.entity.util.*; import org.ofbiz.party.contact.*; import org.ofbiz.order.order.OrderReadHelper; -import java.sql.Timestamp; import org.ofbiz.party.content.PartyContentWrapper; +import org.ofbiz.entity.util.EntityUtilProperties; orderHeader = parameters.orderHeader; orderId = parameters.orderId; @@ -126,10 +128,10 @@ if (!partyId) { // the logo partyGroup = from("PartyGroup").where("partyId", partyId).queryOne(); if (partyGroup) { - partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, locale, "text/html"); + partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator)); partyContent = partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, "LGOIMGURL", delegator); if (partyContent) { - logoImageUrl = "/content/control/stream?contentId="+partyContent.contentId; + logoImageUrl = "/content/control/stream?contentId=" + partyContent.contentId; } else { if (partyGroup?.logoImageUrl) { logoImageUrl = partyGroup.logoImageUrl; Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java Tue Nov 24 21:10:24 2015 @@ -46,6 +46,7 @@ import org.ofbiz.entity.model.ModelEntit import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.LocalDispatcher; /** @@ -74,7 +75,7 @@ public class PartyContentWrapper impleme this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); this.party = party; this.locale = UtilHttp.getLocale(request); - this.mimeTypeId = "text/html"; + this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", (Delegator) request.getAttribute("delegator")); } // interface implementation @@ -115,7 +116,8 @@ public class PartyContentWrapper impleme // static methods public static String getPartyContentAsText(GenericValue party, String partyContentId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getPartyContentAsText(party, partyContentId, null, UtilHttp.getLocale(request), "text/html", party.getDelegator(), dispatcher, true,encoderType); + String mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", party.getDelegator()); + return getPartyContentAsText(party, partyContentId, null, UtilHttp.getLocale(request), mimeTypeId, party.getDelegator(), dispatcher, true,encoderType); } public static String getPartyContentAsText(GenericValue party, String partyContentId, Locale locale, LocalDispatcher dispatcher, String encoderType) { @@ -190,7 +192,7 @@ public class PartyContentWrapper impleme } if (UtilValidate.isEmpty(mimeTypeId)) { - mimeTypeId = "text/html"; + mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator); } if (delegator == null) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java Tue Nov 24 21:10:24 2015 @@ -45,6 +45,7 @@ import org.ofbiz.entity.model.ModelEntit import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.LocalDispatcher; /** @@ -76,7 +77,7 @@ public class CategoryContentWrapper impl this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); this.productCategory = productCategory; this.locale = UtilHttp.getLocale(request); - this.mimeTypeId = "text/html"; + this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", (Delegator) request.getAttribute("delegator")); } public StringUtil.StringWrapper get(String prodCatContentTypeId, String encoderType) { @@ -85,7 +86,8 @@ public class CategoryContentWrapper impl public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, UtilHttp.getLocale(request), "text/html", productCategory.getDelegator(), dispatcher, encoderType); + String mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", productCategory.getDelegator()); + return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, UtilHttp.getLocale(request), mimeTypeId, productCategory.getDelegator(), dispatcher, encoderType); } public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { @@ -136,7 +138,7 @@ public class CategoryContentWrapper impl } if (UtilValidate.isEmpty(mimeTypeId)) { - mimeTypeId = "text/html"; + mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator); } if (delegator == null) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java Tue Nov 24 21:10:24 2015 @@ -32,6 +32,7 @@ import org.ofbiz.base.util.template.Free import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.product.category.CatalogUrlFilter; import org.ofbiz.product.category.CategoryContentWrapper; import org.ofbiz.product.category.SeoConfigUtil; @@ -149,7 +150,7 @@ public class CatalogAltUrlSeoTransform i } if (UtilValidate.isNotEmpty(productId)) { GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); - ProductContentWrapper wrapper = new ProductContentWrapper(dispatcher, product, locale, "text/html"); + ProductContentWrapper wrapper = new ProductContentWrapper(dispatcher, product, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator)); if (SeoConfigUtil.isCategoryUrlEnabled(contextPath)) { url = CatalogUrlSeoTransform.makeProductUrl(delegator, wrapper, prefixString, contextPath, productCategoryId, previousCategoryId, productId); } else { @@ -158,7 +159,7 @@ public class CatalogAltUrlSeoTransform i } } else { GenericValue productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), false); - CategoryContentWrapper wrapper = new CategoryContentWrapper(dispatcher, productCategory, locale, "text/html"); + CategoryContentWrapper wrapper = new CategoryContentWrapper(dispatcher, productCategory, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator)); if (SeoConfigUtil.isCategoryUrlEnabled(contextPath)) { url = CatalogUrlSeoTransform.makeCategoryUrl(delegator, wrapper, prefixString, productCategoryId, previousCategoryId, productId, viewSize, viewIndex, viewSort, searchString); } else { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java Tue Nov 24 21:10:24 2015 @@ -31,6 +31,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.util.EntityQuery; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.product.category.CatalogUrlFilter; import org.ofbiz.product.category.CategoryContentWrapper; import org.ofbiz.product.product.ProductContentWrapper; @@ -132,11 +133,11 @@ public class OfbizCatalogAltUrlTransform Locale locale = (Locale) args.get("locale"); if (UtilValidate.isNotEmpty(productId)) { GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); - ProductContentWrapper wrapper = new ProductContentWrapper(dispatcher, product, locale, "text/html"); + ProductContentWrapper wrapper = new ProductContentWrapper(dispatcher, product, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator)); url = CatalogUrlFilter.makeProductUrl(delegator, wrapper, null, ((StringModel) prefix).getAsString(), previousCategoryId, productCategoryId, productId); } else { GenericValue productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).queryOne(); - CategoryContentWrapper wrapper = new CategoryContentWrapper(dispatcher, productCategory, locale, "text/html"); + CategoryContentWrapper wrapper = new CategoryContentWrapper(dispatcher, productCategory, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator)); url = CatalogUrlFilter.makeCategoryUrl(delegator, wrapper, null, ((StringModel) prefix).getAsString(), previousCategoryId, productCategoryId, productId, viewSize, viewIndex, viewSort, searchString); } out.write(url.toString()); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java Tue Nov 24 21:10:24 2015 @@ -43,6 +43,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityQuery; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ServiceContainer; @@ -85,7 +86,7 @@ public class ProductConfigItemContentWra this.delegatorName = delegator.getDelegatorName(); this.productConfigItem = productConfigItem; this.locale = UtilHttp.getLocale(request); - this.mimeTypeId = "text/html"; + this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", this.delegator); } public StringWrapper get(String confItemContentTypeId, String encoderType) { @@ -108,7 +109,8 @@ public class ProductConfigItemContentWra public static String getProductConfigItemContentAsText(GenericValue productConfigItem, String confItemContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getProductConfigItemContentAsText(productConfigItem, confItemContentTypeId, UtilHttp.getLocale(request), "text/html", productConfigItem.getDelegator(), dispatcher, encoderType); + String mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", productConfigItem.getDelegator()); + return getProductConfigItemContentAsText(productConfigItem, confItemContentTypeId, UtilHttp.getLocale(request), mimeTypeId, productConfigItem.getDelegator(), dispatcher, encoderType); } public static String getProductConfigItemContentAsText(GenericValue productConfigItem, String confItemContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { @@ -161,7 +163,7 @@ public class ProductConfigItemContentWra } if (UtilValidate.isEmpty(mimeTypeId)) { - mimeTypeId = "text/html"; + mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator); } String candidateFieldName = ModelUtil.dbNameToVarName(confItemContentTypeId); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java Tue Nov 24 21:10:24 2015 @@ -44,6 +44,7 @@ import org.ofbiz.entity.model.ModelEntit import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.LocalDispatcher; /** @@ -76,7 +77,7 @@ public class ProductContentWrapper imple this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); this.product = product; this.locale = UtilHttp.getLocale(request); - this.mimeTypeId = "text/html"; + this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", (Delegator) request.getAttribute("delegator")); } public StringUtil.StringWrapper get(String productContentTypeId, String encoderType) { @@ -89,7 +90,8 @@ public class ProductContentWrapper imple public static String getProductContentAsText(GenericValue product, String productContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getProductContentAsText(product, productContentTypeId, UtilHttp.getLocale(request), "text/html", null, null, product.getDelegator(), dispatcher, encoderType); + String mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", product.getDelegator()); + return getProductContentAsText(product, productContentTypeId, UtilHttp.getLocale(request), mimeTypeId, null, null, product.getDelegator(), dispatcher, encoderType); } public static String getProductContentAsText(GenericValue product, String productContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { @@ -151,7 +153,7 @@ public class ProductContentWrapper imple } if (UtilValidate.isEmpty(mimeTypeId)) { - mimeTypeId = "text/html"; + mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator); } if (delegator == null) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java Tue Nov 24 21:10:24 2015 @@ -48,6 +48,7 @@ import org.ofbiz.entity.model.ModelEntit import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.LocalDispatcher; /** @@ -80,7 +81,7 @@ public class ProductPromoContentWrapper this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); this.productPromo = productPromo; this.locale = UtilHttp.getLocale(request); - this.mimeTypeId = "text/html"; + this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", (Delegator) request.getAttribute("delegator")); } public StringUtil.StringWrapper get(String productPromoContentTypeId, String encoderType) { @@ -93,7 +94,10 @@ public class ProductPromoContentWrapper public static String getProductPromoContentAsText(GenericValue productPromo, String productPromoContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getProductPromoContentAsText(productPromo, productPromoContentTypeId, UtilHttp.getLocale(request), "text/html", null, null, productPromo.getDelegator(), dispatcher, encoderType); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + return getProductPromoContentAsText(productPromo, productPromoContentTypeId, UtilHttp.getLocale(request), + EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator), + null, null, productPromo.getDelegator(), dispatcher, encoderType); } public static String getProductContentAsText(GenericValue productPromo, String productPromoContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { @@ -154,7 +158,7 @@ public class ProductPromoContentWrapper } if (UtilValidate.isEmpty(mimeTypeId)) { - mimeTypeId = "text/html"; + mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator); } if (UtilValidate.isEmpty(delegator)) { Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java Tue Nov 24 21:10:24 2015 @@ -45,6 +45,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityQuery; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.LocalDispatcher; /** @@ -72,7 +73,7 @@ public class WorkEffortContentWrapper im public WorkEffortContentWrapper(GenericValue workEffort, HttpServletRequest request) { this.workEffort = workEffort; this.locale = UtilHttp.getLocale(request); - this.mimeTypeId = "text/html"; + this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", (Delegator) request.getAttribute("delegator")); } // interface implementation(s) @@ -210,7 +211,8 @@ public class WorkEffortContentWrapper im // static method helpers public static String getWorkEffortContentAsText(GenericValue workEffort, String workEffortContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getWorkEffortContentAsText(workEffort, workEffortContentTypeId, UtilHttp.getLocale(request), "text/html", workEffort.getDelegator(), dispatcher, true, encoderType); + String mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", workEffort.getDelegator()); + return getWorkEffortContentAsText(workEffort, workEffortContentTypeId, UtilHttp.getLocale(request), mimeTypeId, workEffort.getDelegator(), dispatcher, true, encoderType); } public static String getWorkEffortContentAsText(GenericValue workEffort, String workEffortContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { @@ -284,7 +286,7 @@ public class WorkEffortContentWrapper im } if (UtilValidate.isEmpty(mimeTypeId)) { - mimeTypeId = "text/html"; + mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator); } if (delegator == null) { Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java?rev=1716261&r1=1716260&r2=1716261&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java Tue Nov 24 21:10:24 2015 @@ -249,7 +249,7 @@ public class ProductsExportToEbay { startPriceCurrencyUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator); } startPriceElem.setAttribute("currencyID", startPriceCurrencyUomId); - }else{ + } else { Element startPriceElem = UtilXml.addChildElementValue(itemElem, "StartPrice", startPrice, itemDocument); if (UtilValidate.isEmpty(startPriceCurrencyUomId)) { startPriceCurrencyUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator); @@ -264,7 +264,7 @@ public class ProductsExportToEbay { } } - ProductContentWrapper pcw = new ProductContentWrapper(dctx.getDispatcher(), prod, locale, "text/html"); + ProductContentWrapper pcw = new ProductContentWrapper(dctx.getDispatcher(), prod, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator)); StringUtil.StringWrapper ebayDescription = pcw.get("EBAY_DESCRIPTION", "html"); if (UtilValidate.isNotEmpty(ebayDescription.toString())) { UtilXml.addChildElementCDATAValue(itemElem, "Description", ebayDescription.toString(), itemDocument); |
Free forum by Nabble | Edit this page |