Revision 732d9c2c src/com/rackspace/cloud/files/api/client/ContainerObjectManager.java

b/src/com/rackspace/cloud/files/api/client/ContainerObjectManager.java
8 8
import java.net.URISyntaxException;
9 9
import java.util.ArrayList;
10 10
import java.util.List;
11
import java.util.Map;
12
import java.util.Map.Entry;
11 13

  
12 14
import javax.xml.parsers.FactoryConfigurationError;
13 15
import javax.xml.parsers.ParserConfigurationException;
......
18 20
import org.apache.http.client.ClientProtocolException;
19 21
import org.apache.http.client.methods.HttpDelete;
20 22
import org.apache.http.client.methods.HttpGet;
23
import org.apache.http.client.methods.HttpPost;
21 24
import org.apache.http.client.methods.HttpPut;
22 25
import org.apache.http.entity.StringEntity;
23 26
import org.apache.http.impl.client.BasicResponseHandler;
......
374 377
		}
375 378
		return bundle;
376 379
	}
380
	
381
	public HttpBundle updateObject(String Container, String Path, String Object,
382
			String type, Map<String,String> headers) throws CloudServersException {
383
		HttpResponse resp = null;
384
		CustomHttpClient httpclient = new CustomHttpClient(context);
385
		String url;
386
		if(Container !=null)
387
			url = getSafeURL(Account.getAccount().getStorageUrl(), Container
388
				+ "/" + Path + Object);
389
		else{
390
			url = getSafeURL(Account.getAccount().getStorageUrl(),"");
391
			if(url.endsWith("/"))
392
				url = url.substring(0, url.length()-1);
393
		}
394
		url =url+"?update=";
395
		Log.d("papala", url);
396
		HttpPost addObject = new HttpPost(url);
397

  
398
		addObject
399
				.addHeader("X-Auth-Token", Account.getAccount().getAuthToken());
400
		addObject.addHeader("Content-Type", "	text/plain; charset=UTF-8");
401
		for(Entry<String,String> entry : headers.entrySet()){
402
			addObject.addHeader(entry.getKey(),entry.getValue());
403
		}
404
		httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class);
405

  
406
		HttpBundle bundle = new HttpBundle();
407
		bundle.setCurlRequest(addObject);
408

  
409
		try {
410
			resp = httpclient.execute(addObject);
411
			bundle.setHttpResponse(resp);
412
		} catch (ClientProtocolException e) {
413
			CloudServersException cse = new CloudServersException();
414
			cse.setMessage(e.getLocalizedMessage());
415
			throw cse;
416
		} catch (IOException e) {
417
			CloudServersException cse = new CloudServersException();
418
			cse.setMessage(e.getLocalizedMessage());
419
			throw cse;
420
		} catch (FactoryConfigurationError e) {
421
			CloudServersException cse = new CloudServersException();
422
			cse.setMessage(e.getLocalizedMessage());
423
			throw cse;
424
		}
425
		return bundle;
426
	}
377 427

  
378 428
	/*
379 429
	 * used for adding text files, requires an extra parameter to store the data

Also available in: Unified diff