From 5ed2b7fe4e105347b1891481bcd49c70aab94103 Mon Sep 17 00:00:00 2001 From: "Ross A. Baker" Date: Sun, 19 Jun 2022 00:57:29 -0400 Subject: [PATCH 1/2] Servlet 4 upgrade --- build.sbt | 6 +++--- examples/src/main/scala/com/example/TomcatExample.scala | 6 +++--- .../main/scala/org/http4s/tomcat/server/TomcatBuilder.scala | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 109a26c..b8f59fe 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,4 @@ -ThisBuild / tlBaseVersion := "0.23" // your current series x.y +ThisBuild / tlBaseVersion := "0.24" // your current series x.y ThisBuild / tlMimaPreviousVersions ++= (0 to 11).map(y => s"0.23.$y").toSet ThisBuild / licenses := Seq(License.Apache2) @@ -16,9 +16,9 @@ ThisBuild / scalaVersion := Scala213 // the default Scala val asyncHttpClientVersion = "2.12.3" val http4sVersion = "0.23.12" -val http4sServletVersion = "0.23.11" +val http4sServletVersion = "0.24.0-M1" val munitCatsEffectVersion = "1.0.7" -val servletApiVersion = "3.1.0" +val servletApiVersion = "4.0.1" val tomcatVersion = "9.0.64" lazy val root = project diff --git a/examples/src/main/scala/com/example/TomcatExample.scala b/examples/src/main/scala/com/example/TomcatExample.scala index c2dd559..587c467 100644 --- a/examples/src/main/scala/com/example/TomcatExample.scala +++ b/examples/src/main/scala/com/example/TomcatExample.scala @@ -19,10 +19,10 @@ package com.example import cats.effect._ import org.http4s._ import org.http4s.server.Server -import org.http4s.servlet.DefaultFilter import org.http4s.tomcat.server.TomcatBuilder import javax.servlet.FilterChain +import javax.servlet.http.HttpFilter import javax.servlet.http.HttpServlet import javax.servlet.http.HttpServletRequest import javax.servlet.http.HttpServletResponse @@ -53,8 +53,8 @@ class TomcatExample[F[_]](implicit F: Async[F]) { } // Also supports raw filters alongside your http4s routes - val filter: DefaultFilter = new DefaultFilter { - override def doHttpFilter( + val filter: HttpFilter = new HttpFilter { + override protected def doFilter( request: HttpServletRequest, response: HttpServletResponse, chain: FilterChain, diff --git a/tomcat-server/src/main/scala/org/http4s/tomcat/server/TomcatBuilder.scala b/tomcat-server/src/main/scala/org/http4s/tomcat/server/TomcatBuilder.scala index 2866d7d..dcf5eb9 100644 --- a/tomcat-server/src/main/scala/org/http4s/tomcat/server/TomcatBuilder.scala +++ b/tomcat-server/src/main/scala/org/http4s/tomcat/server/TomcatBuilder.scala @@ -46,7 +46,7 @@ import java.net.InetSocketAddress import java.util import java.util.concurrent.Executor import javax.servlet.DispatcherType -import javax.servlet.Filter +import javax.servlet.http.HttpFilter import javax.servlet.http.HttpServlet import scala.collection.immutable import scala.concurrent.duration._ @@ -132,7 +132,7 @@ sealed class TomcatBuilder[F[_]] private ( }) override def mountFilter( - filter: Filter, + filter: HttpFilter, urlMapping: String, name: Option[String], dispatches: util.EnumSet[DispatcherType], From 3a9523ce338485a7200abb3a5cbe71af20dd3f8b Mon Sep 17 00:00:00 2001 From: "Ross A. Baker" Date: Sun, 19 Jun 2022 01:02:40 -0400 Subject: [PATCH 2/2] Not binary compatible with http4s-tomcat-0.23 --- build.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sbt b/build.sbt index b8f59fe..4bcbae3 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,4 @@ ThisBuild / tlBaseVersion := "0.24" // your current series x.y -ThisBuild / tlMimaPreviousVersions ++= (0 to 11).map(y => s"0.23.$y").toSet ThisBuild / licenses := Seq(License.Apache2) ThisBuild / developers := List(