Author: jdonnerstag
Date: Sat Oct 3 13:11:58 2009
New Revision: 821309
URL: http://svn.apache.org/viewvc?rev=821309&view=rev
Log:
fixed: always insert encoding in http response header
Issue: WICKET-2348
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java?rev=821309&r1=821308&r2=821309&view=diff
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
Sat Oct 3 13:11:58 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 @@
}
/**
+ * Additional header configs 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