use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class JwtCreationRestServiceImpl method getIndex.
@Override
public String getIndex(String message) {
final TemplateCall template = templater.template(PREFIX + "jwt_index.html");
template.set("message", message);
return template.process();
}
use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class GuiceRestLoggingServiceImpl method getIndex.
@Override
public String getIndex() {
TemplateCall call = templater.template(PREFIX + "logging.html");
call.set("log4jProperties", getLog4jPropertiesAsString());
return call.process();
}
use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class RestServiceListImpl method getServiceDescription.
@Override
public String getServiceDescription(final int serviceId, final HttpHeaders headers, final UriInfo uriInfo) throws Exception {
final TemplateCall template = templater.template(PREFIX + "service_describe.html");
template.set("services", services);
template.set("containerUrl", containerEndpoint.toString());
template.set("restUrl", restEndpoint.toString());
template.set("schemaGenerator", schemaGenerator);
template.set("service", services.get(serviceId));
return template.process();
}
use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class ServiceManagerResourceUIServiceImpl method getResource.
/**
* N.B. transaction may be read-write because this read operation may result in reading a new template (or discovering an
* update was made to the template)
*
* @param id
*
* @return
*/
@Override
@Transactional
public String getResource(String id) {
final TemplateCall call = templater.template("resource_template");
final ResourceTemplateEntity entity = resourceProvisionService.getOrCreateTemplate(id);
if (entity == null)
throw new RestException(404, "No such resource with id: " + id);
call.set("entity", entity);
call.set("nonce", nonceStore.getValue());
return call.process();
}
use of com.peterphi.std.guice.web.rest.templating.TemplateCall in project stdlib by petergeneric.
the class RulesUIServiceImpl method getIndex.
@Override
public String getIndex() {
final TemplateCall call = templater.template("rules");
call.set("daemon", rulesDaemon);
boolean inputsValid;
Rules rules = null;
try {
rules = rulesProvider.get();
Map<String, Object> varMap = rulesEngine.prepare(rules);
call.set("varMap", varMap);
inputsValid = true;
} catch (Exception e) {
inputsValid = false;
call.set("inputsError", e.getMessage());
}
boolean expressionsValid;
try {
if (rules != null) {
Map<String, String> validationResults = rulesEngine.validateSyntax(rules);
if (validationResults.size() > 0) {
expressionsValid = false;
call.set("expressionsErrorMap", validationResults);
call.set("expressionsError", "Parse erorrs");
} else {
expressionsValid = true;
}
} else {
call.set("expressionsError", "Rules not loaded!");
expressionsValid = false;
}
} catch (Exception e) {
expressionsValid = false;
call.set("expressionsError", e.getMessage());
}
call.set("inputsValid", inputsValid);
call.set("expressionsValid", expressionsValid);
return call.process();
}
Aggregations