Fix standard multipart binding + Polish

Fixing standard multipart binding when multiple parts share
the same name.

Uncomment previously @Ignored tests now that Jetty supports
Servlet 3.0 spec.

Issue: SPR-10591
This commit is contained in:
Brian Clozel
2013-11-19 20:48:41 +01:00
committed by Phillip Webb
parent 6f2004f4f8
commit cc4faa5990
3 changed files with 33 additions and 11 deletions

View File

@@ -19,13 +19,14 @@ package org.springframework.web.servlet.mvc.method.annotation;
import java.net.URI;
import java.util.Arrays;
import javax.servlet.MultipartConfigElement;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -62,6 +63,7 @@ import static org.junit.Assert.*;
* Test access to parts of a multipart request with {@link RequestPart}.
*
* @author Rossen Stoyanchev
* @author Brian Clozel
*/
public class RequestPartIntegrationTests {
@@ -91,10 +93,9 @@ public class RequestPartIntegrationTests {
ServletHolder standardResolverServlet = new ServletHolder(DispatcherServlet.class);
standardResolverServlet.setInitParameter("contextConfigLocation", config.getName());
standardResolverServlet.setInitParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
standardResolverServlet.getRegistration().setMultipartConfig(new MultipartConfigElement(""));
handler.addServlet(standardResolverServlet, "/standard-resolver/*");
// TODO: add Servlet 3.0 test case without MultipartResolver
server.setHandler(handler);
server.start();
}
@@ -123,7 +124,6 @@ public class RequestPartIntegrationTests {
}
@Test
@Ignore("jetty 6.1.9 doesn't support Servlet 3.0")
public void standardMultipartResolver() throws Exception {
testCreate(baseUrl + "/standard-resolver/test");
}