I don't think this subject is really on topic for the tomcat list...

import javax.net.ssl.*;
import java.net.*;


public class HTTPTest
{
  public static void main (String args[])
  {
    try
    {
      URLConnection myConnection = 
        (new URL("https://somesite.somedomain.com/";)).openConnection ();
      System.out.println (myConnection.getInputStream().available());
    }
    catch (Exception exception)
    {
      System.out.println (exception.getMessage());
    }
  }
} 

Try the following guys, and tell us what happens.

Maybe you might want to email me direct since this is a tomcat list, not a
java list.

> -----Original Message-----
> From: John Kammer [mailto:[EMAIL PROTECTED] 
> Sent: December 3, 2003 1:26 PM
> To: Tomcat-User
> Subject: Need Help getting SSL to work with HttpsURLConnections
> 
> Forgive me, I'm new at this...
> 
> I am using: Java v 1.4.2_02-b03
>           : Tomcat v 4.1.29
> 
> Im having trouble getting an HttpsURLConnection to work as 
> expected. I suspect I am missing something (possibly a great 
> many things) and would appreciate any insight anyone could 
> provide. I've not been able to find a single source that 
> addresses this problem although I've found bits and pieces in 
> several places. 
> 
> I have a simple servlet running in Tomcat that does nothing 
> more than report back that it is alive. Posting to it at 
> http://myserver:8080/simpleServlet/simpleServlet returns a 
> response of:
> 
>       <simpleServletResponse>I am alive!</simpleServletResponse>. 
> 
> Additionally I have a simple client app that calls the 
> servlet with a POST. The client can run on either the same 
> machine as the server or a different machine. 
> 
> 1.    Using an HttpURLConnection in the client app works 
> fine. I can call the servlet on either port 8080 (http) or 
> 8443 (https).  This works from either machine.
> 
> 2.    If I do nothing other than change the HttpURLConnection 
> to an HttpsURLConnection then everything falls apart 
> immediately and I dont understand why (I do believe I have 
> the proper imports included and it all compiles fine). From 
> everything I can tell I should be able to replace the one 
> with the other. 
> 
> 3.    Keystores & certificates:  I have generated 
> certificates for both machines using keytool and have 
> imported the client machine certificate into the trustedcerts 
> file on the server machine. I have NOT had any of these 
> certificates signed by a certificate authority (and due to 
> complexities I wont go into here that isnt likely to 
> happen).  Do the certificates need to be signed by a CA in 
> order for HttpsURLConnection to work?
> 
> 4.    The result of calling the method url.openConnection() 
> is that null is printed to the screen then program 
> execution simply stops. No Exception seems to be thrown  
> everything just stops Why? 
> 
> HttpsURLConnection conn = (HttpsURLConnection) myurl.openConnection();
> 
> Ultimately I would like to get Client-Certification working 
> but havent been able to find a good guide out there for 
> doing so. At the moment I am taking small steps in the hope 
> of gaining a better understanding. Any help would be greatly 
> appreciated. 
> 
> Thanks in advance !
> -- John Kammer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__ 
    This communication is intended for the use of the recipient to whom it
    is addressed, and may contain confidential, personal, and or privileged
    information. Please contact us immediately if you are not the intended
    recipient of this communication, and do not copy, distribute, or take
    action relying on it. Any communications received in error, or
    subsequent reply, should be deleted or destroyed.
---

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

Reply via email to