Package br.com.caelum.vraptor

Examples of br.com.caelum.vraptor.InterceptionException


      messages.assertAbsenceOfErrors();
     
      this.methodInfo.setResult(result);
      methodExecutedEvent.fire(new MethodExecuted(method, methodInfo));
    } catch (IllegalArgumentException e) {
      throw new InterceptionException(e);
    } catch (ReflectionProviderException e) {
      throwIfNotValidationException(e, e.getCause());
    } catch (Exception e) {
      throwIfNotValidationException(e, e);
    }
View Full Code Here


  @Override
  public void validate(Class<?> originalType, List<Method> methods) {
    Method accepts = invoker.findMethod(methods, Accepts.class, originalType);

    if (accepts != null && !isBooleanReturn(accepts.getReturnType())) {
      throw new InterceptionException(format("@%s method must return boolean",
          Accepts.class.getSimpleName()));
    }
  }
View Full Code Here

      return new Mirror().on(interceptor).invoke().method(stepMethod).withArgs(params);
    } catch (Exception e) {
      // we dont wanna wrap it if it is a simple controller business logic
      // exception
      propagateIfInstanceOf(e.getCause(), ApplicationLogicException.class);
      throw new InterceptionException(e.getCause());
    }
  }
View Full Code Here

  public void couldntFind(FilterChain chain, MutableRequest request, MutableResponse response) {
    event.fire(new ControllerNotFound());
    try {
      chain.doFilter(request, response);
    } catch (IOException | ServletException e) {
      throw new InterceptionException(e);
    }
  }
View Full Code Here

   */
  @Test
  public void withRootException() {
    final Exception e = new IllegalStateException();
    when(mapper.findByException(e)).thenReturn(mockRecorder);
    doThrow(new InterceptionException(e)).when(stack).next(method, instance);

    interceptor.intercept(stack, method, instance);
    verify(mockRecorder).replay(result);
  }
View Full Code Here

   */
  @Test
  public void whenNotFoundException() {
    final Exception e = new IllegalArgumentException();
    when(mapper.findByException(e)).thenReturn(null);
    doThrow(new InterceptionException(e)).when(stack).next(method, instance);

    try {
      interceptor.intercept(stack, method, instance);
      fail("Should throw InterceptionException");
    } catch (InterceptionException e2) {
View Full Code Here

            validator.onErrorUse(nothing());
          } catch (ValidationException e) {
            log.debug("Some validation errors occured: {}", e.getErrors());
          }
        }
        throw new InterceptionException(
            "There are validation errors and you forgot to specify where to go. Please add in your method "
                + "something like:\n"
                + "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n"
                + "or any view that you like.\n"
                + "If you didn't add any validation error, it is possible that a conversion error had happened.");
      }
      this.methodInfo.setResult(result);
      methodExecutedEvent.fire(new MethodExecuted(method, methodInfo));
    } catch (IllegalArgumentException e) {
      throw new InterceptionException(e);
    } catch (Exception e) {
      throwIfNotValidationException(e, new InterceptionException(e));
    }
  }
View Full Code Here

            }
        } catch (IllegalStateException e) {
            reportSizeLimitExceeded(e);

        } catch (IOException e) {
            throw new InterceptionException(e);

        } catch (ServletException e) {
            throw new InterceptionException(e);
        }

        for (String paramName : params.keySet()) {
            Collection<String> paramValues = params.get(paramName);
            parameters.setParameter(paramName, paramValues.toArray(new String[paramValues.size()]));
View Full Code Here

        }
      }

      stack.next(method, resourceInstance);
    } catch (IOException e) {
      throw new InterceptionException(e);
    }

  }
View Full Code Here

      download.write(response);

      output.flush();
      output.close();
    } catch (IOException e) {
      throw new InterceptionException(e);
    }

  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.InterceptionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.