You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Benedetto Dell'Ariccia <bd...@tiscali.com> on 2003/10/09 11:38:17 UTC
Calling HTTPS URL with IO
I'm still trying to call a HTTPS URL with the IO TAGLIB, no logs errors, the browser still waiting untill.
Can someone help me?
Benny
Re: Calling HTTPS URL with IO
Posted by Benedetto Dell'Ariccia <bd...@tiscali.com>.
Hi Hassan,
tnx for the help but, I show you this code, in this code there are 3 calls
with the IO taglib to 3 different HTTPS servers, the first one is the one
that does not work,
I had to put xxx and yyyy, the others works correctly without any other
code....you can try.....is this correct?
The error message for the first call is:
org.apache.jasper.JasperException: HTTPS hostname wrong: should be
Tnx a lot!
Benny
-------------CODE
<%@ page import="java.net.* ,java.io.*" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags"
%>
<%@ taglib uri="http://jakarta.apache.org/taglibs/io-1.0" prefix="io" %>
<html><body>
<io:http url="https://add-on-as1.tb.tiscali.it:443/xxx/yyyyy"
action="GET"/>
<io:http url="https://www.payonline.it/ext" action="POST" input="true"
output="true"/>
<io:http url="https://www.playsecureserver1.com:443" />
</body></html>
------------END CODE
----- Original Message -----
From: "Hassan Schroeder" <ha...@webtuitive.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Thursday, October 09, 2003 6:22 PM
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 ----------------------------- hassan@webtuitive.com
> Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
>
> dream. code.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Calling HTTPS URL with IO
Posted by Hassan Schroeder <ha...@webtuitive.com>.
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 ----------------------------- hassan@webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org