|
|
|
|
@ -16,10 +16,8 @@
@@ -16,10 +16,8 @@
|
|
|
|
|
|
|
|
|
|
package org.springframework.web.bind.support; |
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.util.List; |
|
|
|
|
import javax.servlet.MultipartConfigElement; |
|
|
|
|
import javax.servlet.ServletException; |
|
|
|
|
import javax.servlet.http.HttpServlet; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
@ -30,7 +28,6 @@ import org.eclipse.jetty.server.NetworkConnector;
@@ -30,7 +28,6 @@ import org.eclipse.jetty.server.NetworkConnector;
|
|
|
|
|
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.BeforeClass; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
@ -67,7 +64,6 @@ public class WebRequestDataBinderIntegrationTests {
@@ -67,7 +64,6 @@ public class WebRequestDataBinderIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@BeforeClass |
|
|
|
|
public static void startJettyServer() throws Exception { |
|
|
|
|
|
|
|
|
|
// Let server pick its own random, available port.
|
|
|
|
|
jettyServer = new Server(0); |
|
|
|
|
|
|
|
|
|
@ -101,7 +97,6 @@ public class WebRequestDataBinderIntegrationTests {
@@ -101,7 +97,6 @@ public class WebRequestDataBinderIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void partsBinding() { |
|
|
|
|
|
|
|
|
|
PartsBean bean = new PartsBean(); |
|
|
|
|
partsServlet.setBean(bean); |
|
|
|
|
|
|
|
|
|
@ -118,7 +113,6 @@ public class WebRequestDataBinderIntegrationTests {
@@ -118,7 +113,6 @@ public class WebRequestDataBinderIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void partListBinding() { |
|
|
|
|
|
|
|
|
|
PartListBean bean = new PartListBean(); |
|
|
|
|
partListServlet.setBean(bean); |
|
|
|
|
|
|
|
|
|
@ -141,14 +135,10 @@ public class WebRequestDataBinderIntegrationTests {
@@ -141,14 +135,10 @@ public class WebRequestDataBinderIntegrationTests {
|
|
|
|
|
private T bean; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void service(HttpServletRequest request, HttpServletResponse response) throws |
|
|
|
|
ServletException, IOException { |
|
|
|
|
|
|
|
|
|
public void service(HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
WebRequestDataBinder binder = new WebRequestDataBinder(bean); |
|
|
|
|
ServletWebRequest webRequest = new ServletWebRequest(request, response); |
|
|
|
|
|
|
|
|
|
binder.bind(webRequest); |
|
|
|
|
|
|
|
|
|
response.setStatus(HttpServletResponse.SC_OK); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -157,6 +147,7 @@ public class WebRequestDataBinderIntegrationTests {
@@ -157,6 +147,7 @@ public class WebRequestDataBinderIntegrationTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class PartsBean { |
|
|
|
|
|
|
|
|
|
public Part firstPart; |
|
|
|
|
@ -182,10 +173,12 @@ public class WebRequestDataBinderIntegrationTests {
@@ -182,10 +173,12 @@ public class WebRequestDataBinderIntegrationTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("serial") |
|
|
|
|
private static class PartsServlet extends AbstractStandardMultipartServlet<PartsBean> { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class PartListBean { |
|
|
|
|
|
|
|
|
|
public List<Part> partList; |
|
|
|
|
@ -200,6 +193,7 @@ public class WebRequestDataBinderIntegrationTests {
@@ -200,6 +193,7 @@ public class WebRequestDataBinderIntegrationTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("serial") |
|
|
|
|
private static class PartListServlet extends AbstractStandardMultipartServlet<PartListBean> { |
|
|
|
|
} |
|
|
|
|
|