|
1 | 1 | /* |
2 | | - * Copyright 2002-2006 the original author or authors. |
| 2 | + * Copyright 2002-2010 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
17 | 17 | package org.springframework.web.multipart.support; |
18 | 18 |
|
19 | 19 | import java.io.IOException; |
20 | | - |
21 | 20 | import javax.servlet.FilterChain; |
22 | 21 | import javax.servlet.ServletException; |
23 | 22 | import javax.servlet.http.HttpServletRequest; |
|
46 | 45 | * for each call but rather return a reference to a pre-built instance. |
47 | 46 | * |
48 | 47 | * <p>Note: This filter is an <b>alternative</b> to using DispatcherServlet's |
49 | | - * MultipartResolver support, for example for web applications with custom |
50 | | - * web views that do not use Spring's web MVC. It should not be combined with |
51 | | - * servlet-specific multipart resolution. |
| 48 | + * MultipartResolver support, for example for web applications with custom web views |
| 49 | + * which do not use Spring's web MVC, or for custom filters applied before a Spring MVC |
| 50 | + * DispatcherServlet (e.g. {@link org.springframework.web.filter.HiddenHttpMethodFilter}). |
| 51 | + * In any case, this filter should not be combined with servlet-specific multipart resolution. |
52 | 52 | * |
53 | 53 | * @author Juergen Hoeller |
54 | 54 | * @since 08.10.2003 |
@@ -77,7 +77,7 @@ public void setMultipartResolverBeanName(String multipartResolverBeanName) { |
77 | 77 | * root application context. |
78 | 78 | */ |
79 | 79 | protected String getMultipartResolverBeanName() { |
80 | | - return multipartResolverBeanName; |
| 80 | + return this.multipartResolverBeanName; |
81 | 81 | } |
82 | 82 |
|
83 | 83 |
|
@@ -143,9 +143,8 @@ protected MultipartResolver lookupMultipartResolver() { |
143 | 143 | if (logger.isDebugEnabled()) { |
144 | 144 | logger.debug("Using MultipartResolver '" + getMultipartResolverBeanName() + "' for MultipartFilter"); |
145 | 145 | } |
146 | | - WebApplicationContext wac = |
147 | | - WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); |
148 | | - return (MultipartResolver) wac.getBean(getMultipartResolverBeanName(), MultipartResolver.class); |
| 146 | + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); |
| 147 | + return wac.getBean(getMultipartResolverBeanName(), MultipartResolver.class); |
149 | 148 | } |
150 | 149 |
|
151 | 150 | } |
0 commit comments