TurbineRunDataInternal rundata = (TurbineRunDataInternal) getTurbineRunData(request);
String target = assertNotNull(rundata.getTarget(), "Target was not specified");
// 检查重定向标志,如果是重定向,则不需要将页面输出。
if (!rundata.isRedirected()) {
Context context = rundata.getContext();
renderTemplate(getScreenTemplate(target), context, rundata);
// layout可被禁用。
if (rundata.isLayoutEnabled() && bufferedRequestContext.isBuffering()) {
String layoutTemplateOverride = rundata.getLayoutTemplateOverride();
if (layoutTemplateOverride != null) {
target = layoutTemplateOverride;
}
String layoutTemplate = getLayoutTemplate(target);
if (templateService.exists(layoutTemplate)) {
String screenContent = defaultIfNull(bufferedRequestContext.popCharBuffer(), EMPTY_STRING);
context.put(SCREEN_PLACEHOLDER_KEY, screenContent);
renderTemplate(layoutTemplate, context, rundata);
}
}
}