io.milton.http.webdav2.SupportedLockValueWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of milton-server-ent Show documentation
Show all versions of milton-server-ent Show documentation
Milton Enterprise: Supports DAV level 2 and above, including Caldav and Carddav. Available on AGPL or
commercial licenses
The newest version!
/*
* Copyright 2012 McEvoy Software Ltd.
*/
package io.milton.http.webdav2;
import io.milton.resource.LockableResource;
import io.milton.http.XmlWriter;
import io.milton.http.XmlWriter.Element;
import io.milton.http.values.ValueWriter;
import io.milton.http.webdav.WebDavProtocol;
import io.milton.http.webdav.SupportedLocks;
import java.util.Map;
public class SupportedLockValueWriter implements ValueWriter {
private static final String D = WebDavProtocol.DAV_PREFIX;
@Override
public boolean supports(String nsUri, String localName, Class c) {
return SupportedLocks.class.isAssignableFrom(c);
}
@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map nsPrefixes) {
Element supportedLocks = writer.begin(D + ":supportedlock").open();
SupportedLocks slocks = (SupportedLocks) val;
if (slocks != null && slocks.getResource() instanceof LockableResource) {
Element lockentry = writer.begin(D + ":lockentry").open();
writer.begin(D + ":lockscope").open(false).writeText("<" + D + ":exclusive/>").close();
writer.begin(D + ":locktype").open(false).writeText("<" + D + ":write/>").close();
lockentry.close();
}
supportedLocks.close();
}
@Override
public Object parse(String namespaceURI, String localPart, String value) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy