private byte[] renderTemplate(final String templateName) throws IOException {
SystemStatus systemStatus = applicationStatusSource.getSystemStatus();
Map<String, Object> params = Maps.newHashMap();
params.put("serviceBase", "service/local");
params.put("contentBase", "content");
params.put("nexusVersion", systemStatus.getVersion());
params.put("nexusRoot", BaseUrlHolder.get());
params.put("appName", systemStatus.getAppName());
params.put("formattedAppName", systemStatus.getFormattedAppName());
boolean debugMode = isDebugMode();
params.put("debug", debugMode);
List<UiContribution> contributions = Lists.newArrayList();
for (UiContributor contributor : uiContributors) {
UiContribution contribution = contributor.contribute(debugMode);
if (contribution.isEnabled()) {
contributions.add(contribution);
}
}
params.put("rJsContributions", contributions);
params.put("buildQualifier", buildNumberService.getBuildNumber());
URL template = getClass().getResource(templateName);
checkState(template != null, "Missing template: %s", templateName);
log.debug("Rendering template: {}", template);
String content = templateEngine.render(this, template, params);
return content.getBytes();
}