Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.jackrabbit.webdav.DavConstants;
import org.apache.jackrabbit.webdav.client.methods.MkColMethod;
import org.apache.jackrabbit.webdav.client.methods.MoveMethod;
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;

Expand Down Expand Up @@ -280,6 +281,14 @@ private HttpMethodBase buildMethod(NextcloudRequest request, Uri baseUri, InputS
method = new DeleteMethod(requestUrl);
break;

case "MOVE":
String destUrl = request.getAdditionalParameter(NextcloudRequest.ADDITIONAL_PARAMETER_MOVE_DESTINATION);
boolean overwrite =
request.getAdditionalParameter(NextcloudRequest.ADDITIONAL_PARAMETER_MOVE_OVERWRITE)
.equalsIgnoreCase("true");
method = new MoveMethod(requestUrl, destUrl, overwrite);
break;

case "PROPFIND":
method = new NCPropFindMethod(requestUrl, DavConstants.PROPFIND_ALL_PROP, DavConstants.DEPTH_1);
if (request.getRequestBody() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ public class NextcloudRequest implements Serializable {

private static final long serialVersionUID = 215521212534240L; //assign a long value

public static final String ADDITIONAL_PARAMETER_MOVE_DESTINATION = "Destination";
public static final String ADDITIONAL_PARAMETER_MOVE_OVERWRITE = "Overwrite";

private String method;
private Map<String, List<String>> header = new HashMap<>();
private Map<String, String> parameter = new HashMap<>();
private Map<String, String> additionalParameter = new HashMap<>();
private final Collection<QueryParam> parameterV2 = new LinkedList<>();
private String requestBody;
private String url;
Expand Down Expand Up @@ -60,6 +64,15 @@ public Builder setParameter(Map<String, String> parameter) {
return this;
}

public Builder setAdditionalParameters(Map<String, String> ap) {
ncr.additionalParameter = ap;
return this;
}
public Builder setAdditionalParameter(String key, String value) {
ncr.additionalParameter.put(key, value);
return this;
}

public Builder setRequestBody(String requestBody) {
ncr.requestBody = requestBody;
return this;
Expand Down Expand Up @@ -103,6 +116,13 @@ public Map<String, String> getParameter() {
return this.parameter;
}

public Map<String, String> getAdditionalParameters() {
return this.additionalParameter;
}
public String getAdditionalParameter(String key) {
return this.additionalParameter.get(key);
}

public String getRequestBody() {
return this.requestBody;
}
Expand Down
Loading