Esempio n. 1
0
 @Override
 public void onError(WebContext ctx, HandledException error) {
   if (error != null) {
     UserContext.message(Message.error(error.getMessage()));
   }
   defaultRoute.accept(ctx);
 }
Esempio n. 2
0
 @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;
 }
Esempio n. 3
0
 /**
  * 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);
 }
Esempio n. 4
0
 public void showSavedMessage() {
   UserContext.message(Message.info(NLS.get("BizController.changesSaved")));
 }
Esempio n. 5
0
 protected UserInfo getUser() {
   return UserContext.getCurrentUser();
 }
Esempio n. 6
0
 public void showDeletedMessage() {
   UserContext.message(Message.info(NLS.get("BizController.objectDeleted")));
 }