Re: Embedded tomcat with HTTPS

2003-08-14 Thread Bill Barker
I'm going to assume that you're using 4.1.x.  In this case, you are using
the wrong Factory.  You want something like:

  Connector httpsConnector = embeddedTomcat.createConnector(null,

configuration.getHttpsPort(), true);
  CoyoteServerSocketFactory serverSocketFactory =

(CoyoteServerSocketFactory)httpsConnector.getFactory();
  serverSocketFactory.setKeystoreFile(configuration.getKeystoreFile());
  serverSocketFactory.setKeystorePass(antares);

- Original Message - 
From: Wesley Hall [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, August 10, 2003 1:23 PM
Subject: Embedded tomcat with HTTPS


 Hello,
   Myself and a collegue are currently working on an open source
 application, part of which involves embedding a servlet engine. I have
read
 through some tutorials and the API docs for tomcat and began development
of
 a class structure to provide this.

 I have, however come across a problem with my https connector. I currently
 have code that looks like this..

 Connector httpsConnector = embeddedTomcat.createConnector(null,
 configuration.getHttpsPort(), true);
 httpsConnector.setScheme(https);
 SSLServerSocketFactory serverSocketFactory = new SSLServerSocketFactory();
 serverSocketFactory.setKeystoreFile(configuration.getKeystoreFile());
 serverSocketFactory.setKeystorePass(antares);
 httpsConnector.setFactory(serverSocketFactory);
 embeddedTomcat.addConnector(httpsConnector);
 connectors.add(httpsConnector);

 configuration is a instance of a simple bean, getHttpsPort() returns 443,
 getKeystoreFile() returns the path to the keystore (generated as per the
 SSL-Howto doc). The location of the keystore is validated elsewhere in the
 code using a File object and a call to .isFile() and .canRead(), both of
 which return true when running this code.

 However... i am finding that although http://localhost:443 works
perfectly,
 https://localhost leaves the browser (MSIE) whirring away for 30 seconds
or
 so before displaying 'cannot find server'. With the former i get plenty of
 information in the logs but the latter adds nothing at all to the logs,
 making this problem very difficult to debug. I can change the keystore
pass
 to any value and there is no appreciable difference.

 Im happy to provide any more information as required...

 Would a kind sameritan type point me in the write direction as to what may
 be causing this issue?

 Regards Wesley I. Hall.

 P.S. I thought long and hard on whether this belonged on dev or user, but
 since we are discussing actually class structure i finally decided that
dev
 would probably be more appropriate. If i was wrong on that descision, you
 have my sincere apologies.


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


This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

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

Embedded tomcat with HTTPS

2003-08-10 Thread Wesley Hall
Hello,
  Myself and a collegue are currently working on an open source
application, part of which involves embedding a servlet engine. I have read
through some tutorials and the API docs for tomcat and began development of
a class structure to provide this.

I have, however come across a problem with my https connector. I currently
have code that looks like this..

Connector httpsConnector = embeddedTomcat.createConnector(null,
configuration.getHttpsPort(), true);
httpsConnector.setScheme(https);
SSLServerSocketFactory serverSocketFactory = new SSLServerSocketFactory();
serverSocketFactory.setKeystoreFile(configuration.getKeystoreFile());
serverSocketFactory.setKeystorePass(antares);
httpsConnector.setFactory(serverSocketFactory);
embeddedTomcat.addConnector(httpsConnector);
connectors.add(httpsConnector);

configuration is a instance of a simple bean, getHttpsPort() returns 443,
getKeystoreFile() returns the path to the keystore (generated as per the
SSL-Howto doc). The location of the keystore is validated elsewhere in the
code using a File object and a call to .isFile() and .canRead(), both of
which return true when running this code.

However... i am finding that although http://localhost:443 works perfectly,
https://localhost leaves the browser (MSIE) whirring away for 30 seconds or
so before displaying 'cannot find server'. With the former i get plenty of
information in the logs but the latter adds nothing at all to the logs,
making this problem very difficult to debug. I can change the keystore pass
to any value and there is no appreciable difference.

Im happy to provide any more information as required...

Would a kind sameritan type point me in the write direction as to what may
be causing this issue?

Regards Wesley I. Hall.

P.S. I thought long and hard on whether this belonged on dev or user, but
since we are discussing actually class structure i finally decided that dev
would probably be more appropriate. If i was wrong on that descision, you
have my sincere apologies.


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