Closed GoogleCodeExporter closed 9 years ago
Note:
This could be a more general solution to issue 90
http://code.google.com/p/sardine/issues/detail?id=90
Original comment by tch...@gmail.com
on 11 May 2011 at 2:27
See also issue 90.
Original comment by dkocher@sudo.ch
on 12 May 2011 at 8:48
With MS Exchange server throght OWA I can´t achieve result writing:
Map<String,String> updateProps = new HashMap<String,String>();
updateProps.put("urn:schemas:httpmail::read", "0");
List<String> removeProps = new ArrayList<String>(1);
removeProps.add("urn:schemas:httpmail::importance");
sardine.setCustomProps("https://correo.xxxx.es/Exchange/myuser/MyEmailFolder/New
Mail.EML", updateProps, removeProps);
I get Bad Request from Server:
[java] com.googlecode.sardine.util.SardineException: , response: Solicitud
incorrecta
[java] at
com.googlecode.sardine.SardineImpl.setCustomProps(SardineImpl.java:309)
[java] at emailbroker.DavManager.main(DavManager.java:236)
Original comment by hector...@gmail.com
on 16 May 2011 at 10:29
Can you check if r228 does indeed fix this issue.
Original comment by dkocher@sudo.ch
on 24 May 2011 at 10:35
Sorry for delay in responding. Because we were using our patched version
inside, had no time ot test your current version.
Simple response: No, it does not solve the problem.
Your code is still ignoring the namespace of properties when querying the
server (did not test the setting of property).
Here is an example of the DAV response of a test entry:
<D:response xmlns:ns0="DAV:" xmlns:ns1="intra:" xmlns:lp1="DAV:"
xmlns:lp2="http://apache.org/dav/props/">
<D:href>/webdav/published/test-6734f3fc-ff1c-4236-b843-da6a2ca6863c.test</D:href
>
<D:propstat>
<D:prop>
<ns1:i_title_nl>Hello world</ns1:i_title_nl>
<ns1:i_title_fr>Hello</ns1:i_title_fr>
<lp1:resourcetype/>
<lp1:creationdate>2011-09-21T14:17:53Z</lp1:creationdate>
<lp1:getcontentlength>21327</lp1:getcontentlength>
<lp1:getlastmodified>Wed, 21 Sep 2011 14:17:53 GMT</lp1:getlastmodified>
<lp1:getetag>"25dac1-534f-4ad743de3e640"</lp1:getetag>
<lp2:executable>F</lp2:executable>
<D:supportedlock>
<D:lockentry>
<D:lockscope><D:exclusive/></D:lockscope>
<D:locktype><D:write/></D:locktype>
</D:lockentry>
<D:lockentry>
<D:lockscope><D:shared/></D:lockscope>
<D:locktype><D:write/></D:locktype>
</D:lockentry>
</D:supportedlock>
<D:lockdiscovery/>
<D:getcontenttype>text/plain</D:getcontenttype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
i would expect this code
for (Map.Entry<String,String> e: getResource().getCustomProps().entrySet())
System.out.println(e.getKey()+" --> "+e.getValue());
to output something like
intra::i_title_fr --> Hello
http://apache.org/dav/props/:executable --> F
intra::i_title_nl --> Hello world
instead i get
i_title_fr --> Hello
executable --> F
i_title_nl --> Hello world
which mean namespace information is lost. If dav has key in the form
namespace:property=value, it's for good reason and i would expect sardine to
handle it properly. Without this i can not make a reliable tool for our user to
edit document metadata (how can you edit metadata when you can't find out in
which namespace they are defined?).
Moreover, keep in ming i can in webdav have several properties, with same name,
different namespace and different value...
Could you reopen issue?
Original comment by tch...@gmail.com
on 8 Nov 2011 at 4:34
I did some checks.
The changes you made for insertion is ok for me (using QName lists). Qname is a
good choice because it's standard, small and support equals / hashcode
operation.
The only missing brick was something to get this information from webdav
server. So i added (see patch) a getCustomPropsNs() method to DavResource that
returns a Map<QName,String> instead of a Map<String,String>
With this you can keep namespace informations and, for example, show it to end
user :)
Original comment by tch...@gmail.com
on 8 Nov 2011 at 6:11
Attachments:
In r307.
Original comment by dkocher@sudo.ch
on 9 Nov 2011 at 10:25
Good job, thank you :)
Original comment by tch...@gmail.com
on 9 Nov 2011 at 3:25
Original issue reported on code.google.com by
tch...@gmail.com
on 11 May 2011 at 2:24Attachments: