SWF-1432 Make sure content type is set when sending a redirect instruction during JSF Ajax request
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -26,6 +26,7 @@ public class JsfAjaxHandlerTests extends TestCase {
|
||||
assertEquals(
|
||||
"<?xml version='1.0' encoding='utf-8'?>\n<partial-response><redirect url=\"/target\"/></partial-response>",
|
||||
jsfMock.contentAsString());
|
||||
assertEquals("application/xml", jsfMock.response().getContentType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<h:selectOneMenu id="pageSize" value="#{searchCriteria.pageSize}">
|
||||
<f:selectItems value="#{referenceData.pageSizeOptions}" />
|
||||
</h:selectOneMenu>
|
||||
<p:commandButton id="findHotels" value="Find Hotels" action="search" update="@form" ajax="false" />
|
||||
<p:commandButton id="findHotels" value="Find Hotels" action="search" update="@form" />
|
||||
</h:panelGrid>
|
||||
<p:tooltip for="searchString" targetPosition="topRight" position="bottomLeft"
|
||||
value="Search hotels by name, address, city, or zip." style="cream" />
|
||||
|
||||
@@ -24,19 +24,6 @@
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Serves static resource content from .jar files such as spring-js.jar -->
|
||||
<servlet>
|
||||
<servlet-name>Resources Servlet</servlet-name>
|
||||
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
|
||||
<load-on-startup>0</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!-- Map all /resources requests to the Resource Servlet for handling -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Resources Servlet</servlet-name>
|
||||
<url-pattern>/resources/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Supports view rendering -->
|
||||
<servlet>
|
||||
<servlet-name>ViewRendererServlet</servlet-name>
|
||||
|
||||
Reference in New Issue
Block a user