You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/10/13 20:33:28 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/net SSLServerSocketFactory.java

craigmcc    00/10/13 11:33:27

  Modified:    catalina/src/share/org/apache/catalina/net
                        SSLServerSocketFactory.java
  Log:
  Register the JSSE implementation of a URLStreamHandler package for the
  "https:" protocol.  This avoids IllegalArgumentException errors when you
  try to generate an https URL, but the URL class does not know what stream
  handler to use.
  
  Submitted by:  Vivek Nagar <Vi...@eng.sun.com>
  
  Revision  Changes    Path
  1.2       +30 -0     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/net/SSLServerSocketFactory.java
  
  Index: SSLServerSocketFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/net/SSLServerSocketFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SSLServerSocketFactory.java	2000/09/08 22:29:35	1.1
  +++ SSLServerSocketFactory.java	2000/10/13 18:33:27	1.2
  @@ -112,6 +112,20 @@
   
   
       /**
  +     * The name of our protocol handler package for the "https:" protocol.
  +     */
  +    private static final String PROTOCOL_HANDLER =
  +        "com.sun.net.ssl.internal.www.protocol";
  +
  +
  +    /**
  +     * The name of the system property containing a "|" delimited list of
  +     * protocol handler packages.
  +     */
  +    private static final String PROTOCOL_PACKAGES =
  +        "java.protocol.handler.pkgs";
  +
  +    /**
        * The configured socket factory.
        */
       private javax.net.ssl.SSLServerSocketFactory sslProxy = null;
  @@ -308,8 +322,24 @@
        */
       private synchronized void initialize() throws IOException {
   
  +        initHandler();
           initKeyStore();
           initProxy();
  +
  +    }
  +
  +
  +    /**
  +     * Register our URLStreamHandler for the "https:" protocol.
  +     */
  +    private void initHandler() {
  +
  +        String packages = System.getProperty(PROTOCOL_PACKAGES);
  +        if (packages == null)
  +            packages = PROTOCOL_HANDLER;
  +        else if (packages.indexOf(PROTOCOL_HANDLER) < 0)
  +            packages += "|" + PROTOCOL_HANDLER;
  +        System.setProperty(PROTOCOL_PACKAGES, packages);
   
       }