jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russell Gold <russg...@acm.org>
Subject Re: Httpunit Content-type Error
Date Tue, 30 Oct 2001 17:15:25 GMT
At 03:30 AM 10/30/2001 -0600, Chris Hane wrote:

>I've been trying to test a struts action/jsp using cactus/httpunit and 
>have run into the following error as displayed by junit:
>com.meterware.httpunit.NotHTMLException: The content type of the response 
>is 'text/plain': it must be 'text/html' in order to be recognized as HTML
>         at 
> com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:789)
>         at com.meterware.httpunit.WebResponse.getForms(WebResponse.java:261)
>         at com.hane.lms.pages.loginTest.endLogin(loginTest.java:63)
>         at 
> org.apache.cactus.AbstractTestCase.callEndMethod(AbstractTestCase.java:304)
>         at 
> org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:425)
>         at 
> org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
>         at 
> org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
>I'm trying to understand how cactus works so that I can integrate it into 
>my development cycle.  I have a single test that I'm trying to execute 
>that uses the struts.ActionServlet.  The only logic the struts.Action 
>contains is to return a forward to a jsp page.  I'm not changing the 
>content-type that should be returned.  By what I can tell, the 
>ActionServlet content-type default to return is 'text/html'.  I've also 
>tried adding a content-type to the jsp file; however, the <meta> tag 
>doesn't seem to have any change.
>Any thoughts on what I've got going on here would be appreciated?  I've 
>also included some of the specific example I'm using below:

Try this: call HttpUnitOptions.setLoggingHttpHeaders( true ) before running 
your test to see what headers are actually coming back from the redirector. 
You want to see if a content-type header of any type is coming back. <meta> 
tags are only processed if the response is declared to be text.

To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>

View raw message