Package br.com.caelum.vraptor

Examples of br.com.caelum.vraptor.VRaptorException


    private static Class<? extends Interceptor>[] parseSequence(Class<? extends InterceptorSequence> type) {
        try {
            InterceptorSequence sequence = type.getConstructor().newInstance();
            return sequence.getSequence();
        } catch (Exception e) {
            throw new VRaptorException("Problem ocurred while instantiating an interceptor sequence", e);
        }
    }
View Full Code Here


    if (matches.hasNext()) {
      try {
        ResourceMethod resourceMethod = DefaultResourceMethod.instanceFor(type, method);
        return matches.next().urlFor(type, method, creator.instanceWithParameters(resourceMethod, params));
      } catch (Exception e) {
        throw new VRaptorException("The selected route is invalid for redirection: " + type.getName() + "."
            + method.getName(), e);
      }
    }
    throw new RouteNotFoundException("The selected route is invalid for redirection: " + type.getName() + "."
        + method.getName());
View Full Code Here

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

        Method setter = findSetter(parameterType, "set" + Info.capitalize(names[i]));
        setter.invoke(root, parameters[i]);
      }
      return root;
    } catch (Exception e) {
      throw new VRaptorException(e);
    }
  }
View Full Code Here

    for (Method m : parameterType.getDeclaredMethods()) {
      if (m.getName().equals(methodName)) {
        return m;
      }
    }
    throw new VRaptorException(
        "Unable to instanciate parameters as setter method for parameter setting was not created. "
            + "Thats probably a bug on your type creator. "
            + "If you are using the default type creator, notify VRaptor.");
  }
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

      register(type);
    }
  }
  public Deserializer deserializerFor(String contentType, Container container) {
    if (!deserializers.containsKey(contentType)) {
      throw new VRaptorException("There is no deserializer for the content type " + contentType);
    }
    return container.instanceFor(deserializers.get(contentType));
  }
View Full Code Here

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

    List<Migration> migrations = new ArrayList<Migration>();
    for (Class<? extends Migration> type : migrationTypes) {
      try {
        migrations.add(type.getConstructor().newInstance());
      } catch (Exception e) {
        throw new VRaptorException("Cannot instantiate migration: ", e);
      }
    }
    return migrations;
  }
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

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.