All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.ipokerface.web.spring.bind.ServletModelAttributeMethodProcessor Maven / Gradle / Ivy

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy