View Javadoc
1   /*
2    * Copyright (C) 2003-2014 eXo Platform SAS.
3    *
4    * This is free software; you can redistribute it and/or modify it
5    * under the terms of the GNU Lesser General Public License as
6    * published by the Free Software Foundation; either version 3 of
7    * the License, or (at your option) any later version.
8    *
9    * This software is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   * Lesser General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this software; if not, write to the Free
16   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18   */
19  package org.exoplatform.utils;
20  
21  import java.net.URI;
22  
23  import org.apache.http.client.methods.HttpRequestBase;
24  
25  /**
26   * Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com Aug
27   * 17, 2011
28   */
29  public class WebdavMethod extends HttpRequestBase {
30  
31    private String method;
32  
33    // Constructor for delete, create new folder, check reachability url
34    public WebdavMethod(String method, String sourceUriStr) {
35      this.method = method;
36      this.setURI(URI.create(sourceUriStr));
37    }
38  
39    // Constructor for copy, move
40    public WebdavMethod(String method, String sourceUriStr, String destinationUriStr) {
41      this.method = method;
42      this.setURI(URI.create(sourceUriStr));
43      this.setHeader("Overwrite", "T");
44      this.setHeader("Destination", destinationUriStr);
45    }
46  
47    @Override
48    public String getMethod() {
49      return method;
50    }
51  
52  }