可以结合 Jsonp 解析
官方网站:http://htmlunit.sourceforge.net/dependencies.html
下载地址:https://sourceforge.net/projects/htmlunit/files/htmlunit/
/**
* If set to <code>true</code>, the client will accept connections to any host, regardless of
* whether they have valid certificates or not. This is especially useful when you are trying to
* connect to a server with expired or corrupt certificates.
* @param useInsecureSSL whether or not to use insecure SSL
*/
public void setUseInsecureSSL(final boolean useInsecureSSL) {
useInsecureSSL_ = useInsecureSSL;
}
所以在init()时,也就是构造一个webclient时 ,打开最后的注释行即可解决这个异常……
public void init() throws Exception {
webclient = new WebClient(BrowserVersion.FIREFOX_17);
webclient.getOptions().setJavaScriptEnabled(true);
webclient.getOptions().setThrowExceptionOnScriptError(false);
webclient.getOptions().setCssEnabled(false);
webclient.getCookieManager().clearCookies();
webclient.getCache().clear();
webclient.setRefreshHandler(new ImmediateRefreshHandler());
webclient.getOptions().setTimeout(600*1000);
webclient.setJavaScriptTimeout(600*1000);
webclient.setAjaxController(new NicelyResynchronizingAjaxController());
webclient.getOptions().setJavaScriptEnabled(true);
webclient.setJavaScriptTimeout(600*1000);
webclient.getOptions().setRedirectEnabled(true);
webclient.waitForBackgroundJavaScript(60*1000);
webclient.getOptions().setThrowExceptionOnScriptError(false);
webclient.getOptions().setThrowExceptionOnFailingStatusCode(false);
// w