2
我想一個cookie添加到Web客戶端,該代碼按預期工作GAE之外:如何將Cookie添加到的HtmlUnit Web客戶端上GAE
WebClient webClient = new WebClient(CHROME);
webClient.addCookie("storepath=us/en", new URL("http://www.zara.com/"), null);
但在GAE它拋出:
java.lang.IllegalArgumentException: Port may not be negative
at org.apache.http.util.Args.notNegative(Args.java:115)
at org.apache.http.cookie.CookieOrigin.<init>(CookieOrigin.java:52)
at com.gargoylesoftware.htmlunit.CookieManager.buildCookieOrigin(CookieManager.java:102)
at com.gargoylesoftware.htmlunit.WebClient.addCookie(WebClient.java:2258)
如何在GAE上添加此cookie?
你能提供'新的URL的輸出( 「http://www.zara.com/」).getDefaultPort()'在GAE? –
@AhmedAshour -1 –
我不明白爲什麼它被設置爲-1 –