use of io.milton.http.LockInfoSaxHandler in project lobcder by skoulouzis.
the class LockHandler method parseLockInfo.
private LockInfo parseLockInfo(Request request) throws IOException, SAXException {
InputStream in = request.getInputStream();
XMLReader reader = XMLReaderFactory.createXMLReader();
LockInfoSaxHandler handler = new LockInfoSaxHandler();
reader.setContentHandler(handler);
reader.parse(new InputSource(in));
LockInfo info = handler.getInfo();
// todo
info.depth = LockDepth.INFINITY;
info.lockedByUser = null;
if (request.getAuthorization() != null) {
info.lockedByUser = request.getAuthorization().getUser();
}
if (info.lockedByUser == null) {
}
return info;
}
use of io.milton.http.LockInfoSaxHandler in project lobcder by skoulouzis.
the class TestSaxHandler method testLockInfo.
public void testLockInfo() throws Exception {
XMLReader reader = XMLReaderFactory.createXMLReader();
LockInfoSaxHandler handler = new LockInfoSaxHandler();
reader.setContentHandler(handler);
reader.parse(new InputSource(LockInfoSaxHandler.class.getResourceAsStream("/sample_lockinfo.xml")));
LockInfo result = handler.getInfo();
assertEquals(result.scope, LockScope.EXCLUSIVE);
assertEquals(result.type, LockType.WRITE);
}
Aggregations