AnsweredAssumed Answered

problem setting encoding on ScriptContent

Question asked by rhofkens on Nov 23, 2007
Latest reply on Nov 27, 2007 by davidc
Hello,

[using Alf 210E]
I've built a webscript to upload files.  Everything works as expected, I just can't set the right content encoding.

The relevant lines of javascript:


  // create document in folder for uploaded file
  upload = uploadFolder.createFile(filename) ;
  upload.properties.content.write(content);
  //set correct mimetype and encoding
  upload.properties.content.mimetype = uploadMimeType;
  upload.properties.content.encoding = "UTF-8";
  upload.properties.title = title;
  upload.properties.description = description;
  upload.save();

Alfresco throws an error on the line where i set the encoding to UTF-8:


Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/klm/klmupload.post.js': Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/klm/klmupload.post.js': Java class "org.alfresco.repo.jscript.ScriptNode$ScriptContentData" has no public instance field or method named "encoding". (AlfrescoScript#50)

According to the Javascript documentation in the code, this property should be there.  I've checked the source code (org.alfresco.repo.jscript.ScriptNode.java) and haven't found a setter/getter for the encoding on ScriptContentData.  Is this a bug (didn't find it on JIRA) or am I missing something?

Cheers,
Roeland.

Outcomes