/** * {@link javax.servlet.Filter} that converts posted method parameters into HTTP methods, * retrievable via {@link HttpServletRequest#getMethod()}. Since browsers currently only * support GET and POST, a common technique - used by the Prototype library, for instance - * is to use a normal POST with an additional hidden form field ({@code _method}) * to pass the "real" HTTP method along. This filter reads that parameter and changes * the {@link HttpServletRequestWrapper#getMethod()} return value accordingly. * * <p>The name of the request parameter defaults to {@code _method}, but can be * adapted via the {@link #setMethodParam(String) methodParam} property. * * <p><b>NOTE: This filter needs to run after multipart processing in case of a multipart * POST request, due to its inherent need for checking a POST body parameter.</b> * So typically, put a Spring {@link org.springframework.web.multipart.support.MultipartFilter} * <i>before</i> this HiddenHttpMethodFilter in your {@code web.xml} filter chain. * * @author Arjen Poutsma * @author Juergen Hoeller * @since 3.0 */
MultipartFileter:
1 2 3 4 5 6 7
/** * Set the bean name of the MultipartResolver to fetch from Spring's * root application context. Default is "filterMultipartResolver". */ publicvoidsetMultipartResolverBeanName(String multipartResolverBeanName) { this.multipartResolverBeanName = multipartResolverBeanName; }