The sample shows how to handle the Invalid Certificate and Invalid Certificate Name security errors. All other security problems will be handled by default: import com.jniwrapper.win32.ie.Browser; import com.jniwrapper.win32.ie.event.HttpSecurityHandler; import com.jniwrapper.win32.ie.event.HttpSecurityAction; import com.jniwrapper.win32.ie.event.SecurityProblem; import javax.swing.*; /** * The sample shows how to handle the Invalid Certificate and Invalid * Certificate Name security errors. All other security problems will * be handled by default. * * @author Vladimir Ikryanov */ public class SecurityProblemSample { public static void main(String[] args) { Browser browser = new Browser(); JFrame frame = new JFrame("JExplorer Sample"); frame.setContentPane(browser); frame.setSize(700, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.setHttpSecurityHandler(new HttpSecurityHandler() { public HttpSecurityAction onSecurityProblem(SecurityProblem problem) { // when the problem in invalic certificate, then just ignore it if (problem.isInvalidCertificate() || problem.isInvalidCertificateName()) { return HttpSecurityAction.CONTINUE; } return HttpSecurityAction.DEFAULT; } }); browser.navigate("https://somesecuresite"); } } |
Examples >