Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I configure a HostnameVerifier on an HttpsURLConnection?

configure
0
Posted

How do I configure a HostnameVerifier on an HttpsURLConnection?

0

Location: http://www.jguru.com/faq/view.jsp?EID=463751 Created: Jul 27, 2001 Author: Dwayne Schultz (http://www.jguru.com/guru/viewbio.jsp?EID=463738) Question originally posed by John Zukowski PREMIUM (http://www.jguru.com/guru/viewbio.jsp?EID=7 The solution: connection.setHostnameVerifier(new HostnameVerifier() { public boolean verify(String urlHostname, String certHostname) { return (“www.badcert.com”.equalsIgnoreCase(certHostname) && “xyz.badcert.com”.equalsIgnoreCase(urlHostname)) } }); Here I’m using a HostnameVerifier (in an anonymous class) to overlook a certificate name mismatch. In this case the vendor ‘badcert.com’ is using their ‘www.badcert.com’ on their ‘xyz.badcert.com’ server.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123