ResponseWriter responseWriter;
if (null != oldWriter) {
responseWriter = oldWriter.cloneWithWriter(response.getWriter());
} else {
response.reset();
responseWriter = newWriter.cloneWithWriter(response.getWriter());
}
// now render the UIViewRoot
newWriter.startDocument();