Context context = getContext();
final HttpServletRequest request = context.getRequest();
final Page page = ClickUtils.getParentPage(this);
final Map<String, Object> renderModel = new HashMap<String, Object>(page.getModel());
renderModel.putAll(getModel());
if (hasAttributes()) {
renderModel.put("attributes", getAttributes());
} else {
renderModel.put("attributes", Collections.EMPTY_MAP);
}
renderModel.put("this", this);
renderModel.put("context", request.getContextPath());
Format format = page.getFormat();
if (format != null) {
renderModel.put("format", format);
}
Map<String, String> templateMessages = new HashMap<String, String>(getMessages());
templateMessages.putAll(page.getMessages());
renderModel.put("messages", templateMessages);
renderModel.put("request", request);
renderModel.put("response", context.getResponse());