FileDocCategorySizeDatePackage
HttpsClient.javaAPI DocExample1454Mon Jan 15 12:41:26 GMT 2001javasec.samples.ch14

HttpsClient

public class HttpsClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        URL u = new URL(args[0]);
        // Alternately, we could set a global verifier like this
        // HttpsURLConnection.setDefaultHostnameVerifier(
        //                  new HttpClientVerifier());

        HttpsURLConnection huc =
                  (HttpsURLConnection) u.openConnection();
        // Instead, we set the verifier only for this instance
        huc.setHostnameVerifier(new HttpClientVerifier());

        BufferedReader br = new BufferedReader(
                        new InputStreamReader(huc.getInputStream()));
        String s = br.readLine();
        while (s != null) {
            System.out.println(s);
            s = br.readLine();
        }