コード例 #1
0
 private Message successMultiStatus(MULTISTATUS multiStatus) {
   final Document doc = new Document(XML_DECLARATION, multiStatus);
   return Response.build(SUCCESS_MULTI_STATUS)
       .header(CONTENT_TYPE)
       .set(APPLICATION_XML.toString())
       .setBody(CHARSET_UTF_8.encode(XMLWriter.write(doc)));
 }
コード例 #2
0
  @LOCK
  public Message lock(@PathTranslated Path path, Depth depth) throws IOException {
    final Resource resource = resolveResource(path);

    if (resource.exists()) {
      final Lock lock = resource.lock(WRITE, EXCLUSIVE);

      final ACTIVE_LOCK activelock = activeLock(lock, depth, relativizeResource(resource));
      final Element lockDiscovery = lockDiscovery(activelock);
      final Element prop = prop(lockDiscovery);
      final Document doc = new Document(XML_DECLARATION, prop);
      return Response.build(SUCCESS_OK)
          .header(LOCK_TOKEN)
          .set("<" + lock.token() + ">")
          .setBody(Charset.defaultCharset().encode(XMLWriter.write(doc)));
    } else {
      return clientErrorNotFound();
    }
  }
コード例 #3
0
 private final Document getPropfind(final ByteBuffer buffer) throws IOException {
   Document document = SNAX.parse(CHARSET_UTF_8.decode(buffer));
   LOG.debug("Request Body: " + XMLWriter.write(document));
   return document;
 }