From: Rousseau, J. R. <JRR...@Ba...> - 2004-12-10 18:31:21
|
I'm so confused with this problem... Here are my logs when it works Content type is: text/html Content stream is: <html xmlns:translator="com.banctec.pca.pub.PublicLanguageTranslatorUtil" xmlns:java="java"> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> (...) Here is when it doesn't work: Content type is: Content Stream is: <html xmlns:translator="com.banctec.pca.pub.PublicLanguageTranslatorUtil" xmlns:java="java"> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> (...) We clearly see that webResponde.getContentType() returns null !! but why !?!?!? response content stream is the same as the correct output. So how is it possible that my content-type is null in certain pages ? > -----Original Message----- > From: David D.Kilzer [mailto:ddk...@ki...] > Sent: Friday, December 10, 2004 11:40 AM > To: htm...@li... > Subject: Re: [Htmlunit-user] Re: Problems handling with the > Content-Type > i s specified using ME TA tags? > > > What "Content-Type:" header is your web server sending back for this > page? (If you're using Mozilla or Firefox, you can do a "Get Info" > once the page is loaded to find out, or use a packet sniffer like > Ethereal to capture the headers "on the wire".) > > In htmlunit-1.3, the DefaultPageCreator.createPage() method is where > the decision is made on what type of page to create. > Apparently, this > page is causing all of the if/else logic to fall through to > create an > UnexpectedPage object. > > Dave > > > On Dec 10, 2004, at 9:16 AM, Rousseau, Jean Rene wrote: > > > Hi, > > > > Here is more info about my problem. I'm really confused, > because I have > > similar headers in other pages and they work ok !!. > > > > Any ideas ? > > > > > > code: > > > > URL url = new > URL(state.getBaseUrl()+"/html/admin/home_en.html"); > > HtmlPage page = null; > > page = (HtmlPage)state.getWebClient().getPage(url); > > HtmlForm form = page.getFormByName("login"); > > > > > form.getInputByName("userid").setValueAttribute(cells.more.tex > t().toUpp > > erCase()); > > > > > form.getInputByName("password").setValueAttribute(cells.more.m ore.text( > > ).toUpperCase()); > > > > Page p = form.submit(); > > System.out.println(p); > > System.out.println(p.getWebResponse().getContentAsString()); > > state.setCurrentPage((HtmlPage)form.submit()); > > > > This gives me a ClassCastException because the response page is an > > UnexcpectedPage. > > > > output: > > > > com.gargoylesoftware.htmlunit.UnexpectedPage@302e67 > > > > <html > > > xmlns:translator="com.banctec.pca.pub.PublicLanguageTranslatorUtil" > > xmlns:java="java"> > > <head> > > <META http-equiv="Content-Type" content="text/html; > > charset=ISO-8859-1"> > > <link href="/pca/stylesheets/pcaadmin.css" type="text/css" > > rel="stylesheet"> > > <title>PCA Admin: Users List</title> > > </head> > > (...) > > > > ------------------------------------------------------- > 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://productguide.itmanagersjournal.com/ > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |