(特に私が接続不良の場合)NonRepeatableRequestException
を取得し、 をサーバーに送信しています。ここに私のコードは次のとおりです。NonRepeatableRequestExceptionサーバーに画像を送信中に
HttpParams params = new BasicHttpParams();
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));
DefaultHttpClient httpclient = new DefaultHttpClient(new
ThreadSafeClientConnManager(params, registry), params);
HttpPost httpPost = new HttpPost(uri);
SimpleMultipartEntity multipartContent = new SimpleMultipartEntity();
multipartContent.addPart(propName, filename, inputStream,
contentType);
httpPost.setEntity(multipartContent);
httpclient.getParams().setParameter("http.protocol.expect-continue",
false);
java.util.logging.Logger.getLogger("httpclient.wire.header").setLevel(java.util.logging.Level.FINEST);
java.util.logging.Logger.getLogger("httpclient.wire.content").setLevel(java.util.logging.Level.FINEST);
HttpResponse response = httpclient.execute(httpPost);
私は、入力ストリームが非反復型であることを実現しますが、リクエストを適切に作成し、この例外を回避する方法は考えています。 何か助けていただければ幸いです。