use of ninja.metrics.Timed in project ninja by ninjaframework.
the class ApplicationController method flashAny.
@Timed
public Result flashAny(Context context, FlashScope flashScope) {
Result result = Results.html();
// sets a 18n flash message and adds a timestamp to make sure formatting works
Optional<String> flashMessage = messages.get("flashAny", context, Optional.of(result), "PLACEHOLDER");
if (flashMessage.isPresent()) {
flashScope.put("any", flashMessage.get());
}
return result;
}
use of ninja.metrics.Timed in project ninja by ninjaframework.
the class ApplicationController method directObjectTemplateRendering.
@Timed
public Result directObjectTemplateRendering() {
// Uses Results.html().render(Object) to directly
// render an object with a Freemarker template
FormObject testObject = new FormObject();
testObject.name = "test_name";
testObject.primInt = 13579;
testObject.setObjShort((short) -2954);
return Results.html().render(testObject);
}
use of ninja.metrics.Timed in project ninja by ninjaframework.
the class ApplicationController method flashError.
@Timed
public Result flashError(Context context, FlashScope flashScope) {
Result result = Results.html();
// sets a 18n flash message and adds a timestamp to make sure formatting works
Optional<String> flashMessage = messages.get("flashError", context, Optional.of(result), "PLACEHOLDER");
if (flashMessage.isPresent()) {
flashScope.error(flashMessage.get());
}
return result;
}
use of ninja.metrics.Timed in project ninja by ninjaframework.
the class ApplicationController method flashSuccess.
@Timed
public Result flashSuccess(FlashScope flashScope, Context context) {
Result result = Results.html();
// sets a 18n flash message and adds a timestamp to make sure formatting works
Optional<String> flashMessage = messages.get("flashSuccess", context, Optional.of(result), "PLACEHOLDER");
if (flashMessage.isPresent()) {
flashScope.success(flashMessage.get());
}
return result;
}
Aggregations