首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Alfresco共享中捆绑服务*.post.js文件中未定义的公司错误

Alfresco共享中捆绑服务*.post.js文件中未定义的公司错误
EN

Stack Overflow用户
提问于 2020-12-12 05:57:27
回答 2查看 140关注 0票数 0

我有一个自定义服务/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不起作用

EN

回答 2

Stack Overflow用户

发布于 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

票数 2
EN

Stack Overflow用户

发布于 2020-12-14 22:12:24

可以使用FileFolderService在这个新文件夹中创建一个文件夹,然后创建一个文件。我们使用ServiceRegistry访问FileFolderService,将ServiceRegistry bean注入到Web控制器bean中。

代码语言:javascript
运行
复制
 /**
     * 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;
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65262074

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档