Package org.springframework.web.bind

Examples of org.springframework.web.bind.WebDataBinder.convertIfNecessary()


    Map<String, Object> bindingResultModel = binder.getBindingResult().getModel();
    mavContainer.removeAttributes(bindingResultModel);
    mavContainer.addAllAttributes(bindingResultModel);

    return binder.convertIfNecessary(binder.getTarget(), parameter.getParameterType(), parameter);
  }

  /**
   * Extension point to create the model attribute if not found in the model.
   * The default implementation uses the default constructor.
View Full Code Here


      arg = resolveDefaultValue(namedValueInfo.defaultValue);
    }

    if (binderFactory != null) {
      WebDataBinder binder = binderFactory.createBinder(webRequest, null, namedValueInfo.name);
      arg = binder.convertIfNecessary(arg, paramType, parameter);
    }

    handleResolvedValue(arg, namedValueInfo.name, parameter, mavContainer, webRequest);

    return arg;
View Full Code Here

      }
      paramValue = checkValue(paramName, paramValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, paramName);
    initBinder(handlerForInitBinderCall, paramName, binder, webRequest);
    return binder.convertIfNecessary(paramValue, paramType, methodParam);
  }

  private Map<String, ?> resolveRequestParamMap(Class<? extends Map<?, ?>> mapType, NativeWebRequest webRequest) {
    Map<String, String[]> parameterMap = webRequest.getParameterMap();
    if (MultiValueMap.class.isAssignableFrom(mapType)) {
View Full Code Here

      }
      headerValue = checkValue(headerName, headerValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, headerName);
    initBinder(handlerForInitBinderCall, headerName, binder, webRequest);
    return binder.convertIfNecessary(headerValue, paramType, methodParam);
  }

  private Map<String, ?> resolveRequestHeaderMap(Class<? extends Map<?, ?>> mapType, NativeWebRequest webRequest) {
    if (MultiValueMap.class.isAssignableFrom(mapType)) {
      MultiValueMap<String, String> result;
View Full Code Here

      }
      cookieValue = checkValue(cookieName, cookieValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, cookieName);
    initBinder(handlerForInitBinderCall, cookieName, binder, webRequest);
    return binder.convertIfNecessary(cookieValue, paramType, methodParam);
  }

  /**
   * Resolves the given {@link CookieValue @CookieValue} annotation.
   * <p>Throws an UnsupportedOperationException by default.
View Full Code Here

      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);
  }

  /**
   * Resolves the given {@link PathVariable @PathVariable} annotation.
   * <p>Throws an UnsupportedOperationException by default.
View Full Code Here

      }
      paramValue = checkValue(paramName, paramValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, paramName);
    initBinder(handlerForInitBinderCall, paramName, binder, webRequest);
    return binder.convertIfNecessary(paramValue, paramType, methodParam);
  }

  private Map resolveRequestParamMap(Class<? extends Map> mapType, NativeWebRequest webRequest) {
    Map<String, String[]> parameterMap = webRequest.getParameterMap();
    if (MultiValueMap.class.isAssignableFrom(mapType)) {
View Full Code Here

      }
      headerValue = checkValue(headerName, headerValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, headerName);
    initBinder(handlerForInitBinderCall, headerName, binder, webRequest);
    return binder.convertIfNecessary(headerValue, paramType, methodParam);
  }

  private Map resolveRequestHeaderMap(Class<? extends Map> mapType, NativeWebRequest webRequest) {
    if (MultiValueMap.class.isAssignableFrom(mapType)) {
      MultiValueMap<String, String> result;
View Full Code Here

      }
      cookieValue = checkValue(cookieName, cookieValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, cookieName);
    initBinder(handlerForInitBinderCall, cookieName, binder, webRequest);
    return binder.convertIfNecessary(cookieValue, paramType, methodParam);
  }

  /**
   * Resolves the given {@link CookieValue @CookieValue} annotation.
   * <p>Throws an UnsupportedOperationException by default.
View Full Code Here

      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);
  }

  /**
   * Resolves the given {@link PathVariable @PathVariable} annotation.
   * <p>Throws an UnsupportedOperationException by default.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.