From: Rousseau, J. R. <JRR...@Ba...> - 2004-12-10 20:53:01
|
I tought that was the problem too, because the servlet that works do explicitely set the content-type in the response object. So I added that to the servlet filter, before the XSL transformation.. but no luck :( ..but then when I received your email, I went back on that track. I removed the filter to do my transformation directly in the servlet instead and it worked !!!! I then reintroduced my filter but instead of setting the content-type after the "chain.doFilter(request,response)", i did it before and it worked ! public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { response.setContentType("text/html"); CharResponseWrapper responseWrap = new CharResponseWrapper((HttpServletResponse)response); chain.doFilter( request,responseWrap); // XSL Transformation here (...) } I'm not sure if I understand why it needs to be set before I start playing with the repsonse object. I guess its related to the response wrapper that I use. Anyway thank you guys for your help ! Jean-Rene p.s. I was hit by your working address. I had the chance to visit the Garden of Gods a couple of years ago... VERY NICE :) > -----Original Message----- > From: Erskine, Chris [mailto:chr...@ed...] > Sent: Friday, December 10, 2004 3:04 PM > To: htm...@li... > Subject: RE: [Htmlunit-user] Re: Problems handling with the > Content-Type > i s specified using ME TA tags? > > > Jean-Rene, > > Are you actually setting the response type? I have found > that at times, you > have to set the expected response type which is done with > code, not the META > tag. > > Chris Erskine > > EDS Consulting Services > F5-EDS-001 > 2424 Garden of the Gods Rd > Colorado Springs, CO 80919 > > Phone: 719-535-6064 > > > > -----Original Message----- > > From: htm...@li... > [mailto:htmlunit-user- > > ad...@li...] On Behalf Of Rousseau, Jean Rene > > Sent: Friday, December 10, 2004 12:48 PM > > To: 'htm...@li...' > > Subject: RE: [Htmlunit-user] Re: Problems handling with the > Content-Type i > > s specified using ME TA tags? > > > > everything works perfectly fine with a regular browser. > Actually this > > application is in production in several of our customers. > It works fine > > also > > with JWebUnit(HttpUnit). > > > > One of the difference between the working pages and the > non-working pages > > is > > that the non-working pages go through a ServletFilter before being > > produced. > > In Both cases, a Servlet handles the request, produced XML > that is then > > transformed by an XSL stylesheet. > > > > I'll re-try with the proposed loggers > > > > thanks, > > > > Jean-Rene > > > > > -----Original Message----- > > > From: Marc Guillemot [mailto:mgu...@ya...] > > > Sent: Friday, December 10, 2004 2:42 PM > > > To: htm...@li... > > > Subject: Re: [Htmlunit-user] Re: Problems handling with the > > > Content-Type > > > is specified using ME TA tags? > > > > > > > > > Jean Rene, > > > > > > you can set log level to debug for > > > > > > logger.httpclient.wire > > > httpclient.wire.header > > > httpclient.wire.content > > > > > > and you will really get more information. > > > > > > Are some of the pages you have problem with available on > the internet? > > > > > > Marc. > > > > > > Rousseau, Jean Rene wrote: > > > > 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.PublicLanguageTranslat > > > orUtil" > > > >> > > > >>>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 > > > >> > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > 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 > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > 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 > > > > > > > > > ------------------------------------------------------- > > 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 > > > ------------------------------------------------------- > 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 > |