如何在Apache Chemistry CMIS API中设置charset?

时间:2016-04-12 19:07:34

标签: java cmis apache-chemistry

我正在尝试按路径获取文件夹ID:

Folder folder = (Folder) getCmisSession().getObjectByPath(folderPath);

我要求的路径是:

/SIGAP/2011/DIRECCIÓN GENERAL DE PRUEBAS/SIN EXPEDIENTE/2010001231

正如您所看到的,字符串中有一个特殊的字符Ó

抛出化学反应的错误是:

STACK TRACE:
org.cmis.ws.CmisException: Not found an object for the specific path: /SIGAP/2011/DIRECCIÃ?N GENERAL DE PRUEBAS/OFICIOS
    at com.emc.documentum.fs.cmis.impl.dfs.utils.CmisExceptionFactory.create(CmisExceptionFactory.java:24)
    at com.emc.documentum.fs.cmis.impl.dfs.utils.CmisExceptionBuilder.build(CmisExceptionBuilder.java:31)
    at com.emc.documentum.fs.cmis.impl.dfs.action.GetObjectByPathAction.getNonCabinetObjectByPath(GetObjectByPathAction.java:170)

它将字符串从DIRECCIÓN更改为DIRECCIÃ?N

如何将charset设置为会话为utf-8?或者我如何编码路径?

更新1:

@plorianMüller在SoapUI的帮助下,我尝试通过这样的路径请求相同的文件夹:

 <soapenv:Body>
      <ns:getObjectByPath>
         <ns:repositoryId>LHD_ECM</ns:repositoryId>
         <ns:path>/SIGAP/2011/DIRECCIÓN GENERAL DE PRUEBAS/SIN EXPEDIENTE/2010001231</ns:path>
      </ns:getObjectByPath>
   </soapenv:Body>

让服务器得到了严格的支持:

<S:Body>
      <ns2:getObjectByPathResponse xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:ns2="http://docs.oasis-open.org/ns/cmis/messaging/200908/">
         <ns2:object>
            <properties>
               <propertyString queryName="cmis:name" displayName="Name" localName="object_name" propertyDefinitionId="cmis:name">
                  <value>2010001231</value>
               </propertyString>
               <propertyId queryName="cmis:objectTypeId" displayName="Object Type ID" localName="r_object_type" propertyDefinitionId="cmis:objectTypeId">
                  <value>sigapfolio</value>
               </propertyId>
               <propertyId queryName="cmis:baseTypeId" displayName="Base Type Id" localName="" propertyDefinitionId="cmis:baseTypeId">
                  <value>cmis:folder</value>
               </propertyId>
               <propertyId queryName="cmis:objectId" displayName="Object Id" localName="r_object_id" propertyDefinitionId="cmis:objectId">
                  <value>0b00020280080815</value>
               </propertyId>
               <propertyString queryName="cmis:createdBy" displayName="Created By" localName="r_creator_name" propertyDefinitionId="cmis:createdBy">
                  <value>dmadmin</value>
               </propertyString>
               <propertyDateTime queryName="cmis:creationDate" displayName="Creation Date" localName="r_creation_date" propertyDefinitionId="cmis:creationDate">
                  <value>2016-04-05T04:54:44.000-05:00</value>
               </propertyDateTime>
               <propertyString queryName="cmis:lastModifiedBy" displayName="Last Modified By" localName="r_modifier" propertyDefinitionId="cmis:lastModifiedBy">
                  <value>dmadmin</value>
               </propertyString>
               <propertyDateTime queryName="cmis:lastModificationDate" displayName="Last Modification Date" localName="r_modify_date" propertyDefinitionId="cmis:lastModificationDate">
                  <value>2016-04-05T04:54:44.000-05:00</value>
               </propertyDateTime>
               <propertyString queryName="cmis:changeToken" displayName="Change Token" localName="i_vstamp" propertyDefinitionId="cmis:changeToken">
                  <value>1</value>
               </propertyString>
               <propertyId queryName="cmis:parentId" displayName="Parent Id" localName="i_folder_id" propertyDefinitionId="cmis:parentId">
                  <value>0b00020280005a3b</value>
               </propertyId>
               <propertyString queryName="cmis:path" displayName="Folder Path" localName="r_folder_path" propertyDefinitionId="cmis:path">
                  <value>/SIGAP/2011/DIRECCIÓN GENERAL DE PRUEBAS/SIN EXPEDIENTE/2010001231</value>
               </propertyString>
               <propertyId queryName="cmis:allowedChildObjectTypeIds" displayName="Allowed Child Object Type IDs" localName="" propertyDefinitionId="cmis:allowedChildObjectTypeIds">
                  <value>cmis:folder</value>
                  <value>cmis:document</value>
               </propertyId>
            </properties>
         </ns2:object>
      </ns2:getObjectByPathResponse>
   </S:Body>
</S:Envelope>

所以Apache化学肯定是错的:(

1 个答案:

答案 0 :(得分:3)

所以问题是绑定,从AtomPub切换到Webservices,问题就消失了。

parameter.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value());