Java 获取存储库Alfresco Restful中的所有文件夹和文档
我在户外学习。我想用Restful API获取存储库中的所有文件夹和文档。我如何才能做到这一点?我们可以使用alfresco的webscript创建restfull服务。要了解webscript,请访问下面的链接 下面是您需要创建的文件,用于创建列出文件夹的webscript 1.列出文件夹.get.desc.xmlJava 获取存储库Alfresco Restful中的所有文件夹和文档,java,api,rest,alfresco,Java,Api,Rest,Alfresco,我在户外学习。我想用Restful API获取存储库中的所有文件夹和文档。我如何才能做到这一点?我们可以使用alfresco的webscript创建restfull服务。要了解webscript,请访问下面的链接 下面是您需要创建的文件,用于创建列出文件夹的webscript 1.列出文件夹.get.desc.xml <webscript> <shortname>Folder Listing Utility</shortname> <descr
<webscript>
<shortname>Folder Listing Utility</shortname>
<description>Java-backed implementation of listing folder contents
</description>
<url>/javadir/{folderpath}?verbose={verbose?}</url>
<authentication>user</authentication>
</webscript>
<html>
<head>
<title>Folder ${folder.displayPath}/${folder.name}</title>
</head>
<body>
<p>Alfresco ${server.edition} Edition v${server.version} : dir</p>
<p>Contents of folder ${folder.displayPath}/${folder.name}</p>
<table>
<#list folder.children as child>
<tr>
<td><#if child.isContainer>d</#if></td>
<#if verbose>
<td>${child.properties.modifier}</td>
<td><#if child.isDocument>
${child.properties.content.size}</#if></td>
<td>${child.properties.modified?date}</td>
</#if>
<td>${child.name}</td>
</tr>
</#list>
</table>
</body>
</html>
文件夹列表实用程序
基于Java的文件夹内容列表实现
/javadir/{folderpath}?verbose={verbose?}
用户
2.列出文件夹.get.html.ftl
<webscript>
<shortname>Folder Listing Utility</shortname>
<description>Java-backed implementation of listing folder contents
</description>
<url>/javadir/{folderpath}?verbose={verbose?}</url>
<authentication>user</authentication>
</webscript>
<html>
<head>
<title>Folder ${folder.displayPath}/${folder.name}</title>
</head>
<body>
<p>Alfresco ${server.edition} Edition v${server.version} : dir</p>
<p>Contents of folder ${folder.displayPath}/${folder.name}</p>
<table>
<#list folder.children as child>
<tr>
<td><#if child.isContainer>d</#if></td>
<#if verbose>
<td>${child.properties.modifier}</td>
<td><#if child.isDocument>
${child.properties.content.size}</#if></td>
<td>${child.properties.modified?date}</td>
</#if>
<td>${child.name}</td>
</tr>
</#list>
</table>
</body>
</html>
文件夹${Folder.displayPath}/${Folder.name}
Alfresco${server.edition}edition v${server.version}:dir
文件夹${folder.displayPath}/${folder.name}的内容
D
${child.properties.modifier}
${child.properties.content.size}
${child.properties.modified?date}
${child.name}
web脚本描述指定一个URI模板,其中包含标记{folderpath}和{verbose?}。folderpath标记表示要列出的文件夹,详细URI参数指定是否需要详细列表。HTML响应模板呈现指定文件夹的内容,并考虑详细标志。它通过访问名为folder和verbose的web脚本模型值来实现这一点
您需要将上面的文件放在下面的路径中
公司主页>数据字典>Web脚本扩展>orgWeb脚本是构建您自己的API的好方法,但在这种情况下,您应该可以使用Alfresco为您提供的buildin API 您可以使用restapi getsubstands调用获取所有文件夹/文档。 有关详细信息,请参见API规范: 它返回树中定义级别数的指定文件夹的子对象列表
GET /alfresco/service/api/node/{store_type}/{store_id}/{id}/descendants?types={types}&filter={filter?}&depth={depth?}
它从ID参数标识的文件夹开始,并将可选参数应用于调用。这意味着您可以按类型(文档、文件夹等)进行过滤,并定义要查询的深度。使用-1返回所有级别。可以使用以下端点获取文档和文件夹列表
GET /alfresco/service/slingshot/doclib/doclist/{type}/site/{site}/{container}
type = documents or folders
container = documentLibrary
参考:
此处有可用的浏览器Web脚本:
http://server:port/alfresco/service/index/all
文档列表Webscript
http://server:port/alfresco/service/script/org/alfresco/slingshot/documentlibrary/doclist.get
Alfresco版本:Community v5.0.0我收到一个404错误,说明说请求的资源不可用。。我是否需要启用任何模块或安装任何其他web脚本?我的alfresco安装版本是:5.0,我使用的是社区版