-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added distribution test cases for EagerContentHandler modules.
Signed-off-by: Simone Bordet <[email protected]>
- Loading branch information
Showing
9 changed files
with
257 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...-servlet5-demo-simple-webapp/src/main/java/org/eclipse/jetty/demo/simple/EchoServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.demo.simple; | ||
|
||
import java.io.IOException; | ||
import java.util.stream.Collectors; | ||
|
||
import jakarta.servlet.MultipartConfigElement; | ||
import jakarta.servlet.ServletException; | ||
import jakarta.servlet.ServletInputStream; | ||
import jakarta.servlet.ServletOutputStream; | ||
import jakarta.servlet.annotation.MultipartConfig; | ||
import jakarta.servlet.http.HttpServlet; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
|
||
@MultipartConfig | ||
public class EchoServlet extends HttpServlet | ||
{ | ||
@Override | ||
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException | ||
{ | ||
response.setContentType(request.getContentType()); | ||
ServletOutputStream output = response.getOutputStream(); | ||
String pathInfo = request.getPathInfo(); | ||
switch (pathInfo) | ||
{ | ||
case "/form" -> | ||
{ | ||
String content = request.getParameterMap().entrySet().stream() | ||
.map(e -> "%s=%s".formatted(e.getKey(), String.join(", ", e.getValue()))) | ||
.collect(Collectors.joining("&")); | ||
output.print(content); | ||
} | ||
case "/multipart" -> | ||
{ | ||
MultipartConfigElement config = new MultipartConfigElement(""); | ||
request.setAttribute(MultipartConfigElement.class.getName(), config); | ||
|
||
String content = request.getParts().stream() | ||
.map(part -> "name=%s&length=%d".formatted(part.getName(), part.getSize())) | ||
.collect(Collectors.joining(",")); | ||
output.print(content); | ||
} | ||
default -> | ||
{ | ||
ServletInputStream input = request.getInputStream(); | ||
response.setContentLengthLong(request.getContentLengthLong()); | ||
input.transferTo(output); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.