vmassol 2003/11/23 10:39:47
Modified: samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit
TestHttpResponse.java
Log:
Prevent containers that add a charset to the content type from failing the
testSetContentType test. This is valid (see RFC 2616, section 3.4.1). Note that Tomcat
5.0.14 is the first container I've seen that has this behavior.
Revision Changes Path
1.7 +8 -3
jakarta-cactus/samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit/TestHttpResponse.java
Index: TestHttpResponse.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit/TestHttpResponse.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestHttpResponse.java 9 Jun 2003 20:28:47 -0000 1.6
+++ TestHttpResponse.java 23 Nov 2003 18:39:47 -0000 1.7
@@ -244,7 +244,12 @@
*/
public void testSetContentType() throws Exception
{
- response.setContentType("text/xml");
+ // Note: We also specify the charset so that we are sure to known the
+ // full content type string that will be returned on the client side.
+ // Indeed, some containers will specify a charset even if we don't
+ // specify one in the call to setContentType. This is normal and in
+ // accordance with RFC2616, section 3.4.1.
+ response.setContentType("text/xml;charset=ISO-8859-1");
// Although we don't assert the written content, this is needed to make
// the test succeed on some versions of Orion. If the content is left
@@ -261,7 +266,7 @@
*/
public void endSetContentType(WebResponse theResponse)
{
- assertEquals("text/xml",
+ assertEquals("text/xml;charset=ISO-8859-1",
theResponse.getConnection().getContentType());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]