Package com.sun.net.httpserver

Examples of com.sun.net.httpserver.HttpsConfigurator


      throw new RuntimeException("Could not set up SSL context", e);
    }
  }

  private HttpsConfigurator getConfigurator(final SSLContext sslContext) {
    return new HttpsConfigurator(sslContext) {
          @Override
          public void configure (HttpsParameters params) {
            final SSLContext context = getSSLContext();
            final SSLParameters sslParams = context.getDefaultSSLParameters();
            params.setNeedClientAuth(false);
View Full Code Here


     * Https Server
     */
    public void startHttpsServer() throws IOException, NoSuchAlgorithmException  {
        httpsServer = com.sun.net.httpserver.HttpsServer.create(new InetSocketAddress(0), 0);
        httpsServer.createContext("/", new MyHandler());
        httpsServer.setHttpsConfigurator(new HttpsConfigurator(SSLContext.getDefault()));
        httpsServer.start();
    }
View Full Code Here

     * Https Server
     */
    public void startHttpsServer() throws IOException, NoSuchAlgorithmException  {
        httpsServer = com.sun.net.httpserver.HttpsServer.create(new InetSocketAddress(0), 0);
        httpsServer.createContext("/test6614957/", new MyHandler());
        httpsServer.setHttpsConfigurator(new HttpsConfigurator(SSLContext.getDefault()));
        httpsServer.start();
    }
View Full Code Here

      //Create the SSL context with keystore & truststore
      SSLContext ssl = SSLContext.getInstance("TLS");
      ssl.init(keyFactory.getKeyManagers(), trustFactory.getTrustManagers(), new SecureRandom());

      HttpsServer httpsServer = HttpsServer.create(new InetSocketAddress(HOSTNAME, 8443), 10);
      httpsServer.setHttpsConfigurator(new HttpsConfigurator(ssl) {

        public void configure(HttpsParameters params) {

          //require client authentication
          SSLParameters sslparams = getSSLContext().getDefaultSSLParameters();
View Full Code Here

            //TrustManagerFactory tmf = TrustManagerFactory.getInstance ( TrustManagerFactory.getDefaultAlgorithm() );
            //tmf.init ( ks );
   
            // setup the HTTPS context and parameters
            sslContext.init ( kmf.getKeyManagers (), new TrustManager[]{trustManager}, null );
            httpsServer.setHttpsConfiguratornew HttpsConfigurator( sslContext )
            {
                public void configure ( HttpsParameters params )
                {
                    try
                    {
View Full Code Here

            TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
            tmf.init(keyStore);
            SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
            sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom());
            HttpsServer server = HttpsServer.create(new InetSocketAddress(portFlag.value(options)), 0);
            server.setHttpsConfigurator(new HttpsConfigurator(sslContext));
            return server;
        } else {
            return HttpServer.create(new InetSocketAddress(portFlag.value(options)), 0);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.net.httpserver.HttpsConfigurator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.