in application use amazon s3 server store data. trying move specific file 1 location location using jets3 api follows:
public void movefile(string currentpath, string newpath, string filename, boolean overwrite) throws fileexception { s3service s3service = null; try { s3service = gets3service(); string bucketfolderpath = "test-site/files/doc-lib/2015/07/16/09/05/46/552/v-6"; string currentfolderpath = "test-site/files/doc-lib/2015/07/16/09/05/46/552/head"; s3bucket writetolocation = s3service.createbucket(this.bucketname + "/" + bucketfolderpath); s3bucket readfromlocation = s3service.createbucket(this.bucketname + "/" + currentfolderpath); try { s3service.moveobject(currentfolderpath, "eclipse-shortcuts.pdf", bucketfolderpath, new s3object("eclipse-shortcuts.pdf"), overwrite); } catch (serviceexception e) { e.printstacktrace(); } } catch (illegalargumentexception ex) { throw new fileexception("could not write file repository", ex); } catch (s3serviceexception ex) { throw new fileexception("could not write file repository", ex); } { shutdownservice(s3service); } } here eclipse-shortcuts.pdf name of file trying copy. when method executed, getting following error:
org.jets3t.service.serviceexception: s3 error message. put '/test-site/files/doc-lib/2015/07/16/09/05/46/552/v-6/eclipse-shortcuts.pdf' on host 's3.amazonaws.com' @ 'tue, 21 jul 2015 06:11:55 gmt' -- responsecode: 403, responsestatus: forbidden, xml error message:
accessdeniedaccess denied3c5b8a31dc582d13ulpmuz7pqe9uumje6/5y/n7meppylr8bphr60ixvwcy1loj0sszhedyxbeg+vypy @ org.jets3t.service.impl.rest.httpclient.reststorageservice.performrequest(reststorageservice.java:453) @ org.jets3t.service.impl.rest.httpclient.reststorageservice.performrestput(reststorageservice.java:961) @ org.jets3t.service.impl.rest.httpclient.reststorageservice.copyobjectimpl(reststorageservice.java:1831) @ org.jets3t.service.storageservice.copyobject(storageservice.java:873) @ org.jets3t.service.storageservice.copyobject(storageservice.java:918) @ org.jets3t.service.storageservice.moveobject(storageservice.java:967) @ com.smartwcm.filestore.impl.filestoreimpl.movefile(filestoreimpl.java:380) @ com.smartwcm.core.file.service.impl.fileuploadserviceimpl.movefile(fileuploadserviceimpl.java:189) @ com.smartwcm.core.simplewebcontent.service.impl.simplewebcontentserviceimpl.movecurrentdatafordoclibedit(simplewebcontentserviceimpl.java:963)
i new working jets3 api. in same class have code, have method save file specified location , working. issue move part.
Comments
Post a Comment