Multipart posts with SSL should work. The only strange thing I noticed in your example is that the file part is never added to the post method. Is this what's happening in the real code? If so, this could be the source of the problem. If not, a wire log of the problem would help. Take a look at http://jakarta.apache.org/commons/httpclient/logging.html in the wireLog section for more details.

Mike

On Thursday, March 6, 2003, at 09:22 PM, TANAKA Yuui wrote:


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(AutoCloseInputS tream.java:142)
at java.io.FilterInputStream.read(FilterInputStream.java:90)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputS tream.java:161)
at org.apache.commons.httpclient.HttpMethodBase.getResponseBody(HttpMethod Base.java:667)
at org.apache.commons.httpclient.methods.GetMethod.getResponseBody(GetMeth od.java:293)
at org.apache.commons.httpclient.HttpMethodBase.getResponseBodyAsString(Ht tpMethodBase.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]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to