use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class CustomTemplateFailureRenderer method render.
private Response render(final RestFailure failure, String template) {
final TemplateCall call = templater.template(template);
call.set("failure", failure);
call.set("ctx", HttpCallContext.peek());
return call.process(Response.status(failure.httpCode).type(MediaType.TEXT_HTML_TYPE));
}
use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class HealthRestServiceImpl method getHTML.
@Override
public String getHTML() {
TemplateCall call = templater.template(PREFIX + "health-index.html");
call.set("health", get());
return call.process();
}
use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class MetricsRestServiceImpl method getIndex.
@Override
public String getIndex() {
TemplateCall call = templater.template(PREFIX + "index.html");
call.set("gauges", registry.getGauges().entrySet());
call.set("counters", this.<Counting>combine(registry.getCounters(), registry.getMeters(), registry.getTimers(), registry.getHistograms()).entrySet());
call.set("meters", this.<Metered>combine(registry.getMeters(), registry.getTimers()).entrySet());
call.set("histograms", this.<Sampling>combine(registry.getHistograms(), registry.getTimers()).entrySet());
return call.process();
}
use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class ServiceManagerResourceUIServiceImpl method getResources.
@Override
@Transactional(readOnly = true)
public String getResources() {
final TemplateCall call = templater.template("resource_templates");
call.set("entities", templateDao.getAll());
return call.process();
}
use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class ServiceManagerUIServiceImpl method getSearchLogs.
@Override
public String getSearchLogs(String from, String to, final int minLevel) {
if (!logStore.isSearchSupported())
throw new IllegalArgumentException("The underlying log store does not support web-based searching!");
final TemplateCall call = templater.template("search");
call.set("nonce", nonceStore.getValue());
call.set("fromDatetime", from);
call.set("toDatetime", to);
call.set("minLevel", minLevel);
return call.process();
}
Aggregations