@Override public void onError(WebContext ctx, HandledException error) { if (error != null) { UserContext.message(Message.error(error.getMessage())); } defaultRoute.accept(ctx); }
@Override public boolean beforePermissionError( String permission, WebContext ctx, Controller controller, Method method) throws Exception { if (UserContext.getCurrentScope() != ScopeInfo.DEFAULT_SCOPE) { return false; } if (UserInfo.PERMISSION_LOGGED_IN.equals(permission)) { if (ctx.getSessionValue("otp-user").isFilled()) { // TODO ctx.respondWith().template("view/wondergem/otp.html", ctx.getRequest().getUri()); } else { ctx.respondWith().template("view/wondergem/login.html", ctx.getRequest().getUri()); } } else { // TODO ctx.respondWith() .template("view/wondergem/permission-error.html", ctx.getRequest().getUri(), permission); } return true; }
/** * Tries to resolve a template or content-file into a {@link Resource} * * @param uri the local name of the uri to load * @return a {@link Resource} (wrapped as resource) pointing to the requested content or an empty * optional if no resource was found */ @Nonnull public Optional<Resource> resolve(@Nonnull String uri) { return resolve(UserContext.getCurrentScope().getScopeId(), uri); }
public void showSavedMessage() { UserContext.message(Message.info(NLS.get("BizController.changesSaved"))); }
protected UserInfo getUser() { return UserContext.getCurrentUser(); }
public void showDeletedMessage() { UserContext.message(Message.info(NLS.get("BizController.objectDeleted"))); }