Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Alfresco 如何在户外访问文档?_Alfresco_Opencmis - Fatal编程技术网

Alfresco 如何在户外访问文档?

Alfresco 如何在户外访问文档?,alfresco,opencmis,Alfresco,Opencmis,我创建了一个户外放大器项目。 要添加文档,我运行以下测试类: 公开课考试{ public static void mainString[]args引发不支持的DencodingException{ Map sessionParameters=新HashMap; sessionParameters.putSessionParameter.USER,管理员; sessionParameters.putSessionParameter.PASSWORD,管理员; sessionParameters.

我创建了一个户外放大器项目。 要添加文档,我运行以下测试类:

公开课考试{ public static void mainString[]args引发不支持的DencodingException{ Map sessionParameters=新HashMap; sessionParameters.putSessionParameter.USER,管理员; sessionParameters.putSessionParameter.PASSWORD,管理员; sessionParameters.putSessionParameter.ATOMPUB_URL,http://localhost:8080/alfresco/api/-默认-/public/cmis/versions/1.1/atom; sessionParameters.putSessionParameter.BINDING_类型,BindingType.ATOMPUB.value; SessionFactory SessionFactory=SessionFactoryImpl.newInstance; Session lSession=sessionFactory.getRepositoriessessionParameters.get0.createSession; 文件夹根=lSession.getRootFolder; Map folderProperties=新HashMap; folderProperties.PutPropertyId.OBJECT_TYPE_ID,cmis:文件夹; folderProperties.PutPropertyId.NAME,oo; 文件夹newFolder=root.createFolderfolderProperties; Map lproperty=新HashMap; 字符串名称=lol.txt; lProperties.putPropertyIds.OBJECT\u TYPE\u ID,cmis:document; lproperty.putPropertyIds.NAME,NAME; byte[]content=CMIS Testdata One.getBytes; InputStream=新的ByteArrayInputStreamcontent; ContentStream ContentStream=new ContentStreamImplname,new BigIntegercontent,text/plain,stream; Document newContent1=newFolder.createDocumentProperties,contentStream,null; 创建的System.out.println文档:+newContent1.getId; }
} 看起来您已经创建了一个文档,现在您想知道使用哪个URL访问它。你有很多选择,其中一些包括

使用Alfresco web应用程序的下载URL:

使用共享web应用的下载URL:

使用CMIS URL AtomPub绑定:

使用CMIS URL浏览器绑定:

编写自己的URL处理程序,通过CMIS获取输入流并将该流返回给请求者。假设您使用的是类似Spring MVC的东西,其代码可能如下所示:

public InputStream download(String objectId) {
    Session session = getSession();
    CmisObject obj = session.getObject(objectId);
    Document doc = null;
    if (obj.getBaseTypeId().equals(BaseTypeId.CMIS_DOCUMENT)) {
        doc = (Document) obj;
    }
    return doc.getContentStream().getStream();
}
上述每个选项都假定测试文件夹test.txt中有一个测试文件,其Alfresco节点引用为:

workspace://SpacesStore/dac36aab-dd49-4abc-a4bc-0e0d5729c9ad

以及CMIS对象ID:


DAC36AB-dd49-4abc-a4bc-0e0d5729c9ad;1.0

如何访问它?通过共享?通过CMIS?下载另外