Dav: implement multivalued property suppord in ExchangeDavMethod

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2022 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-09-17 08:00:49 +00:00
parent c5a7918843
commit 59f752acf4
1 changed files with 23 additions and 3 deletions

View File

@ -178,14 +178,34 @@ public abstract class ExchangeDavMethod extends PostMethod {
if (XMLStreamUtil.isStartTag(reader)) {
Namespace namespace = Namespace.getNamespace(reader.getNamespaceURI());
String tagLocalName = reader.getLocalName();
String tagContent = getTagContent(reader);
if (tagContent != null) {
multiStatusResponse.add(new DefaultDavProperty(tagLocalName, tagContent, namespace));
if (reader.getAttributeCount() > 0 && "mv.string".equals(reader.getAttributeValue(0))) {
handleMultiValuedProperty(reader, multiStatusResponse);
} else {
String tagContent = getTagContent(reader);
if (tagContent != null) {
multiStatusResponse.add(new DefaultDavProperty(tagLocalName, tagContent, namespace));
}
}
}
}
}
protected void handleMultiValuedProperty(XMLStreamReader reader, MultiStatusResponse multiStatusResponse) throws XMLStreamException {
String tagLocalName = reader.getLocalName();
Namespace namespace = Namespace.getNamespace(reader.getNamespaceURI());
ArrayList<String> values = new ArrayList<String>();
while (reader.hasNext() && !XMLStreamUtil.isEndTag(reader, tagLocalName)) {
reader.next();
if (XMLStreamUtil.isStartTag(reader)) {
String tagContent = getTagContent(reader);
if (tagContent != null) {
values.add(tagContent);
}
}
}
multiStatusResponse.add(new DefaultDavProperty(tagLocalName, values, namespace));
}
protected String getTagContent(XMLStreamReader reader) throws XMLStreamException {
String value = null;
String tagLocalName = reader.getLocalName();