// Determine encoding
final String encoding = app.getRequestCycleSettings().getResponseRequestEncoding();
// Set content type based on markup type for page
final WebResponse response = (WebResponse)requestCycle.getResponse();
response.setCharacterEncoding(encoding);
response.setContentType("text/xml; charset=" + encoding);
// Make sure it is not cached by a client
response.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
response.setHeader("Cache-Control", "no-cache, must-revalidate");
response.setHeader("Pragma", "no-cache");
response.write("<?xml version=\"1.0\" encoding=\"");
response.write(encoding);
response.write("\"?>");
response.write("<ajax-response>");
// invoke onbeforerespond event on listeners
fireOnBeforeRespondListeners();
// normal behavior
Iterator it = prependJavascripts.iterator();
while (it.hasNext())
{
String js = (String)it.next();
respondInvocation(response, js);
}
// process added components
respondComponents(response);
fireOnAfterRespondListeners(response);
// execute the dom ready javascripts as first javascripts
// after component replacement
it = domReadyJavascripts.iterator();
while (it.hasNext())
{
String js = (String)it.next();
respondInvocation(response, js);
}
it = appendJavascripts.iterator();
while (it.hasNext())
{
String js = (String)it.next();
respondInvocation(response, js);
}
response.write("</ajax-response>");
}