1

I am using Web HDFS REST client, I am able to upload .xml & .q files.

Useful part of code -

CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPut httpPut = new HttpPut(urlString);
httpPut.setHeader("Accept", "application/xml");
httpPut.setHeader("Content-type", "application/xml");
CloseableHttpResponse response = httpclient.execute(httpPut);

I am getting issue while uploading .jar. Uploaded file is corrupted.

What should I set in "Content-type" and ""Accept"" for uploading jars?

4

1 回答 1

1
HttpPut httpPut = new HttpPut(urlString);
httpPut.setEntity(new StringEntity(readFile(fileName)));
httpPut.setHeader("Accept", "binary/octet-stream");
httpPut.setHeader("Content-type", "binary/octet-stream");

使用binary/octet-stream而不是 application/xml.

于 2016-02-18T09:54:11.373 回答