DownloadImage looks not worked #27

Open
shidax opened this Issue Mar 27, 2013 · 0 comments

Comments

Projects
None yet
1 participant

shidax commented Mar 27, 2013

I'm use the glance-client for image download.

Try the following code. But the input stream always return empty.

DownloadImage download = new DownloadImage(imageId);
ImageDownload downloadImage = client.execute(download);
InputStream stream = downloadImage.getInputStream();

Maybe, now, DownloadImage command request the HEAD method.

@Override
public ImageDownload execute(WebTarget target) {
    Response response = target.path("images").path(id).request(MediaType.APPLICATION_OCTET_STREAM).head();
    Image image = new Image();

OpenStack API need GET request for download image.
So, make the change in the code as following.

@Override
public ImageDownload execute(WebTarget target) {
    Response response = target.path("images").path(id).request(MediaType.APPLICATION_OCTET_STREAM).get();
    Image image = new Image();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment