You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Pratheesh <pr...@teknowmics.com> on 2016/12/05 09:50:35 UTC
Issue when trying to download from Swift3 middleware...
Hi
I am connecting to Swift3 middleware and trying to upload and download files
from the configured bucket. Upload is working perfect.
But the download is failing with following error:
org.jclouds.aws.AWSResponseException: request GET
http://mydomain:8080/myapp?acl HTTP/1.1 failed with code 500, error:
AWSError{requestId='txb8a5b39946394b1282d4a-0058452eb1',
requestToken='txb8a5b39946394b1282d4a-0058452eb1', code='InternalError',
message='unexpected status code 406'}
Can you please let me know , how to resolve this error?
Sample code tried:
Properties overrides = new Properties();
overrides.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "false");
overrides.setProperty(PROPERTY_S3_SERVICE_PATH, "/");
BlobStoreContext context;
context = ContextBuilder.newBuilder("s3")
.endpoint("http://mydomain:8080 ")
.credentials("userid", "password")
.overrides(overrides)
.buildView(BlobStoreContext.class);
BlobStore blobStore = context.getBlobStore();
System.out.println("Obtained blob store ...");
Blob blob = blobStore.getBlob("mybucket", "Dashboard.jpg");
System.out.println("Finding file...");
InputStream in = blob.getPayload().openStream();
System.out.println("Downloading...");
FileOutputStream fout = new
FileOutputStream("E:\\jCloudStorage\\downloads\\Dashboard.jpg");
byte[] bytes = new byte[1024];
int length = -1;
while ((length = in.read(bytes, 0, 1024)) != -1) {
fout.write(bytes, 0, length);
}
fout.flush();
fout.close();
in.close();
System.out.println("Download complete...");
Re: Issue when trying to download from Swift3 middleware...
Posted by Andrew Gaul <ga...@apache.org>.
Sorry for the late response -- can you enable jclouds wire logs and try
again?
https://jclouds.apache.org/reference/logging/
On Mon, Dec 05, 2016 at 03:20:35PM +0530, Pratheesh wrote:
> Hi
>
>
>
> I am connecting to Swift3 middleware and trying to upload and download files
> from the configured bucket. Upload is working perfect.
>
> But the download is failing with following error:
>
> org.jclouds.aws.AWSResponseException: request GET
> http://mydomain:8080/myapp?acl HTTP/1.1 failed with code 500, error:
> AWSError{requestId='txb8a5b39946394b1282d4a-0058452eb1',
> requestToken='txb8a5b39946394b1282d4a-0058452eb1', code='InternalError',
> message='unexpected status code 406'}
>
>
>
> Can you please let me know , how to resolve this error?
>
>
>
> Sample code tried:
>
>
> Properties overrides = new Properties();
>
> overrides.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "false");
>
> overrides.setProperty(PROPERTY_S3_SERVICE_PATH, "/");
>
> BlobStoreContext context;
>
> context = ContextBuilder.newBuilder("s3")
>
> .endpoint("http://mydomain:8080 ")
>
> .credentials("userid", "password")
>
> .overrides(overrides)
>
> .buildView(BlobStoreContext.class);
>
> BlobStore blobStore = context.getBlobStore();
>
> System.out.println("Obtained blob store ...");
>
> Blob blob = blobStore.getBlob("mybucket", "Dashboard.jpg");
>
> System.out.println("Finding file...");
>
> InputStream in = blob.getPayload().openStream();
>
> System.out.println("Downloading...");
>
> FileOutputStream fout = new
> FileOutputStream("E:\\jCloudStorage\\downloads\\Dashboard.jpg");
>
> byte[] bytes = new byte[1024];
>
> int length = -1;
>
> while ((length = in.read(bytes, 0, 1024)) != -1) {
>
> fout.write(bytes, 0, length);
>
> }
>
> fout.flush();
>
> fout.close();
>
> in.close();
>
> System.out.println("Download complete...");
>
>
>
--
Andrew Gaul
http://gaul.org/