Revision b51c628b src/gr/grnet/pithos/web/client/Pithos.java
b/src/gr/grnet/pithos/web/client/Pithos.java | ||
---|---|---|
416 | 416 |
private void fetchFile(final Iterator<File> iter, final Set<File> files) { |
417 | 417 |
if (iter.hasNext()) { |
418 | 418 |
File file = iter.next(); |
419 |
String path = getApiPath() + username + "/" + file.getContainer() + "/" + file.getPath() + "?format=json";
|
|
420 |
GetRequest<File> getFile = new GetRequest<File>(File.class, path, file) { |
|
419 |
String path = file.getUri() + "?format=json";
|
|
420 |
GetRequest<File> getFile = new GetRequest<File>(File.class, getApiPath(), username, path, file) {
|
|
421 | 421 |
@Override |
422 | 422 |
public void onSuccess(File result) { |
423 | 423 |
fetchFile(iter, files); |
... | ... | |
476 | 476 |
} |
477 | 477 |
|
478 | 478 |
private void fetchAccount() { |
479 |
String path = getApiPath() + username + "?format=json";
|
|
479 |
String path = "?format=json"; |
|
480 | 480 |
|
481 |
GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, path) { |
|
481 |
GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, getApiPath(), username, path) {
|
|
482 | 482 |
@Override |
483 | 483 |
public void onSuccess(AccountResource result) { |
484 | 484 |
account = result; |
... | ... | |
504 | 504 |
} |
505 | 505 |
|
506 | 506 |
private void createHomeContainers() { |
507 |
String path = getApiPath() + getUsername() + "/pithos";
|
|
508 |
PutRequest createPithos = new PutRequest(path) { |
|
507 |
String path = "/pithos"; |
|
508 |
PutRequest createPithos = new PutRequest(getApiPath(), getUsername(), path) {
|
|
509 | 509 |
@Override |
510 | 510 |
public void onSuccess(Resource result) { |
511 | 511 |
fetchAccount(); |
... | ... | |
924 | 924 |
JSONObject o = array.get(i).isObject(); |
925 | 925 |
if (o != null && !o.containsKey("subdir")) { |
926 | 926 |
JSONString name = o.get("name").isString(); |
927 |
String path = getApiPath() + getUsername() + "/" + folder.getContainer() + "/" + name.stringValue();
|
|
928 |
DeleteRequest delete = new DeleteRequest(path) { |
|
927 |
String path = "/" + folder.getContainer() + "/" + name.stringValue(); |
|
928 |
DeleteRequest delete = new DeleteRequest(getApiPath(), getUsername(), path) {
|
|
929 | 929 |
@Override |
930 | 930 |
public void onSuccess(Resource result) { |
931 | 931 |
deleteObject(folder, i + 1, array); |
... | ... | |
975 | 975 |
} |
976 | 976 |
} |
977 | 977 |
else { |
978 |
String prefix = folder.getPrefix(); |
|
979 |
String path = getApiPath() + getUsername() + "/" + folder.getContainer() + (prefix.length() == 0 ? "" : "/" + prefix); |
|
980 |
DeleteRequest deleteFolder = new DeleteRequest(path) { |
|
978 |
String path = folder.getUri(); |
|
979 |
DeleteRequest deleteFolder = new DeleteRequest(getApiPath(), getUsername(), path) { |
|
981 | 980 |
@Override |
982 | 981 |
public void onSuccess(Resource result) { |
983 | 982 |
updateFolder(folder.getParent()); |
... | ... | |
1005 | 1004 |
public void copyFiles(final Iterator<File> iter, final String targetUri, final Command callback) { |
1006 | 1005 |
if (iter.hasNext()) { |
1007 | 1006 |
File file = iter.next(); |
1008 |
String path = getApiPath() + getUsername() + targetUri + "/" + file.getName();
|
|
1009 |
PutRequest copyFile = new PutRequest(path) { |
|
1007 |
String path = targetUri + "/" + file.getName(); |
|
1008 |
PutRequest copyFile = new PutRequest(getApiPath(), getUsername(), path) {
|
|
1010 | 1009 |
@Override |
1011 | 1010 |
public void onSuccess(Resource result) { |
1012 | 1011 |
copyFiles(iter, targetUri, callback); |
... | ... | |
1042 | 1041 |
} |
1043 | 1042 |
|
1044 | 1043 |
public void copyFolder(final Folder f, final String targetUri, final Command callback) { |
1045 |
String path = getApiPath() + getUsername() + targetUri + "/" + f.getName();
|
|
1046 |
PutRequest createFolder = new PutRequest(path) { |
|
1044 |
String path = targetUri + "/" + f.getName(); |
|
1045 |
PutRequest createFolder = new PutRequest(getApiPath(), getUsername(), path) {
|
|
1047 | 1046 |
@Override |
1048 | 1047 |
public void onSuccess(Resource result) { |
1049 | 1048 |
Iterator<File> iter = f.getFiles().iterator(); |
Also available in: Unified diff