hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Iker Bilbao <ib...@tid.es>
Subject Post and https
Date Mon, 21 Apr 2003 14:31:17 GMT
Hello,

  I am trying to make a post to an https server and I can not make it
  work. I have what is was in the tutorial for posting but I get the
  following error:
            A recoverable exception occurred, retrying.  java.net.SocketException: Software
caused connection
abort: JVM_recv in socket input stream read
  I have retried the operation but it does not work.

  The GetMehtod works well but not post.

  Here is my code:
  -------------------
  Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
  System.getProperties().put("java.protocol.handler.pkgs", "org.apache.commons.httpclient.HttpClient");
  System.setProperty("javax.net.ssl.trustStore","C:\\.keystore");
  System.setProperty("javax.net.ssl.keyStore","C:\\.keystore");
  System.setProperty("javax.net.ssl.keyStorePassword","password");

  HttpClient client = new HttpClient();
  client.getState().setCredentials("Realm",new
UsernamePasswordCredentials("user","password"));

  PostMethod post = new PostMethod("https://server:1234" +"/gestorpiloto");
  NameValuePair[] data = {
    new NameValuePair("tipoOperacion","alta")
  };

  post.setRequestBody(data);
  post.setDoAuthentication( true );

  try
  {
     int status = client.executeMethod( post );
     System.out.println(status + "\n" + post.getResponseBodyAsString());
  }
  catch (HttpRecoverableException e)
  {
     System.err.println("A recoverable exception occurred, retrying.  " + e.getMessage());
  }
  catch (IOException e)
  {
     System.err.println("Failed to download file.");
     e.printStackTrace();
     System.exit(-1);
  }
  catch (Exception e)
  {
     e.printStackTrace();
  }
  
  -------------------

  Has anyone any idea o what I am doing wrong?

Thanks in advance por your help.
Iker


Mime
View raw message