Search in sources :

Example 6 with Element

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

the class ResourceTypeValueWriter method writeValue.

@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
    List<QName> list = (List<QName>) val;
    if (list != null && list.size() > 0) {
        Element rt = writer.begin(prefix, localName);
        for (QName name : list) {
            String childNsUri = name.getNamespaceURI();
            String childPrefix = nsPrefixes.get(childNsUri);
            // so if null write the full uri
            if (childPrefix == null) {
                String p = lookupUnspecifiedPrefix(childNsUri);
                rt.begin(childNsUri, p, name.getLocalPart()).noContent(false);
            } else {
                // don't write a new line - see http://www.ettrema.com:8080/browse/MIL-83
                rt.begin(childPrefix, name.getLocalPart()).noContent(false);
            }
        }
        rt.close();
    } else {
        writer.writeProperty(prefix, localName);
    }
}
Also used : QName(javax.xml.namespace.QName) Element(io.milton.http.XmlWriter.Element) List(java.util.List)

Example 7 with Element

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

the class SupportedReportSetWriter method writeValue.

@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
    SupportedReportSetList list = (SupportedReportSetList) val;
    Element reportSet = writer.begin(WebDavProtocol.DAV_PREFIX + ":supported-report-set").open();
    if (list != null) {
        for (String s : list) {
            Element supportedReport = writer.begin(WebDavProtocol.DAV_PREFIX + ":supported-report").open();
            Element report = writer.begin(WebDavProtocol.DAV_PREFIX + ":report").open();
            writer.writeProperty(WebDavProtocol.DAV_PREFIX + ":" + s);
            report.close();
            supportedReport.close();
        }
    }
    reportSet.close();
}
Also used : Element(io.milton.http.XmlWriter.Element)

Aggregations

Element (io.milton.http.XmlWriter.Element)7 PropFindResponse (io.milton.http.webdav.PropFindResponse)1 PriviledgeList (io.milton.principal.PriviledgeList)1 Priviledge (io.milton.resource.AccessControlledResource.Priviledge)1 List (java.util.List)1 QName (javax.xml.namespace.QName)1