From: Ahmed A. <asa...@ya...> - 2014-02-12 13:50:33
|
Hi, - Please make sure you are using SVN version (http://build.canoo.com/htmlunit/) - What is the proxy server, so we can download and test against? Any public hostname? Ahmed ________________________________ From: ChrisMBX <chr...@gm...> To: htm...@li... Sent: Wednesday, February 12, 2014 4:45 PM Subject: [Htmlunit-user] Proxy problem : OK with URLConnection, KO with WebClient Hi all, I cannot access http pages through a proxy with WebClient. When I use an URLConnection there is no problem : Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("hostname", 8080)); URLConnection urlConnection = new URL("https://www.google.com/").openConnection(proxy); BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line; while ((line = bufferedReader.readLine()) != null) { System.out.println(line); } } finally { if (bufferedReader != null) { bufferedReader.close(); } } But when I try with WebClient, I have an error : WebClient webClient = new WebClient(BrowserVersion.CHROME, "hostname", 8080); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setThrowExceptionOnScriptError(false); HtmlPage htmlPage = webClient.getPage("https://www.google.com/"); System.out.println(htmlPage.asText()); The error is "407 Proxy Authentication Required. The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied." I don't understand why with URLConnection there is no authentification problem. Thank you for your help ! -- View this message in context: http://htmlunit.10904.n7.nabble.com/Proxy-problem-OK-with-URLConnection-KO-with-WebClient-tp33167.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |