FIX: setAllowUserInteraction(true) Fails to Prompt CertificatesID: Q197944
|
Instead of prompting the user for client-side certificates, connection.setAllowUserInteraction(true); (where connection is a URLConnection object) fails. This happens when the Web server is configured so that it requests client certificates.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed for the Microsoft virtual machine build 3154 and greater.
import java.io.*;
import java.net.*;
import java.applet.*;
public class HttpGetClient extends Applet
{
public static void main(String[] args)
{
HttpGet(args[0]);
}
public void init()
{
HttpGet(getParameter("URL"));
}
public static void HttpGet(String url_s)
{
try
{
URL url = new URL(url_s);
URLConnection connection = url.openConnection();
connection.setAllowUserInteraction(true);
connection.connect();
InputStream in = connection.getInputStream();
int l = connection.getContentLength();
if (l < 0)
{
l = in.available();
}
System.out.println("Content-Length = " + l + "\r\n");
byte[] buf = new byte[l];
in.read(buf);
System.out.println();
System.out.println(new String(buf));
}
catch(Throwable e)
{
e.printStackTrace();
}
}
}
<html>
<head>
<title> Just testing SSL </title>
</head>
<body>
<hr>
<center>
<applet code=HttpGetClient.class width=200 height=280>
<param name=URL value=https://XYZ/HttpGetClient.html>
<h2> Just testing SSL </h2>
</applet>
</center>
<hr>
</body>
</html>
http://XYZ/HttpGetClient.html
The Java code calls setAllowUserInteraction(true). Therefore, the applet should prompt the user with the client certificate instead of failing.java.io.IOException: XYZ:443//HttpGetClient.html
Please see Internet Client SDK for more information.
For the latest Knowledge Base articles and other support information on
Visual J++ and the SDK for Java, see the following pages on the Microsoft
Technical Support site:
http://support.microsoft.com/support/visualj/(c) Microsoft Corporation <1998>, All Rights Reserved. Contributions by Mohan Ananthakrishnan, Microsoft Corporation.
http://support.microsoft.com/support/java/
Additional query words:
Keywords : kbJava kbJavaVM
Version :
Platform :
Issue type : kbbug
Last Reviewed: July 28, 1999