Search in sources :

Example 16 with TemplateCall

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));
}
Also used : TemplateCall(com.peterphi.std.guice.web.rest.templating.TemplateCall)

Example 17 with TemplateCall

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();
}
Also used : TemplateCall(com.peterphi.std.guice.web.rest.templating.TemplateCall)

Example 18 with TemplateCall

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();
}
Also used : Metered(com.codahale.metrics.Metered) Sampling(com.codahale.metrics.Sampling) Counting(com.codahale.metrics.Counting) TemplateCall(com.peterphi.std.guice.web.rest.templating.TemplateCall)

Example 19 with TemplateCall

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();
}
Also used : TemplateCall(com.peterphi.std.guice.web.rest.templating.TemplateCall) Transactional(com.peterphi.std.guice.database.annotation.Transactional)

Example 20 with TemplateCall

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();
}
Also used : TemplateCall(com.peterphi.std.guice.web.rest.templating.TemplateCall)

Aggregations

TemplateCall (com.peterphi.std.guice.web.rest.templating.TemplateCall)28 Transactional (com.peterphi.std.guice.database.annotation.Transactional)9 AuthConstraint (com.peterphi.std.guice.common.auth.annotations.AuthConstraint)6 WebQuery (com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery)4 OAuthServiceEntity (com.peterphi.usermanager.db.entity.OAuthServiceEntity)3 RoleEntity (com.peterphi.usermanager.db.entity.RoleEntity)2 UserEntity (com.peterphi.usermanager.db.entity.UserEntity)2 AuthenticationFailureException (com.peterphi.usermanager.guice.authentication.AuthenticationFailureException)2 Function (java.util.function.Function)2 Response (javax.ws.rs.core.Response)2 Counting (com.codahale.metrics.Counting)1 Metered (com.codahale.metrics.Metered)1 Sampling (com.codahale.metrics.Sampling)1 Inject (com.google.inject.Inject)1 Named (com.google.inject.name.Named)1 Rules (com.peterphi.rules.types.Rules)1 ResourceTemplateEntity (com.peterphi.servicemanager.service.db.entity.ResourceTemplateEntity)1 LogSubscriber (com.peterphi.servicemanager.service.logging.hub.LogSubscriber)1 Doc (com.peterphi.std.annotation.Doc)1 GuiceProperties (com.peterphi.std.guice.apploader.GuiceProperties)1