【问题标题】:Alfresco CMIS Web Scripts API for 'getContent' by path is not workingAlfresco CMIS Web Scripts API for 'getContent' by path 不起作用
【发布时间】:2013-11-08 09:00:55
【问题描述】:

我的 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?}

【问题讨论】:

  • 查看您的错误消息,我在其中发现了/app:company_home/app:company_home/。你真的是想在一秒钟内找到一家公司吗?
  • @Gagravarr 重复的 app:company_home 不是故意的。它只在我收到的错误消息中出现两次,我在请求 url 中没有两次。所以我只是尝试删除它,调用:localhost:8080/alfresco/service/cmis/p/app:dictionary/… - 但它也会引发 404 错误: Unable to find ObjectPathReference[storeRef=workspace://SpacesStore,path=/app:company_home/app:company_home/app:dictionary/ cm:Cleaner_x0020_Configs/cm:cleaner.properties] - 现在路径正常,只有一个 /app:company_home
  • 好的,我找到了解决方案:我必须使用显示路径,但在路径中保留 /Company Home/,因为它会自动添加到路径之前。或者换句话说,路径总是相对于 /Company Home。这有效:localhost:8080/alfresco/service/cmis/p/Data%20Dictionary/…

标签: alfresco


【解决方案1】:

我发现了问题,感谢@Gagravarr 的提示:

我必须使用显示路径但在路径中省略/Company%20Home/,因为请求url中使用的路径是相对于/Company%20Home 节点。

这行得通:

http://<host:port>/alfresco/service/cmis/p/Data%20Dictionary/Cleaner%20Configs/cleaner.properties/content?a=false

【讨论】:

  • 请注意,如果使用显示路径,它不适用于以不同语言创建的存储库,因为显示路径已本地化。如果您希望它在不同语言之间保持一致,则需要使用 QNames
  • 注意到了,但是在我看来,qname 不适用于 /alfresco/service/cmis/p/ API。
猜你喜欢
  • 1970-01-01
  • 2017-08-12
  • 1970-01-01
  • 2021-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多