Package br.com.caelum.vraptor.http

Examples of br.com.caelum.vraptor.http.InvalidParameterException


      request.setParameter(name, name);
      request.setAttribute(name, upload);

      logger.debug("Uploaded file: {} with {}", name, upload);
    } catch (IOException e) {
      throw new InvalidParameterException("Cant parse uploaded file " + item.getName(), e);
    }
  }
View Full Code Here


      request.setParameter(name, name);
      request.setAttribute(name, upload);

      logger.debug("Uploaded file: {} with {}", name, upload);
    } catch (IOException e) {
      throw new InvalidParameterException("Cant parse uploaded file " + item.getName(), e);
    }
  }
View Full Code Here

                    parameters.setParameter(item.getFieldName(), item.getName());
                    request.setAttribute(item.getName(), fileInformation);

                    logger.debug("Uploaded file: {} with {}", item.getFieldName(), fileInformation);
                } catch (Exception e) {
                    throw new InvalidParameterException("Cant parse uploaded file " + item.getName(), e);
                }
            } else {
                logger.debug("A file field was empty: {}",  item.getFieldName());
            }
        }
View Full Code Here

            parameters.setParameter(name, name);
            request.setAttribute(name, upload);

            logger.debug("Uploaded file: {} with {}", name, upload);
        } catch (IOException e) {
            throw new InvalidParameterException("Cant parse uploaded file " + item.getName(), e);
        }
    }
View Full Code Here

      request.setParameter(name, name);
      request.setAttribute(name, upload);

      logger.debug("Uploaded file: {} with {}", name, upload);
    } catch (IOException e) {
      throw new InvalidParameterException("Cant parse uploaded file " + item.getName(), e);
    }
  }
View Full Code Here

    }

    try {
      return ognl.nullHandler().instantiate(param.actualType());
    } catch (Exception ex) {
      throw new InvalidParameterException("unable to instantiate type " + param.type, ex);
    }
  }
View Full Code Here

      }
      catch (Exception e) {
        if (e.getClass().isAnnotationPresent(ValidationException.class)) {
          validator.add(new ValidationMessage(e.getLocalizedMessage(), target.getName()));
        } else {
          throw new InvalidParameterException("Exception when trying to instantiate " + target, e);
        }
      }
      return null;
    }
View Full Code Here

      }
      catch (Exception e) {
        if (e.getClass().isAnnotationPresent(ValidationException.class)) {
          validator.add(new ValidationMessage(e.getLocalizedMessage(), target.getName()));
        } else {
          throw new InvalidParameterException("Exception when trying to instantiate " + target, e);
        }
      }
      return null;
    }
View Full Code Here

    String[] names = provider.parameterNamesFor(method.getMethod());
    for (int i = 0; i < types.length; i++) {
      try {
        result[i] = root.getClass().getMethod("get" + Info.capitalize(names[i])).invoke(root);
      } catch (InvocationTargetException e) {
        throw new InvalidParameterException("unable to retrieve values to invoke method", e.getCause());
      } catch (Exception e) {
        throw new InvalidParameterException("unable to retrieve values to invoke method", e);
      }
    }
    return result;
  }
View Full Code Here

    Class<?> type = creator.typeFor(method);
    Object root;
    try {
      root = type.getDeclaredConstructor().newInstance();
    } catch (Exception ex) {
      throw new InvalidParameterException("unable to instantiate type" + type.getName(), ex);
    }
    OgnlContext context = (OgnlContext) Ognl.createDefaultContext(root);
    context.setTraceEvaluations(true);
    context.put(Container.class, this.container);

    VRaptorConvertersAdapter adapter = new VRaptorConvertersAdapter(converters, bundle);
    Ognl.setTypeConverter(context, adapter);
    for (Enumeration<?> enumeration = request.getParameterNames(); enumeration.hasMoreElements();) {
      String key = (String) enumeration.nextElement();
      String[] values = request.getParameterValues(key);
      try {
        if (logger.isDebugEnabled()) {
          logger.debug("Applying " + key + " with " + Arrays.toString(values));
        }
        Ognl.setValue(key, context, root, values.length == 1 ? values[0] : values);
      } catch (ConversionError ex) {
        errors.add(new ValidationMessage(ex.getMessage(), key));
      } catch (MethodFailedException e) { // setter threw an exception

        Throwable cause = e.getCause();
        if (cause.getClass().isAnnotationPresent(ValidationException.class)) {
          errors.add(new ValidationMessage(cause.getLocalizedMessage(), key));
        } else {
          throw new InvalidParameterException("unable to parse expression '" + key + "'", e);
        }

      } catch (NoSuchPropertyException ex) {
        // TODO optimization: be able to ignore or not
        if (logger.isDebugEnabled()) {
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.http.InvalidParameterException

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.