"Content-type" 用于使用 Web HDFS REST 客户端上传 jars 文件
"Content-type" for uploading jars files using Web HDFS REST client
我正在使用 Web HDFS REST 客户端,我可以上传 .xml
& .q
文件。
代码的有用部分 -
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);
我在上传时遇到问题 .jar
。上传的文件已损坏。
我应该在"Content-type"和“"Accept"”中设置什么来上传jar?
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
.
我正在使用 Web HDFS REST 客户端,我可以上传 .xml
& .q
文件。
代码的有用部分 -
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);
我在上传时遇到问题 .jar
。上传的文件已损坏。
我应该在"Content-type"和“"Accept"”中设置什么来上传jar?
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
.