Search in sources :

Example 11 with MultipartConfigElement

use of jakarta.servlet.MultipartConfigElement in project spring-framework by spring-projects.

the class WebRequestDataBinderIntegrationTests method startJettyServer.

@BeforeAll
void startJettyServer() throws Exception {
    // Let server pick its own random, available port.
    jettyServer = new Server(0);
    ServletContextHandler handler = new ServletContextHandler();
    MultipartConfigElement multipartConfig = new MultipartConfigElement("");
    ServletHolder holder = new ServletHolder(partsServlet);
    holder.getRegistration().setMultipartConfig(multipartConfig);
    handler.addServlet(holder, "/parts");
    holder = new ServletHolder(partListServlet);
    holder.getRegistration().setMultipartConfig(multipartConfig);
    handler.addServlet(holder, "/partlist");
    jettyServer.setHandler(handler);
    jettyServer.start();
    Connector[] connectors = jettyServer.getConnectors();
    NetworkConnector connector = (NetworkConnector) connectors[0];
    baseUrl = "http://localhost:" + connector.getLocalPort();
}
Also used : NetworkConnector(org.eclipse.jetty.server.NetworkConnector) Connector(org.eclipse.jetty.server.Connector) MultipartConfigElement(jakarta.servlet.MultipartConfigElement) Server(org.eclipse.jetty.server.Server) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) NetworkConnector(org.eclipse.jetty.server.NetworkConnector) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

MultipartConfigElement (jakarta.servlet.MultipartConfigElement)11 StandardWrapper (org.apache.catalina.core.StandardWrapper)6 MultipartDef (org.apache.tomcat.util.descriptor.web.MultipartDef)6 Test (org.junit.Test)6 ServletException (jakarta.servlet.ServletException)2 Connector (org.eclipse.jetty.server.Connector)2 NetworkConnector (org.eclipse.jetty.server.NetworkConnector)2 Server (org.eclipse.jetty.server.Server)2 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 AsyncContext (jakarta.servlet.AsyncContext)1 Servlet (jakarta.servlet.Servlet)1 ServletContext (jakarta.servlet.ServletContext)1 SessionCookieConfig (jakarta.servlet.SessionCookieConfig)1 MultipartConfig (jakarta.servlet.annotation.MultipartConfig)1 File (java.io.File)1 IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1