From dcca019090247243111e0c48e8005b544681dd7d Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Wed, 27 Jun 2007 13:32:42 +0000 Subject: [PATCH] Fix AWC-999: Content encoding is displayed and is settable in the UI. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6120 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../service/cmr/repository/ContentData.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/java/org/alfresco/service/cmr/repository/ContentData.java b/source/java/org/alfresco/service/cmr/repository/ContentData.java index 59aa2201f5..1c7d0ce473 100644 --- a/source/java/org/alfresco/service/cmr/repository/ContentData.java +++ b/source/java/org/alfresco/service/cmr/repository/ContentData.java @@ -134,6 +134,26 @@ public class ContentData implements Serializable return ret; } + /** + * Constructs a new instance using the existing one as a template, but replacing the + * encoding. + * + * @param existing an existing set of content data, null to use default values + * @param encoding the encoding to set + * @return Returns a new, immutable instance of the data + */ + public static ContentData setEncoding(ContentData existing, String encoding) + { + ContentData ret = new ContentData( + existing == null ? null : existing.contentUrl, + existing == null ? null : existing.mimetype, + existing == null ? 0L : existing.size, + encoding, + existing == null ? null : existing.locale); + // done + return ret; + } + /** * Create a content data using the {@link I18NUtil#getLocale() default locale}. *