/ / Erreur AutoConfig Proxy dans HTMLUNIT - java, proxy, htmlunit, pac

Erreur Proxy AutoConfig dans HTMLUNIT - java, proxy, htmlunit, pac

J'ai une application qui utilise Htmlunit et je dois utiliser un fichier PAC, mais HtmlUnit affiche une erreur et je ne sais pas pourquoi.

Le fichier PAC est écrit en Javascript avec l’extension ".cgi".

Le code est le suivant:

WebClient webClient = new WebClient();

webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setActiveXNative(true); webClient.getOptions().setAppletEnabled(true); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setPopupBlockerEnabled(true); webClient.getOptions().setRedirectEnabled(true); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setUseInsecureSSL(true);

webClient.setAjaxController(new NicelyResynchronizingAjaxController());

webClient.getOptions().getProxyConfig().setProxyAutoConfigUrl("http://domain/proxy.pac");

HtmlPage currentPage = webClient.getPage(web);

Et les erreurs sont:

Exception in thread "main" java.lang.StackOverflowError at java.io.IOException.<init>(IOException.java:58) at java.io.InterruptedIOException.<init>(InterruptedIOException.java:64) at java.net.SocketTimeoutException.<init>(SocketTimeoutException.java:43) at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:150) at java.net.SocketInputStream.read(SocketInputStream.java:121) at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:160) at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:84) at org.apache.http.impl.io.SocketInputBuffer.isDataAvailable(SocketInputBuffer.java:95) at org.apache.http.impl.AbstractHttpClientConnection.isStale(AbstractHttpClientConnection.java:310) at org.apache.http.impl.conn.ManagedClientConnectionImpl.isStale(ManagedClientConnectionImpl.java:158) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:432) at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:167) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1281) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1198) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:307) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:376) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:361) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1237) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1339) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1198) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:307) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:376) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:361)

Il y a plus de lignes d'erreurs mais je n'ai pas putt.

Des idées?

Réponses:

0 pour la réponse № 1
webClient.getOptions().getProxyConfig().setProxyAutoConfigUrl("http://domain/proxy.pac");

Je pense que le problème dans la ligne ci-dessus s'il vous plaît vérifier l'URL du proxy, ce n'est pas correct. s'il vous plaît ouvrez-le d'abord dans le navigateur s'il est ouvert correctement puis appliquez-le sur le code.