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