Hey Hassan,

I was aware of the fact taht there were several extra steps necessary to get an HTTPS 
connection, but not that it required this much code in the page. This makes the use of 
IO very impractical for this use case. Now it would seem to be a very good idea to put 
this code in the tag itself, but I wonder if that is possible at all. I see a lot of 
Sun in the code you wrote, is that code that is dependant on a Sun JVM?

Grtz,

Martin

> -----Original Message-----
> From: Hassan Schroeder [mailto:[EMAIL PROTECTED]
> Sent: donderdag 9 oktober 2003 18:23
> To: Tag Libraries Users List
> Subject: Re: Calling HTTPS URL with IO
> 
> 
> Benedetto Dell'Ariccia wrote:
> 
> > I'm still trying to call a HTTPS URL with the IO TAGLIB, 
> 
> Sorry, missed this earlier.
> 
> The IO taglib works, but you need to prep your environment first;
> here's a sample that should get you started...
> 
> <%@ page
>          import = "javax.servlet.http.*,
>                                  java.io.*,
>                                  javax.net.ssl.*,
>                                  java.security.cert.X509Certificate,
>                                  java.security.cert.*,
>                                  java.security.KeyStore,
>                                  java.security.Provider,
>                                  java.util.*"
>          errorPage = "oops.jsp"
> %>
> <%@ taglib uri="http://jakarta.apache.org/taglibs/io-1.0"; 
> prefix="io" %>
> <%
>          try
>          {
>                  KeyStore ks = KeyStore.getInstance("JKS","SUN");
>                  ks.load(new 
> FileInputStream("/path/to/cacerts"), null);
>                  TrustManagerFactory myFactory;
>                  myFactory = 
> TrustManagerFactory.getInstance("SunX509");
>                  myFactory.init(ks);
> 
>                  SSLContext ctx;
>                  ctx = SSLContext.getInstance("SSL");
>                  ctx.init(null, myFactory.getTrustManagers(), null);
>  
> HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
> 
>          }
>          catch (Exception noSSLConnectionAvailable)
>          {
>                  
> System.out.println(noSSLConnectionAvailable.getMessage());
>                  /* noSSLConnectionAvailable needs to divert 
> to an error page,
>                   * since we can't process the transaction this way.
>                   */
>          }
> %>
> 
> 
> <io:http url="https://secure.example.com/program";
>               action="POST" input="true" output="true">
> 
> 
> ... and Bob's y'r uncle  :-)
> 
> HTH!
> -- 
> Hassan Schroeder ----------------------------- [EMAIL PROTECTED]
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
> 
>                            dream.  code.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to