Package org.springframework.web.bind.support

Examples of org.springframework.web.bind.support.WebRequestDataBinder


  }

  protected WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName)
      throws Exception {

    return new WebRequestDataBinder(target, objectName);
  }
View Full Code Here


  }

  protected void doBind(NativeWebRequest webRequest, WebDataBinder binder, boolean failOnErrors)
      throws Exception {

    WebRequestDataBinder requestBinder = (WebRequestDataBinder) binder;
    requestBinder.bind(webRequest);
    if (failOnErrors) {
      requestBinder.closeNoCatch();
    }
  }
View Full Code Here

        return Status.SUCCESS_CREATED;
    }
   
    protected Credentials obtainCredentials() {
        final UsernamePasswordCredentials c = new UsernamePasswordCredentials();
        final WebRequestDataBinder binder = new WebRequestDataBinder(c);
        final RestletWebRequest webRequest = new RestletWebRequest(getRequest());
       
        if (log.isDebugEnabled()) {
            log.debug(getRequest().getEntityAsForm().toString());
            log.debug("Username from RestletWebRequest: " + webRequest.getParameter("username"));
        }
       
        binder.bind(webRequest);
       
        return c;
    }
View Full Code Here

  }

  protected WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName)
      throws Exception {

    return new WebRequestDataBinder(target, objectName);
  }
View Full Code Here

     *
     * @return the credential
     */
    protected Credential obtainCredentials() {
        final UsernamePasswordCredential c = new UsernamePasswordCredential();
        final WebRequestDataBinder binder = new WebRequestDataBinder(c);
        final RestletWebRequest webRequest = new RestletWebRequest(getRequest());

        logFormRequest(new Form(getRequest().getEntity()));
        binder.bind(webRequest);

        return c;
    }
View Full Code Here

  }

  protected WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName)
      throws Exception {

    return new WebRequestDataBinder(target, objectName);
  }
View Full Code Here

  // SPR-10578

  @Test
  public void missingRequestParamEmptyValueConvertedToNull() throws Exception {

    WebDataBinder binder = new WebRequestDataBinder(null);
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));

    WebDataBinderFactory binderFactory = mock(WebDataBinderFactory.class);
    given(binderFactory.createBinder(webRequest, null, "stringNotAnnot")).willReturn(binder);

    this.request.addParameter("stringNotAnnot", "");
View Full Code Here

  }

  @Test
  public void missingRequestParamEmptyValueNotRequired() throws Exception {

    WebDataBinder binder = new WebRequestDataBinder(null);
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));

    WebDataBinderFactory binderFactory = mock(WebDataBinderFactory.class);
    given(binderFactory.createBinder(webRequest, null, "name")).willReturn(binder);

    this.request.addParameter("name", "");
View Full Code Here

  private void getAttributeFromModel(String expectedAttributeName, MethodParameter param) throws Exception {
    Object target = new TestBean();
    mavContainer.addAttribute(expectedAttributeName, target);

    WebDataBinder dataBinder = new WebRequestDataBinder(target);
    WebDataBinderFactory factory = mock(WebDataBinderFactory.class);
    given(factory.createBinder(webRequest, target, expectedAttributeName)).willReturn(dataBinder);

    processor.resolveArgument(param, mavContainer, webRequest, factory);
    verify(factory).createBinder(webRequest, target, expectedAttributeName);
View Full Code Here

    verify(factory).createBinder(webRequest, target, expectedAttributeName);
  }

  @Test
  public void resovleArgumentViaDefaultConstructor() throws Exception {
    WebDataBinder dataBinder = new WebRequestDataBinder(null);

    WebDataBinderFactory factory = mock(WebDataBinderFactory.class);
    given(factory.createBinder((NativeWebRequest) anyObject(), notNull(), eq("attrName"))).willReturn(dataBinder);

    processor.resolveArgument(paramNamedValidModelAttr, mavContainer, webRequest, factory);
View Full Code Here

TOP

Related Classes of org.springframework.web.bind.support.WebRequestDataBinder

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.