Package br.com.caelum.vraptor

Examples of br.com.caelum.vraptor.VRaptorException


    if (method == null) {
      return false;
    }

    if(!method.getReturnType().equals(Boolean.class) && !method.getReturnType().equals(boolean.class)) {
      throw new VRaptorException("@Accepts method must return boolean");
    }

    SignatureAcceptor acceptor = new NoStackParameterSignatureAcceptor();
    if (!acceptor.accepts(method)) {
      throw new VRaptorException(method.getDeclaringClass().getCanonicalName() + " - " + acceptor.errorMessage());
    }

    return true;
  }
View Full Code Here


  public void setEncoding(HttpServletRequest request, HttpServletResponse response) {
    try {
      request.setCharacterEncoding(getEncoding());
      response.setCharacterEncoding(getEncoding());
    } catch (UnsupportedEncodingException e) {
      throw new VRaptorException(e);
    }
  }
View Full Code Here

    Object current = root;
    for (int i = 1; i < paths.length; i++) {
      try {
        current = navigate(current, paths[i]);
      } catch (Exception e) {
        throw new VRaptorException("Unable to evaluate expression " + path, e);
      }
      if (current == null) {
        return "";
      }
    }
View Full Code Here

    if (current.getClass().isArray()) {
      return Array.get(current, position);
    } else if (Collection.class.isAssignableFrom(current.getClass())) {
      return Iterables.get((Collection<?>) current, position);
    }
    throw new VRaptorException("Unable to access position of a" + current.getClass().getName() + ".");
  }
View Full Code Here

  }

  public void handle(@Observes @ConvertQualifier BeanClass beanClass) {
    Class<?> originalType = beanClass.getType();
    if (!(Converter.class.isAssignableFrom(originalType))) {
      throw new VRaptorException("converter does not implement Converter");
    }
    @SuppressWarnings("unchecked")
    Class<? extends Converter<?>> converterType = (Class<? extends Converter<?>>) originalType;
    converters.register(converterType);
  }
View Full Code Here

  public void handle(@Observes @InterceptsQualifier BeanClass beanClass) {
    Class<?> originalType = beanClass.getType();
    if (Interceptor.class.isAssignableFrom(originalType) || originalType.isAnnotationPresent(Intercepts.class)) {
      registerInterceptor(originalType);
    } else {
      throw new VRaptorException("Annotation " + Intercepts.class + " found in " + originalType
          + ", but it is neither an Interceptor nor an InterceptorSequence.");
    }
  }
View Full Code Here

  }

  public void handle(@Observes @ConvertQualifier BeanClass beanClass) {
    Class<?> originalType = beanClass.getType();
    if (!(Converter.class.isAssignableFrom(originalType))) {
      throw new VRaptorException("converter does not implement Converter");
    }
    @SuppressWarnings("unchecked")
    Class<? extends Converter<?>> converterType = (Class<? extends Converter<?>>) originalType;
    converters.register(converterType);
  }
View Full Code Here

    CustomAcceptsExecutor customAcceptsExecutor = new CustomAcceptsExecutor(stepInvoker, container, find(CustomAcceptsFailCallback.class), interceptorClass);
    InterceptorAcceptsExecutor interceptorAcceptsExecutor = new InterceptorAcceptsExecutor(stepInvoker, parametersResolver, find(Accepts.class), interceptorClass);
    boolean customAccepts = customAcceptsExecutor.accept(interceptorClass);
    boolean internalAccepts = interceptorAcceptsExecutor.accept(interceptorClass);
    if(customAccepts && internalAccepts){
      throw new VRaptorException("Interceptor "+interceptorClass+" must declare internal accepts or custom, not both.");
    }
    this.acceptsExecutor = customAccepts?customAcceptsExecutor:interceptorAcceptsExecutor;
  }
View Full Code Here

  public void setEncoding(HttpServletRequest request, HttpServletResponse response) {
    try {
      request.setCharacterEncoding(getEncoding());
      response.setCharacterEncoding(getEncoding());
    } catch (UnsupportedEncodingException e) {
      throw new VRaptorException(e);
    }
  }
View Full Code Here

    Object current = root;
    for (int i = 1; i < paths.length; i++) {
      try {
        current = navigate(current, paths[i]);
      } catch (Exception e) {
        throw new VRaptorException("Unable to evaluate expression " + path, e);
      }
      if (current == null) {
        return "";
      }
    }
View Full Code Here

TOP

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

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.