From: Brad C. <yo...@br...> - 2005-03-03 17:12:42
|
Just make something like ImmediateRefreshHandler or WaitingRefreshHandler that handles your special case as well. --- Mike Firth <mik...@ho...> wrote: > Yes, it works in IE and Safari. > > So how do you do manual redirection, since auto-redirect isn't working > properly? > > The closest things I can find to a spec on status code 302 are: > > * /javadoc/javax/servlet/http/HttpServletResponse.html#SC_MOVED_TEMPORARILY > * > http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String) > * http://www.faqs.org/rfcs/rfc2068.html > > > >From: Brad Clarke <yo...@br...> > >Reply-To: htm...@li... > >To: htm...@li... > >Subject: Re: [Htmlunit-user] Redirect to relative address in a frame causes > >loop > >Date: Wed, 2 Mar 2005 08:15:21 -0800 (PST) > > > >Assuming that this works in the browser for you then it's likely a bug with > >no > >simple fix (you could pull latest CVS and make a custom RefreshHandler but > >it would > >not be a generic fix because the data it's given would be incorrect). > > > >That seems like a strange thing to specify in a Location header for the > >response you > >expect. Is there a spec anywhere on interpretation of incomplete URIs in > >HTTP > >Location headers? > > > >--- Mike Firth <mik...@ho...> wrote: > > > > > Hi, > > > > > > Is there a quick workaround to this problem? And should I submit it as a > > > bug? > > > > > > A redirect (302) occurs in a frame. It specifies a relative location, > >but > > > HtmlUnit is truncating the address, causing the website to respond with > >the > > > whole frameset. When autoredirect is on, this causes an infinite loop! I > > > never get past webClient.getPage(url) and the log fills up with: > > > > > > 22:33:15,132 (HttpMethodDirector:780) INFO [main] - Redirect requested > >but > > > followRedirects is disabled > > > 22:33:17,059 (HttpMethodDirector:780) INFO [main] - Redirect requested > >but > > > followRedirects is disabled > > > etc, etc, etc. > > > > > > My code: > > > final WebClient webClient = new > > > WebClient(BrowserVersion.INTERNET_EXPLORER_6_0); > > > webClient.setRedirectEnabled(true); > > > final URL url = new URL("http://somewhere.com/main/"); > > > final HtmlPage page = (HtmlPage) webClient.getPage(url); > > > > > > The response is 200 OK and this: > > > > > > <html> > > > <head> > > > <title>somewhere.com</title> > > > <meta http-equiv="Content-Type" content="text/html"> > > > </head> > > > <frameset rows="0,*" frameborder="NO" border="0" framespacing="0"> > > > <frame src="blank.php" name="stealthFrame" scrolling="NO" noresize > > > > <frame src="front.php" name="frontFrame"> > > > </frameset> > > > <noframes> > > > <body> > > > </body></noframes> > > > </html> > > > > > > but front.php returns 302 Found, with location: ?choice=first , which > >should > > > cause this: > > > > > > GET /main/front.php?choice=first > > > > > > but instead HtmlUnit does this: > > > > > > GET /main/?choice=first > > > > > > which the website responds to by sending the first page again. Instant > >loop. > > > > > > Is there a quick workaround? How do you code to handle a redirect > >manually? > > > > > > Regards, > > > > > > Mike > > > > > > > >------------------------------------------------------- > >SF email is sponsored by - The IT Product Guide > >Read honest & candid reviews on hundreds of IT Products from real users. > >Discover which products truly live up to the hype. Start reading now. > >http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > >_______________________________________________ > >Htmlunit-user mailing list > >Htm...@li... > >https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today - it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |