From: Sue Yi <su...@gm...> - 2005-08-11 13:44:39
|
Hello, I am using HtmlUnit to test an application which contains redirects. In the application there is a redirect to "'/a/b/..\BIN\c.ASP" (URI changed for privacy) -- I get a IllegalArgumentException "escaped absolute path not valid". Is this because all URI's needed to be absolute, or is it because there are both "\" and "/" in the URI? Can anyone suggest how I could solve this problem? Thank you, Sue java.lang.IllegalArgumentException: Invalid uri '/a/b/..\BIN\c.ASP': escaped absolute path not valid =09at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.ja= va:219) =09at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java= :88) =09at com.gargoylesoftware.htmlunit.HttpWebConnection.makeHttpMethod(HttpWe= bConnection.java:199) =09at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebCo= nnection.java:134) =09at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.jav= a:1588) =09at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.jav= a:1562) =09at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:359) =09at com.gargoylesoftware.htmlunit.html.BaseFrame.loadInnerPageIfPossible(= BaseFrame.java:212) =09at com.gargoylesoftware.htmlunit.html.BaseFrame.loadInnerPage(BaseFrame.= java:198) =09at com.gargoylesoftware.htmlunit.html.HtmlPage.notifyNodeAdded(HtmlPage.= java:1396) =09at com.gargoylesoftware.htmlunit.html.DomNode.appendChild(DomNode.java:4= 63) =09at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.star= tElement(HTMLParser.java:368) =09at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour= ce) =09at org.cyberneko.html.filters.DefaultFilter.startElement(DefaultFilter.j= ava:179) =09at org.cyberneko.html.filters.NamespaceBinder.startElement(NamespaceBind= er.java:280) =09at org.cyberneko.html.HTMLTagBalancer.callStartElement(HTMLTagBalancer.j= ava:1009) =09at org.cyberneko.html.HTMLTagBalancer.startElement(HTMLTagBalancer.java:= 639) =09at org.cyberneko.html.HTMLScanner$ContentScanner.scanStartElement(HTMLSc= anner.java:2343) =09at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1= 820) =09at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:789) =09at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:478= ) =09at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:431= ) =09at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) =09at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.pars= e(HTMLParser.java:330) =09at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:2= 45) =09at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(Defau= ltPageCreator.java:115) =09at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPa= geCreator.java:84) =09at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient= .java:709) =09at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:376) =09at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415) =09at HTMLUnitRun.test(HTMLUnitRun.java:40) =09at Main.main(Main.java:13) |
From: Marc G. <mgu...@ya...> - 2005-08-11 13:51:49
|
As far as I know is "\" not legal in an URI. What does your browser do (Firefox for instance, because IE...): does it change the received "\" to "/"? Is it in a redirect or as src of a frame, what suggests your stack trace? Marc. Sue Yi wrote: > Hello, > > I am using HtmlUnit to test an application which contains redirects. > In the application there is a redirect to "'/a/b/..\BIN\c.ASP" (URI > changed for privacy) -- I get a IllegalArgumentException "escaped > absolute path not valid". > > Is this because all URI's needed to be absolute, or is it because > there are both "\" and "/" in the URI? > > Can anyone suggest how I could solve this problem? > > Thank you, > Sue > > > java.lang.IllegalArgumentException: Invalid uri '/a/b/..\BIN\c.ASP': > escaped absolute path not valid > at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:219) > at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:88) > at com.gargoylesoftware.htmlunit.HttpWebConnection.makeHttpMethod(HttpWebConnection.java:199) > at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:134) > at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1588) > at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1562) > at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:359) > at com.gargoylesoftware.htmlunit.html.BaseFrame.loadInnerPageIfPossible(BaseFrame.java:212) > at com.gargoylesoftware.htmlunit.html.BaseFrame.loadInnerPage(BaseFrame.java:198) > at com.gargoylesoftware.htmlunit.html.HtmlPage.notifyNodeAdded(HtmlPage.java:1396) > at com.gargoylesoftware.htmlunit.html.DomNode.appendChild(DomNode.java:463) > at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.startElement(HTMLParser.java:368) > at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) > at org.cyberneko.html.filters.DefaultFilter.startElement(DefaultFilter.java:179) > at org.cyberneko.html.filters.NamespaceBinder.startElement(NamespaceBinder.java:280) > at org.cyberneko.html.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1009) > at org.cyberneko.html.HTMLTagBalancer.startElement(HTMLTagBalancer.java:639) > at org.cyberneko.html.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2343) > at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1820) > at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:789) > at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:478) > at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:431) > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) > at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:330) > at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:245) > at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:115) > at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:84) > at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:709) > at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:376) > at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415) > at HTMLUnitRun.test(HTMLUnitRun.java:40) > at Main.main(Main.java:13) > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |
From: Sue Yi <su...@gm...> - 2005-08-11 14:10:39
|
> What does your browser do (Firefox for instance, because IE...): does it = change the received "\" to "/"? Ya, I noticed IE replaces "/" with "\" ... and the tested application only needs to run on IE, so these uri's must be worked with. > Is it in a redirect or as src of a frame, what suggests your stack trace? I think it is as src of an IFrame .. the page being loaded has several IFra= mes. Do you think it is possible to solve this without building HtmlUnit source with added code to convert "\" to "/"? Thanks, Sue On 8/11/05, Marc Guillemot <mgu...@ya...> wrote: > As far as I know is "\" not legal in an URI. >=20 > What does your browser do (Firefox for instance, because IE...): does it = change the received "\" to "/"? >=20 > Is it in a redirect or as src of a frame, what suggests your stack trace? >=20 > Marc. >=20 > Sue Yi wrote: > > Hello, > > > > I am using HtmlUnit to test an application which contains redirects. > > In the application there is a redirect to "'/a/b/..\BIN\c.ASP" (URI > > changed for privacy) -- I get a IllegalArgumentException "escaped > > absolute path not valid". > > > > Is this because all URI's needed to be absolute, or is it because > > there are both "\" and "/" in the URI? > > > > Can anyone suggest how I could solve this problem? > > > > Thank you, > > Sue > > > > > > java.lang.IllegalArgumentException: Invalid uri '/a/b/..\BIN\c.ASP': > > escaped absolute path not valid > > at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethod= Base.java:219) > > at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMeth= od.java:88) > > at com.gargoylesoftware.htmlunit.HttpWebConnection.makeHttpMethod= (HttpWebConnection.java:199) > > at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(Ht= tpWebConnection.java:134) > > at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebCli= ent.java:1588) > > at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebCli= ent.java:1562) > > at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java= :359) > > at com.gargoylesoftware.htmlunit.html.BaseFrame.loadInnerPageIfPo= ssible(BaseFrame.java:212) > > at com.gargoylesoftware.htmlunit.html.BaseFrame.loadInnerPage(Bas= eFrame.java:198) > > at com.gargoylesoftware.htmlunit.html.HtmlPage.notifyNodeAdded(Ht= mlPage.java:1396) > > at com.gargoylesoftware.htmlunit.html.DomNode.appendChild(DomNode= .java:463) > > at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuild= er.startElement(HTMLParser.java:368) > > at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unkno= wn Source) > > at org.cyberneko.html.filters.DefaultFilter.startElement(DefaultF= ilter.java:179) > > at org.cyberneko.html.filters.NamespaceBinder.startElement(Namesp= aceBinder.java:280) > > at org.cyberneko.html.HTMLTagBalancer.callStartElement(HTMLTagBal= ancer.java:1009) > > at org.cyberneko.html.HTMLTagBalancer.startElement(HTMLTagBalance= r.java:639) > > at org.cyberneko.html.HTMLScanner$ContentScanner.scanStartElement= (HTMLScanner.java:2343) > > at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner= .java:1820) > > at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:7= 89) > > at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.j= ava:478) > > at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.j= ava:431) > > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) > > at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuild= er.parse(HTMLParser.java:330) > > at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser= .java:245) > > at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPag= e(DefaultPageCreator.java:115) > > at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(De= faultPageCreator.java:84) > > at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(We= bClient.java:709) > > at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java= :376) > > at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java= :415) > > at HTMLUnitRun.test(HTMLUnitRun.java:40) > > at Main.main(Main.java:13) > > > > > > ------------------------------------------------------- > > SF.Net email is Sponsored by the Better Software Conference & EXPO > > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Pract= ices > > Agile & Plan-Driven Development * Managing Projects & Teams * Testing &= QA > > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5= sf > > _______________________________________________ > > Htmlunit-user mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practic= es > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & Q= A > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |
From: Marc G. <mgu...@ya...> - 2005-08-11 14:18:07
|
>>What does your browser do (Firefox for instance, because IE...): does it change the received "\" to "/"? > > Ya, I noticed IE replaces "/" with "\" ... and the tested application > only needs to run on IE, so these uri's must be worked with. "/" with "\"? Sure? Not "\" with "/"? Does your "'/a/b/..\BIN\c.ASP" gets the same thinks as "'/a/b/../BIN/c.ASP"? >>Is it in a redirect or as src of a frame, what suggests your stack trace? > > I think it is as src of an IFrame .. the page being loaded has several IFrames. > > Do you think it is possible to solve this without building HtmlUnit > source with added code to convert "\" to "/"? a complete fix would need to build htmlunit to be integrate. Nevertheless I guess that you can write your own WebConnection wrapping the default one and rewriting the urls containing "\". Marc. |
From: Sue Yi <su...@gm...> - 2005-08-11 19:22:11
|
Hi Marc, Thanks, that was an awesome suggestion! I'm now using a custom HtmlWebConnection which wraps HtmlWebConnection. And then setWebConnection on the WebClient to use it -- there are no more problems with illegal URI's. > "/" with "\"? Sure? Not "\" with "/"? You were right =3D) Sue On 8/11/05, Marc Guillemot <mgu...@ya...> wrote: > >>What does your browser do (Firefox for instance, because IE...): does i= t change the received "\" to "/"? > > > > Ya, I noticed IE replaces "/" with "\" ... and the tested application > > only needs to run on IE, so these uri's must be worked with. >=20 > "/" with "\"? Sure? Not "\" with "/"? > Does your "'/a/b/..\BIN\c.ASP" gets the same thinks as "'/a/b/../BIN/c.AS= P"? >=20 >=20 > >>Is it in a redirect or as src of a frame, what suggests your stack trac= e? > > > > I think it is as src of an IFrame .. the page being loaded has several = IFrames. > > > > Do you think it is possible to solve this without building HtmlUnit > > source with added code to convert "\" to "/"? >=20 > a complete fix would need to build htmlunit to be integrate. Nevertheless= I guess that you can write your own > WebConnection wrapping the default one and rewriting the urls containing = "\". >=20 > Marc. >=20 >=20 > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practic= es > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & Q= A > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |