From 8a4038ac134223605f60b0eddc6bb1b1ed8a50eb Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 3 Dec 2010 14:51:45 +0000 Subject: [PATCH] SWF-1432 Make sure content type is set when sending a redirect instruction during JSF Ajax request --- .../faces/webflow/JsfAjaxHandler.java | 1 + .../faces/webflow/JsfAjaxHandlerTests.java | 1 + .../WEB-INF/flows/main/enterSearchCriteria.xhtml | 2 +- .../src/main/webapp/WEB-INF/web.xml | 13 ------------- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfAjaxHandler.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfAjaxHandler.java index 58f37c26..b9934c07 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfAjaxHandler.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfAjaxHandler.java @@ -78,6 +78,7 @@ public class JsfAjaxHandler extends AbstractAjaxHandler { private PartialResponseWriter createPartialResponseWriter(FacesContext context) throws IOException { ExternalContext externalContext = context.getExternalContext(); String encoding = externalContext.getRequestCharacterEncoding(); + externalContext.setResponseContentType("application/xml"); externalContext.setResponseCharacterEncoding(encoding); ResponseWriter responseWriter = null; Writer out = externalContext.getResponseOutputWriter(); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfAjaxHandlerTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfAjaxHandlerTests.java index 544fb019..e2ea1d5d 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfAjaxHandlerTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfAjaxHandlerTests.java @@ -26,6 +26,7 @@ public class JsfAjaxHandlerTests extends TestCase { assertEquals( "\n", jsfMock.contentAsString()); + assertEquals("application/xml", jsfMock.response().getContentType()); } } diff --git a/spring-webflow-samples/booking-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml b/spring-webflow-samples/booking-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml index 4faffdce..346c3914 100644 --- a/spring-webflow-samples/booking-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml +++ b/spring-webflow-samples/booking-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml @@ -27,7 +27,7 @@ - + diff --git a/spring-webflow-samples/booking-portlet-mvc/src/main/webapp/WEB-INF/web.xml b/spring-webflow-samples/booking-portlet-mvc/src/main/webapp/WEB-INF/web.xml index cfc6aa1d..2c908546 100644 --- a/spring-webflow-samples/booking-portlet-mvc/src/main/webapp/WEB-INF/web.xml +++ b/spring-webflow-samples/booking-portlet-mvc/src/main/webapp/WEB-INF/web.xml @@ -24,19 +24,6 @@ org.springframework.web.context.ContextLoaderListener - - - Resources Servlet - org.springframework.js.resource.ResourceServlet - 0 - - - - - Resources Servlet - /resources/* - - ViewRendererServlet