cn.ipokerface.web.spring.bind.ServletModelAttributeMethodProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-web Show documentation
Show all versions of spring-web Show documentation
Common Library of ipokerface
The newest version!
package cn.ipokerface.web.spring.bind;
import org.springframework.util.Assert;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.annotation.ModelAttributeMethodProcessor;
import javax.servlet.ServletRequest;
public class ServletModelAttributeMethodProcessor extends ModelAttributeMethodProcessor {
public ServletModelAttributeMethodProcessor(boolean annotationNotRequired) {
super(annotationNotRequired);
}
@Override
protected void bindRequestParameters(WebDataBinder binder, NativeWebRequest request) {
ServletRequest servletRequest = request.getNativeRequest(ServletRequest.class);
Assert.state(servletRequest != null, "No ServletReqeust");
new ServletRequestDataBinder(binder.getTarget()).bind(servletRequest);
}
}