Revision: 1279
          http://stripes.svn.sourceforge.net/stripes/?rev=1279&view=rev
Author:   bengunter
Date:     2010-09-24 18:18:10 +0000 (Fri, 24 Sep 2010)

Log Message:
-----------
Fixed STS-770: MockHttpServletResponse.setContentType() does not set proper 
HTTP headers

Modified Paths:
--------------
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/mock/MockHttpServletResponse.java

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/mock/MockHttpServletResponse.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/mock/MockHttpServletResponse.java
        2010-09-24 18:12:19 UTC (rev 1278)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/mock/MockHttpServletResponse.java
        2010-09-24 18:18:10 UTC (rev 1279)
@@ -19,6 +19,7 @@
 import javax.servlet.ServletOutputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.Collections;
 import java.util.ListIterator;
 import java.util.Locale;
 import java.util.Map;
@@ -47,9 +48,13 @@
     private String errorMessage;
     private String characterEncoding = "UTF-8";
     private int contentLength;
-    private String contentType = "text/html";
+    private String contentType;
     private String redirectUrl;
 
+    public MockHttpServletResponse() {
+        setContentType("text/html");
+    }
+
     /** Adds a cookie to the set of cookies in the response. */
     public void addCookie(Cookie cookie) {
         // Remove existing cookies with the same name as the new one
@@ -179,7 +184,10 @@
     public String getCharacterEncoding() { return this.characterEncoding; }
 
     /** Sets the content type for the response. */
-    public void setContentType(String contentType) { this.contentType = 
contentType; }
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+        getHeaderMap().put("Content-type", Collections.<Object> 
singletonList(contentType));
+    }
 
     /** Gets the content type for the response. Defaults to text/html. */
     public String getContentType() { return this.contentType; }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to