diff --git a/src/sbt-test/sbt-war/combined/scenarios/war-package-plugin.sbt b/src/sbt-test/sbt-war/combined/scenarios/war-package-plugin.sbt
index 2fa9a52f..20a837d8 100644
--- a/src/sbt-test/sbt-war/combined/scenarios/war-package-plugin.sbt
+++ b/src/sbt-test/sbt-war/combined/scenarios/war-package-plugin.sbt
@@ -68,12 +68,14 @@ lazy val checkWar: Def.Initialize[Task[Unit]] =
"WEB-INF/classes/drivers/mem/mem$package.class",
"WEB-INF/classes/drivers/mem/mem$package.tasty",
"WEB-INF/classes/runners/",
+ "WEB-INF/classes/runners/CountServlet.class",
+ "WEB-INF/classes/runners/CountServlet.tasty",
+ "WEB-INF/classes/runners/HelloServlet.class",
+ "WEB-INF/classes/runners/HelloServlet.tasty",
"WEB-INF/classes/runners/Main$$anon$1.class",
"WEB-INF/classes/runners/Main$tx$.class",
"WEB-INF/classes/runners/Main.class",
"WEB-INF/classes/runners/Main.tasty",
- "WEB-INF/classes/runners/MainServlet.class",
- "WEB-INF/classes/runners/MainServlet.tasty",
"WEB-INF/classes/usecases/",
"WEB-INF/classes/usecases/Counter.class",
"WEB-INF/classes/usecases/Counter.tasty",
diff --git a/src/sbt-test/sbt-war/combined/scenarios/war-runner-plugin.sbt b/src/sbt-test/sbt-war/combined/scenarios/war-runner-plugin.sbt
index 80b94482..838e0463 100644
--- a/src/sbt-test/sbt-war/combined/scenarios/war-runner-plugin.sbt
+++ b/src/sbt-test/sbt-war/combined/scenarios/war-runner-plugin.sbt
@@ -170,4 +170,9 @@ TaskKey[Unit]("check") := {
|}
|""".stripMargin
)
+
+ assertEquals(
+ url = s"http://localhost:${warPort.value}/hello",
+ expectedBody = """
Hello, world!
"""
+ )
}
diff --git a/src/sbt-test/sbt-war/combined/scenarios/webapp-components-runner-plugin.sbt b/src/sbt-test/sbt-war/combined/scenarios/webapp-components-runner-plugin.sbt
index 44944a05..3d91fb06 100644
--- a/src/sbt-test/sbt-war/combined/scenarios/webapp-components-runner-plugin.sbt
+++ b/src/sbt-test/sbt-war/combined/scenarios/webapp-components-runner-plugin.sbt
@@ -170,4 +170,9 @@ TaskKey[Unit]("check") := {
|}
|""".stripMargin
)
+
+ assertEquals(
+ url = s"http://localhost:${webappPort.value}/hello",
+ expectedBody = """Hello, world!
"""
+ )
}
diff --git a/src/sbt-test/sbt-war/combined/scenarios/webapp-plugin.sbt b/src/sbt-test/sbt-war/combined/scenarios/webapp-plugin.sbt
index 9a60f355..940edead 100644
--- a/src/sbt-test/sbt-war/combined/scenarios/webapp-plugin.sbt
+++ b/src/sbt-test/sbt-war/combined/scenarios/webapp-plugin.sbt
@@ -54,12 +54,14 @@ val checkClasses: Def.Initialize[Task[Unit]] =
"drivers/mem/mem$package$.class",
"drivers/mem/mem$package.class",
"drivers/mem/mem$package.tasty",
+ "runners/CountServlet.class",
+ "runners/CountServlet.tasty",
+ "runners/HelloServlet.class",
+ "runners/HelloServlet.tasty",
"runners/Main$$anon$1.class",
"runners/Main$tx$.class",
"runners/Main.class",
"runners/Main.tasty",
- "runners/MainServlet.class",
- "runners/MainServlet.tasty",
"usecases/Counter.class",
"usecases/Counter.tasty"
)
diff --git a/src/sbt-test/sbt-war/combined/src/main/scala/04-runners/servlet.scala b/src/sbt-test/sbt-war/combined/src/main/scala/04-runners/servlet.scala
index e67d4ca4..bbd1c5c6 100644
--- a/src/sbt-test/sbt-war/combined/src/main/scala/04-runners/servlet.scala
+++ b/src/sbt-test/sbt-war/combined/src/main/scala/04-runners/servlet.scala
@@ -1,12 +1,14 @@
package runners
-import java.sql.Connection
-import java.sql.DriverManager
+import javax.servlet.annotation.WebServlet
import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
-class MainServlet extends HttpServlet with Main:
+class CountServlet extends HttpServlet with Main:
+
+ import java.sql.Connection
+ import java.sql.DriverManager
override lazy val c: Connection =
Class.forName("org.h2.Driver")
@@ -27,3 +29,14 @@ class MainServlet extends HttpServlet with Main:
): Unit =
res.addHeader("Content-Type", "application/json")
res.getWriter().write(unsafeIncrementAndGetAsJson())
+
+@WebServlet(urlPatterns = Array("/hello"))
+class HelloServlet extends HttpServlet:
+
+ override def doGet(
+ request: HttpServletRequest,
+ response: HttpServletResponse
+ ): Unit =
+ response.setCharacterEncoding("UTF-8")
+ response.setContentType("text/html")
+ response.getWriter.write("""Hello, world!
""")
diff --git a/src/sbt-test/sbt-war/combined/src/main/webapp/WEB-INF/web.xml b/src/sbt-test/sbt-war/combined/src/main/webapp/WEB-INF/web.xml
index 80afa2c0..e8f6e947 100644
--- a/src/sbt-test/sbt-war/combined/src/main/webapp/WEB-INF/web.xml
+++ b/src/sbt-test/sbt-war/combined/src/main/webapp/WEB-INF/web.xml
@@ -1,13 +1,13 @@
- MainServlet
- runners.MainServlet
+ CountServlet
+ runners.CountServlet
true
- MainServlet
+ CountServlet
/count