我的Alfresco(4.1.5)存储库中有一个文件,我想通过Alfresco服务REST API读取其中的内容。对于查找,我想使用文件路径,而不是 UUID。但是,按路径查找不起作用,只有 UUID 查找有效。我找不到错误。
这是文件路径:
显示路径和文件名:
/Company Home/Data Dictionary/Cleaner Configs/cleaner.properties
QNamePath:
/app:company_home/app:dictionary/cm:Cleaner_x0020_Configs/cm:cleaner.properties
UUID 查找适用于以下 REST API URL:
http://localhost:8080/alfresco/service/cmis/i/2391adf9-365c-4959-bf30-8f001154c100/content
但是,仅按路径查找不起作用。既不使用主路径,也不使用显示路径:
http://localhost:8080/alfresco/service/cmis/p/app:company_home/app:dictionary/cm:Cleaner_x0020_Configs/cm:cleaner.properties/content?a=false
http://localhost:8080/alfresco/service/cmis/p/Company%20Home/Data%20Dictionary/Cleaner%20Configs/cleaner.properties/content?a=false
在这两种情况下,我都收到 404 错误:
Message: 10080001 Unable to find ObjectPathReference[storeRef=workspace://SpacesStore,path=/app:company_home/app:company_home/app:dictionary/cm:Cleaner_x0020_Configs/cm:cleaner.properties]
Exception: org.springframework.extensions.webscripts.WebScriptException - 10080001 Unable to find ObjectPathReference[storeRef=workspace://SpacesStore,path=/app:company_home/app:company_home/app:dictionary/cm:Cleaner_x0020_Configs/cm:cleaner.properties]
参考:
http://wiki.alfresco.com/wiki/CMIS_Web_Scripts_Reference#Get_Content_.28getContent.29
获取指定文档的内容流,或获取 文档的指定格式副本的格式副本流。
GET/alfresco/service/cmis/p{path}/content{property}?a={attach?}
我发现了问题,感谢@Gagravarr的提示:
我必须使用显示路径,但在路径中省略/Company%20Home/,因为请求 url 中使用的路径被视为相对于 /Company%20Home 节点。
这有效:
http://<host:port>/alfresco/service/cmis/p/Data%20Dictionary/Cleaner%20Configs/cleaner.properties/content?a=false