I tried to send a file to a servlet with MultipartPostMethod via HTTPS,
then I get:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at com.sun.net.ssl.internal.ssl.InputRecord.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(DashoA6275)
at java.io.FilterInputStream.read(FilterInputStream.java:111)
at
org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:142)
at java.io.FilterInputStream.read(FilterInputStream.java:90)
at
org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:161)
at
org.apache.commons.httpclient.HttpMethodBase.getResponseBody(HttpMethodBase.java:667)
at
org.apache.commons.httpclient.methods.GetMethod.getResponseBody(GetMethod.java:293)
at
org.apache.commons.httpclient.HttpMethodBase.getResponseBodyAsString(HttpMethodBase.java:717)
at Main.sendFile(Main.java:89)
Here is the code:
HttpClient httpClient = new HttpClient();
HostConfiguration hostConfig = httpClient.getHostConfiguration();
hostConfig.setHost("192.168.0.3", 443, "https");
MultipartPostMethod multipartPostMethod = new MultipartPostMethod();
multipartPostMethod.setPath("/hogecontext/upload");
File file = new File("/var/tmp/hoge.xml");
String fileName = file.getName();
try {
FilePart filePart = new FilePart(fileName, fileName, file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
int statusCode = -1;
String str = null;
try {
statusCode = httpClient.executeMethod(multipartPostMethod);
str = multipartPostMethod.getResponseBodyAsString(); // Line: 89
} catch (HttpException e) {
e.printStackTrace();
} finally {
multipartPostMethod.releaseConnection();
}
Sending via HTTP is OK, but Sending via HTTPS caused the error.
What is the proper way to get MultipartPost via HTTPS working?
--
Marineroad Inc. / TANAKA Yuui <[EMAIL PROTECTED]>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]