>>> Juan Arraiza <[EMAIL PROTECTED]> 15-Jan-01 3:59:23 PM >>>
>I'm really having a bad time trying to establish a
>connection to a resource that is in a https server.
This is not really a servlet question but it's quite closely related to servlets (at
least it's about HTTP) so I'll answer it.
>If I try the following code:
> URL url = new URL("https://www.myhttpsserver/myresource");
>it throws a MalformedURLException because it doesn´t recognice
>the https as a valid protocol.
That's right. Default Java only supports the HTTP protocol for URLs like that.
>I've heard that installing JSSE1.0.2 and adding a
>few lines to my code could help, but I have not been
>able to do so.
Sun's JSSE provides an implementation of HttpsURLConnection which is what you need to
get the job done.
>The code I´ve tried is:
> System.setProperty("java.protocol.handler.pkgs",
> "com.sun.net.ssl.internal.www.protocol");
> java.security.Security.addProvider(
> new com.sun.net.ssl.internal.ssl.Provider() );
> URL url = new URL("https://www.myhttpsserver/myresource");
>
Not sure if that works. Did you look at the examples section in the JSSE download?
The URL example there says to set the following property
java.protocol.handler.pkgs = com.sun.net.ssl.internal.www.protocol
But I don't see it saying anything about the secure provider.
>Do any of you have any further ideas?
You could try setting the property on the command line (with the -D switch).
You must ensure that the JSSE libs are all in the classpath.
If you have real trouble try running the examples and seeing if they work. If you
can't manage that send me your command line and I'll see if I can spot if you're doing
anything wrong.
Nic
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html