hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Watts <ti...@earthlink.net>
Subject Re: HttpClient and Simple SSL
Date Tue, 13 Dec 2005 13:34:33 GMT
Below is about the simplest example you can write. As you can see there's 
nothing distinctive other than that 's' on https. What exception are you 
getting? I have to say that this works fine on my Linux box but it would 
probably throw a "CertificateException: Could not find trusted certificate" 
on my Windows box. Why?, I don't know. Don't really think it's an OS issue; 
something different about the java environment on each machine. I'm still 
puzzling about that...

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;

public class Test {
    public static void main(String[] args) throws Exception {
        HttpClient client = new HttpClient();
        HttpMethod get = new GetMethod("https://www.verisign.com/");
        int httpRc = client.executeMethod(get);
        System.out.println(httpRc);
    }
}

On Tuesday 13 December 2005 07:43, bashiro wrote:
> Thanks for the tips.
> You know I always get exeption when working with
> ssl. That i why i want an example someone has doe using
> the httpclient, so that I can edit that and use.
>
> I just want to compare other examples with the use guide and
> then work further on.
>
> Thanks
>
> Bashiro
>
>  --- On Tue 12/13, Tim Watts < timtw@earthlink.net > wrote:
> From: Tim Watts [mailto: timtw@earthlink.net]
> To: httpclient-user@jakarta.apache.org
> Date: Tue, 13 Dec 2005 06:38:48 -0500
> Subject: Re: HttpClient and Simple SSL
>
> On Tuesday 13 December 2005 05:08, bashiro wrote:> 1. A simple way to work
> with HttpClient and SSL ?>    (Not the user manual of Httpclient)Mostly,
> I've found working with SSL to be quite transparent.> All what I mean is a
> way to import SSL certificate and work further with> it. An example is ;
> Let's say I want to work with Https://www.versign.com.> I heard I have to
> first right click on the Security key-lock icon on the> tray to save it as
> a cert. Then import it in java .Not sure about the right-click business but
> try $JAVAHOME/jre/bin/keytool -help (especially -import).Hope this helps
> somewhat.------------------------------------------------------------------
>---To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.orgFor
> additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
> _______________________________________________
> No banners. No pop-ups. No kidding.
> Make My Way  your home on the Web - http://www.myway.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message