Author: jdonnerstag
Date: Sat Oct  3 13:13:30 2009
New Revision: 821310

URL: http://svn.apache.org/viewvc?rev=821310&view=rev
Log:
fixed: always insert encoding in http response header
Issue: WICKET-2348

Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java?rev=821310&r1=821309&r2=821310&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
 Sat Oct  3 13:13:30 2009
@@ -23,6 +23,7 @@
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.wicket.Application;
 import org.apache.wicket.Response;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.util.string.AppendingStringBuffer;
@@ -231,6 +232,8 @@
                                                // safari chokes on empty 
response. but perhaps this is
                                                // not the best place?
                                                
httpServletResponse.getWriter().write("-");
+
+                                               configureAjaxRedirect();
                                        }
                                        else
                                        {
@@ -251,6 +254,21 @@
        }
 
        /**
+        * Configure the header for ajax redirects
+        */
+       protected void configureAjaxRedirect()
+       {
+               // Set the encoding (see Wicket-2348)
+               final String encoding = Application.get()
+                       .getRequestCycleSettings()
+                       .getResponseRequestEncoding();
+
+               // Set content type based on markup type for page
+               setCharacterEncoding(encoding);
+               setContentType("text/xml; charset=" + encoding);
+       }
+
+       /**
         * Set the content type on the response.
         * 
         * @param mimeType


Reply via email to