我有一个自定义服务/hayts进程、文件上传和元数据。
相同的文件在遵循MultiPart窗体教程时工作。
但是,当我将文件打包到我的股票申请中时。我可以加载表单,提交它来上传文件。但是后处理JS失败了。
Web脚本/share/page/hayts响应状态为500 -内部错误。 500描述:服务器内部的一个错误,它阻止了它完成请求。 'classpath*:alfresco/web-extension/site-webscripts/com/github/raystorm/smalgyax/hayts/hayts.post.js':消息: 11120001未能执行脚本 11120000 ReferenceError:"companyhome“未定义。(jar:file:/usr/local/tomcat/webapps/share/WEB-INF/lib/smalgyax-share-1.0.0-SNAPSHOT.jar!/alfresco/web-extension/site-webscripts/com/github/raystorm/smalgyax/hayts/hayts.post.js#35) 服务器: Spring WebScripts - v7.10.0模式1,000
对于以下一行:upload = companyhome.createFile(file.filename, type);
为什么在通过UI摄取/al新鲜it / service /multipart时工作,但对我的共享服务版本/共享/服务/hayts不起作用
发布于 2020-12-12 10:55:07
与您可能知道的不同之处在于,Alfresco是平台,共享是用户界面。
所以根对象对两者都是不一样的。
https://docs.alfresco.com/6.1/references/APISurf-rootscoped.html
https://docs.alfresco.com/4.2/references/API-JS-rootscoped.html
发布于 2020-12-14 22:12:24
可以使用FileFolderService在这个新文件夹中创建一个文件夹,然后创建一个文件。我们使用ServiceRegistry访问FileFolderService,将ServiceRegistry bean注入到Web控制器bean中。
/**
* Create a file under the passed in folder.
*
* @param folderInfo the folder that the file should be created in
* @param filename the name of the file
* @param fileTxt the content of the file
* @return a FileInfo object with data about the new file, such as NodeRef
*/
private FileInfo createFile(FileInfo folderInfo, String filename, String fileTxt) throws FileExistsException {
// Create the file under passed in folder, the file will be empty to start with
FileInfo fileInfo = serviceRegistry.getFileFolderService().create(
folderInfo.getNodeRef(), filename, ContentModel.TYPE_CONTENT);
// Get the NodeRef for the new file from the FileInfo object
NodeRef newFileNodeRef = fileInfo.getNodeRef();
// Add some content to the file
ContentWriter writer = serviceRegistry.getFileFolderService().getWriter(newFileNodeRef);
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.setEncoding("UTF-8");
writer.putContent(fileTxt);
return fileInfo;
}
https://stackoverflow.com/questions/65262074
复制相似问题