コード例 #1
0
 public void redirect() throws IllegalStateException {
   String referer = getReferer();
   try {
     ResourceMethod method = router.parse(referer, HttpMethod.GET, request);
     executeMethod(method, result.use(logic()).redirectTo(method.getResource().getType()));
   } catch (ResourceNotFoundException e) {
     result.use(page()).redirect(referer);
   } catch (MethodNotAllowedException e) {
     result.use(page()).redirect(referer);
   }
 }
コード例 #2
0
  public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) {
    if (usuarioSession.getUsuario() != null) {
      Permission methodPermission = method.getMethod().getAnnotation(Permission.class);
      Permission controllerPermission =
          method.getResource().getType().getAnnotation(Permission.class);
      if (this.hasAccess(methodPermission) && this.hasAccess(controllerPermission)) {
        stack.next(method, resourceInstance);
      } else {
        result.redirectTo(LoginController.class).acessoNegado();
      }

    } else {
      result.redirectTo(LoginController.class).login();
    }
  }
コード例 #3
0
 @Override
 public boolean accepts(ResourceMethod method) {
   return !method.getResource().getType().isAnnotationPresent(Open.class)
       && !method.containsAnnotation(Open.class);
 }
コード例 #4
0
 public boolean accepts(ResourceMethod method) {
   return !(method.getMethod().isAnnotationPresent(Public.class)
       || method.getResource().getType().isAnnotationPresent(Public.class));
   // return false;
 }