Package org.springframework.web.bind

Examples of org.springframework.web.bind.WebDataBinder


      if (paramName != null) {
        args[i] = resolveRequestParam(paramName, paramRequired, methodParam, webRequest, handler);
      }
      else if (attrName != null) {
        WebDataBinder binder = resolveModelAttribute(attrName, methodParam, implicitModel, webRequest, handler);
        if (args.length > i + 1 && Errors.class.isAssignableFrom(paramTypes[i + 1])) {
          doBind(webRequest, binder, false);
          args[i] = binder.getTarget();
          args[i + 1] = binder.getBindingResult();
          i++;
        }
        else {
          doBind(webRequest, binder, true);
          args[i] = binder.getTarget();
        }
        implicitModel.putAll(binder.getBindingResult().getModel());
      }
    }

    return args;
  }
View Full Code Here


        throw new IllegalStateException("Optional " + paramType + " parameter '" + paramName +
            "' is not present but cannot be translated into a null value due to being declared as a " +
            "primitive type. Consider declaring it as object wrapper for the corresponding primitive type.");
      }
    }
    WebDataBinder binder = createBinder(webRequest, null, paramName);
    initBinder(handlerForInitBinderCall, paramName, binder, webRequest);
    return binder.convertIfNecessary(paramValue, paramType, methodParam);
  }
View Full Code Here

    }
    Object bindObject = implicitModel.get(attrName);
    if (bindObject == null) {
      bindObject = BeanUtils.instantiateClass(paramType);
    }
    WebDataBinder binder = createBinder(webRequest, bindObject, attrName);
    initBinder(handler, attrName, binder, webRequest);
    return binder;
  }
View Full Code Here

      }
      if (!attrName.startsWith(BindingResult.MODEL_KEY_PREFIX) &&
          (isSessionAttr || isBindingCandidate(attrValue))) {
        String bindingResultKey = BindingResult.MODEL_KEY_PREFIX + attrName;
        if (mavModel != null && !model.containsKey(bindingResultKey)) {
          WebDataBinder binder = createBinder(webRequest, attrValue, attrName);
          initBinder(handler, attrName, binder, webRequest);
          mavModel.put(bindingResultKey, binder.getBindingResult());
        }
      }
    }
  }
View Full Code Here

          }
          if (!attrName.startsWith(BindingResult.MODEL_KEY_PREFIX) &&
              (isSessionAttr || isBindingCandidate(attrValue))) {
            String bindingResultKey = BindingResult.MODEL_KEY_PREFIX + attrName;
            if (mavModel != null && !model.containsKey(bindingResultKey)) {
              WebDataBinder binder = createBinder(webRequest, attrValue, attrName);
              initBinder(handler, attrName, binder, webRequest);
              mavModel.put(bindingResultKey, binder.getBindingResult());
            }
          }
        }
      }
      catch (InvocationTargetException ex) {
View Full Code Here

      }
      else if (pathVarName != null) {
        args[i] = resolvePathVariable(pathVarName, methodParam, webRequest, handler);
      }
      else if (attrName != null) {
        WebDataBinder binder =
            resolveModelAttribute(attrName, methodParam, implicitModel, webRequest, handler);
        boolean assignBindingResult = (args.length > i + 1 && Errors.class.isAssignableFrom(paramTypes[i + 1]));
        if (binder.getTarget() != null) {
          doBind(binder, webRequest, validate, !assignBindingResult);
        }
        args[i] = binder.getTarget();
        if (assignBindingResult) {
          args[i + 1] = binder.getBindingResult();
          i++;
        }
        implicitModel.putAll(binder.getBindingResult().getModel());
      }
    }

    return args;
  }
View Full Code Here

      else if (required) {
        raiseMissingParameterException(paramName, paramType);
      }
      paramValue = checkValue(paramName, paramValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, paramName);
    initBinder(handlerForInitBinderCall, paramName, binder, webRequest);
    return binder.convertIfNecessary(paramValue, paramType, methodParam);
  }
View Full Code Here

      else if (required) {
        raiseMissingHeaderException(headerName, paramType);
      }
      headerValue = checkValue(headerName, headerValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, headerName);
    initBinder(handlerForInitBinderCall, headerName, binder, webRequest);
    return binder.convertIfNecessary(headerValue, paramType, methodParam);
  }
View Full Code Here

      else if (required) {
        raiseMissingCookieException(cookieName, paramType);
      }
      cookieValue = checkValue(cookieName, cookieValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, cookieName);
    initBinder(handlerForInitBinderCall, cookieName, binder, webRequest);
    return binder.convertIfNecessary(cookieValue, paramType, methodParam);
  }
View Full Code Here

    Class<?> paramType = methodParam.getParameterType();
    if (pathVarName.length() == 0) {
      pathVarName = getRequiredParameterName(methodParam);
    }
    String pathVarValue = resolvePathVariable(pathVarName, paramType, webRequest);
    WebDataBinder binder = createBinder(webRequest, null, pathVarName);
    initBinder(handlerForInitBinderCall, pathVarName, binder, webRequest);
    return binder.convertIfNecessary(pathVarValue, paramType, methodParam);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.bind.WebDataBinder

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.