Package com.github.sardine.impl.methods

Examples of com.github.sardine.impl.methods.HttpPropPatch


   * namespace and {@link com.github.sardine.util.SardineUtil#CUSTOM_NAMESPACE_PREFIX} as prefix.
   */
  @Override
  public List<DavResource> patch(String url, Map<QName, String> setProps, List<QName> removeProps) throws IOException
  {
    HttpPropPatch entity = new HttpPropPatch(url);
    // Build WebDAV <code>PROPPATCH</code> entity.
    Propertyupdate body = new Propertyupdate();
    // Add properties
    {
      Set set = new Set();
      body.getRemoveOrSet().add(set);
      Prop prop = new Prop();
      // Returns a reference to the live list
      List<Element> any = prop.getAny();
      for (Map.Entry<QName, String> entry : setProps.entrySet())
      {
        Element element = SardineUtil.createElement(entry.getKey());
        element.setTextContent(entry.getValue());
        any.add(element);
      }
      set.setProp(prop);
    }
    // Remove properties
    {
      Remove remove = new Remove();
      body.getRemoveOrSet().add(remove);
      Prop prop = new Prop();
      // Returns a reference to the live list
      List<Element> any = prop.getAny();
      for (QName entry : removeProps)
      {
        Element element = SardineUtil.createElement(entry);
        any.add(element);
      }
      remove.setProp(prop);
    }
    entity.setEntity(new StringEntity(SardineUtil.toXml(body), UTF_8));
    Multistatus multistatus = this.execute(entity, new MultiStatusResponseHandler());
    List<Response> responses = multistatus.getResponse();
    List<DavResource> resources = new ArrayList<DavResource>(responses.size());
    for (Response response : responses)
    {
View Full Code Here

TOP

Related Classes of com.github.sardine.impl.methods.HttpPropPatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.