import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URLDecoder;\r
+import java.net.URLEncoder;\r
import org.apache.commons.httpclient.Credentials;\r
import org.apache.commons.httpclient.HttpClient;\r
import org.apache.commons.httpclient.methods.GetMethod;\r
import org.apache.commons.httpclient.methods.HeadMethod;\r
import org.apache.commons.httpclient.methods.PutMethod;\r
+import org.apache.commons.httpclient.methods.RequestEntity;\r
import org.apache.commons.httpclient.params.HttpMethodParams;\r
import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.http.HttpStatus;\r
//HttpGet get = new HttpGet(mUri.toString() + filepath.replace(" ", "%20"));\r
\r
Log.e("ASD", mUri.toString() + URLDecoder.decode(filepath) + "");\r
- GetMethod get = new GetMethod(mUri.toString() + URLDecoder.decode(filepath));\r
+ GetMethod get = new GetMethod(mUri.toString() + URLEncoder.encode(filepath));\r
// get.setHeader("Host", mUri.getHost());
// get.setHeader("User-Agent", "Android-ownCloud");
- try {
+ try {\r
+ Log.e("ASD", get.toString());
int status = executeMethod(get);
if (status != HttpStatus.SC_OK) {
return false;
String contentType) {
boolean result = true;
- try {
- FileRequestEntity entity = new FileRequestEntity(new File(localFile), contentType);\r
- PutMethod put = new PutMethod(mUri.toString() + remoteTarget.substring(1));\r
+ try {\r
+ Log.e("ASD", contentType+"");\r
+ File f = new File(localFile);
+ RequestEntity entity = new FileRequestEntity(f, contentType);\r
+ Log.e("ASD", f.exists()+" " + entity.getContentLength());\r
+ PutMethod put = new PutMethod(mUri.toString() + remoteTarget);\r
put.setRequestEntity(entity);\r
+ Log.d(TAG, "" + put.getURI().toString());\r
int status = executeMethod(put);\r
Log.d(TAG, "PUT method return with status "+status);