当前位置: 首页>>代码示例>>Java>>正文


Java WebRequestDataBinder类代码示例

本文整理汇总了Java中org.springframework.web.bind.support.WebRequestDataBinder的典型用法代码示例。如果您正苦于以下问题:Java WebRequestDataBinder类的具体用法?Java WebRequestDataBinder怎么用?Java WebRequestDataBinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WebRequestDataBinder类属于org.springframework.web.bind.support包,在下文中一共展示了WebRequestDataBinder类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: obtainCredentials

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
/**
 * Obtain credentials from the request.
 *
 * @return the credential
 */
protected Credential obtainCredentials() {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    final WebRequestDataBinder binder = new WebRequestDataBinder(c);
    final RestletWebRequest webRequest = new RestletWebRequest(getRequest());

    final Form form = new Form(getRequest().getEntity());
    logFormRequest(form);

    if (!form.isEmpty()) {
        binder.bind(webRequest);
        return c;
    }
    LOGGER.trace("Failed to bind the request to credentials. Resulting form is empty");
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:TicketResource.java

示例2: obtainCredentials

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
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;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:11,代码来源:TicketResource.java

示例3: getAttributeFromModel

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:ModelAttributeMethodProcessorTests.java

示例4: resovleArgumentViaDefaultConstructor

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
@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);

	verify(factory).createBinder((NativeWebRequest) anyObject(), notNull(), eq("attrName"));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:ModelAttributeMethodProcessorTests.java

示例5: createBinder

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
protected WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName)
		throws Exception {

	return new WebRequestDataBinder(target, objectName);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:HandlerMethodInvoker.java

示例6: doBind

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
protected void doBind(WebDataBinder binder, NativeWebRequest webRequest) throws Exception {
	((WebRequestDataBinder) binder).bind(webRequest);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:HandlerMethodInvoker.java

示例7: missingRequestParamEmptyValueConvertedToNull

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
@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", "");

	Object arg = resolver.resolveArgument(paramStringNotAnnot, null, webRequest, binderFactory);

	assertNull(arg);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:RequestParamMethodArgumentResolverTests.java

示例8: missingRequestParamEmptyValueNotRequired

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
@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", "");

	Object arg = resolver.resolveArgument(paramNotRequired, null, webRequest, binderFactory);

	assertNull(arg);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:RequestParamMethodArgumentResolverTests.java

示例9: bindRequestParameters

import org.springframework.web.bind.support.WebRequestDataBinder; //导入依赖的package包/类
/**
 * Extension point to bind the request to the target object.
 * @param binder the data binder instance to use for the binding
 * @param request the current request
 */
protected void bindRequestParameters(WebDataBinder binder, NativeWebRequest request) {
	((WebRequestDataBinder) binder).bind(request);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:ModelAttributeMethodProcessor.java


注:本文中的org.springframework.web.bind.support.WebRequestDataBinder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。