src/share/classes/com/sun/net/httpserver/HttpsConfigurator.java

Print this page




  50  * server.setHttpsConfigurator (new HttpsConfigurator(sslContext) {
  51  *     public void configure (HttpsParameters params) {
  52  *
  53  *         // get the remote address if needed
  54  *         InetSocketAddress remote = params.getClientAddress();
  55  *
  56  *         SSLContext c = getSSLContext();
  57  *
  58  *         // get the default parameters
  59  *         SSLParameters sslparams = c.getDefaultSSLParameters();
  60  *         if (remote.equals (...) ) {
  61  *             // modify the default set for client x
  62  *         }
  63  *
  64  *         params.setSSLParameters(sslparams);
  65  *     }
  66  * });
  67  * </blockquote></pre>
  68  * @since 1.6
  69  */

  70 public class HttpsConfigurator {
  71 
  72     private SSLContext context;
  73 
  74     /**
  75      * Creates an Https configuration, with the given SSLContext.
  76      * @param context the SSLContext to use for this configurator
  77      * @throws NullPointerException if no SSLContext supplied
  78      */
  79     public HttpsConfigurator (SSLContext context) {
  80         if (context == null) {
  81             throw new NullPointerException ("null SSLContext");
  82         }
  83         this.context = context;
  84     }
  85 
  86     /**
  87      * Returns the SSLContext for this HttpsConfigurator.
  88      * @return the SSLContext
  89      */




  50  * server.setHttpsConfigurator (new HttpsConfigurator(sslContext) {
  51  *     public void configure (HttpsParameters params) {
  52  *
  53  *         // get the remote address if needed
  54  *         InetSocketAddress remote = params.getClientAddress();
  55  *
  56  *         SSLContext c = getSSLContext();
  57  *
  58  *         // get the default parameters
  59  *         SSLParameters sslparams = c.getDefaultSSLParameters();
  60  *         if (remote.equals (...) ) {
  61  *             // modify the default set for client x
  62  *         }
  63  *
  64  *         params.setSSLParameters(sslparams);
  65  *     }
  66  * });
  67  * </blockquote></pre>
  68  * @since 1.6
  69  */
  70 @jdk.Supported
  71 public class HttpsConfigurator {
  72 
  73     private SSLContext context;
  74 
  75     /**
  76      * Creates an Https configuration, with the given SSLContext.
  77      * @param context the SSLContext to use for this configurator
  78      * @throws NullPointerException if no SSLContext supplied
  79      */
  80     public HttpsConfigurator (SSLContext context) {
  81         if (context == null) {
  82             throw new NullPointerException ("null SSLContext");
  83         }
  84         this.context = context;
  85     }
  86 
  87     /**
  88      * Returns the SSLContext for this HttpsConfigurator.
  89      * @return the SSLContext
  90      */