Thanks Scott for pointing me to the test case.  I had looked in that directory but did 
not find it because it is in the Attic (don't know why it would be there).

The test case does not add anything that I am not already doing except for setting the 
trusted keystore.  Is this something required by JBoss?  I am able to run outside of 
JBoss with the trusted keystore null.

Another thing that I found interesting was that if I change:
URL url = new URL(HTTPS_URL);
To specify the handler:
URL url = new URL(null,DEFAULT_URL,new 
com.sun.net.ssl.internal.www.protocol.https.Handler()) ;
I get a stack overflow.

Here are the key sections of my code:

      java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
      String handlers = System.getProperty("java.protocol.handler.pkgs");
      if (handlers == null
         || handlers.indexOf("com.sun.net.ssl.internal.www.protocol") < 0) {
        if (handlers == null) {
          handlers = "" ;
        } else {
          handlers += "|" ;
        } //end if
        handlers += "com.sun.net.ssl.internal.www.protocol" ;
        System.setProperty("java.protocol.handler.pkgs",handlers);
      } //end if
      URL url = new URL(null,DEFAULT_URL,new 
com.sun.net.ssl.internal.www.protocol.https.Handler()) ;
    HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
    conn.setRequestMethod(requestProperty);
    conn.setRequestProperty("Content-type","application/x-www-form-urlencoded");
    String sendParams = getParamText() ;
    if (sendParams != null) {
      conn.setDoOutput(true);
      DataOutputStream output = new DataOutputStream(conn.getOutputStream()) ;
      output.writeBytes(sendParams);
      output.flush();
      output.close();
    } //end if
    BufferedReader r = new BufferedReader(new 
InputStreamReader(conn.getInputStream()));
    Vector lines = new Vector() ;
    String line = null ;
    while ((line = r.readLine()) != null) {
      lines.add(line);
    } //end while
    r.close();
    conn.disconnect();

Why would this work any different in JBoss then anywhere else?

> From: "Scott M Stark" <[EMAIL PROTECTED]>
>
> There is a testcase of a dynamically deployed service which uses
> an https url in the 3.0 testsuite. See
> org.jboss.test.security.service.HttpsClient
> org.jboss.test.security.HttpsUnitTestCase

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to