Search in sources :

Example 11 with XmlWriter

use of io.milton.http.XmlWriter in project lobcder by skoulouzis.

the class PropFindXmlGeneratorHelper method sendProperties.

private void sendProperties(Response.Status status, XmlWriter writer, Map<String, String> mapOfNamespaces, Map<QName, ValueAndType> properties, String href) {
    if (!properties.isEmpty()) {
        XmlWriter.Element elPropStat = writer.begin(WebDavProtocol.NS_DAV.getPrefix(), "propstat").open();
        XmlWriter.Element elProp = writer.begin(WebDavProtocol.NS_DAV.getPrefix(), "prop").open();
        for (QName qname : properties.keySet()) {
            String prefix = mapOfNamespaces.get(qname.getNamespaceURI());
            ValueAndType val = properties.get(qname);
            valueWriters.writeValue(writer, qname, prefix, val, href, mapOfNamespaces);
        }
        elProp.close();
        writer.writeProperty(WebDavProtocol.NS_DAV.getPrefix(), "status", status.toString());
        elPropStat.close();
    }
}
Also used : ValueAndType(io.milton.http.values.ValueAndType) QName(javax.xml.namespace.QName) XmlWriter(io.milton.http.XmlWriter)

Aggregations

XmlWriter (io.milton.http.XmlWriter)11 ByteArrayOutputStream (org.apache.commons.io.output.ByteArrayOutputStream)3 NameAndError (io.milton.http.webdav.PropFindResponse.NameAndError)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 QName (javax.xml.namespace.QName)2 HrefStatus (io.milton.http.HrefStatus)1 Status (io.milton.http.Response.Status)1 ByteArrayEntity (io.milton.http.entity.ByteArrayEntity)1 ValueAndType (io.milton.http.values.ValueAndType)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 TreeMap (java.util.TreeMap)1