Skip to content

Commit

Permalink
Merge pull request #145 from http4s/update/series/0.23/http4s-server-…
Browse files Browse the repository at this point in the history
…0.23.17

Update http4s-dsl, ... to 0.23.17 in series/0.23
  • Loading branch information
rossabaker authored Jan 5, 2023
2 parents a307251 + cb080ff commit 5ea779d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lazy val root = tlCrossRootProject.aggregate(servlet, examples)

val asyncHttpClientVersion = "2.12.3"
val jettyVersion = "9.4.50.v20221201"
val http4sVersion = "0.23.16"
val http4sVersion = "0.23.17"
val munitCatsEffectVersion = "1.0.7"
val servletApiVersion = "3.1.0"

Expand Down
4 changes: 3 additions & 1 deletion examples/src/main/scala/com/example/Bootstrap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class Bootstrap extends ServletContextListener {
@volatile private var shutdown: IO[Unit] = IO.unit

override def contextInitialized(sce: ServletContextEvent): Unit = {
Dispatcher[IO].allocated
Dispatcher
.parallel[IO]
.allocated
.flatMap { case (dispatcher, shutdown) =>
IO(this.shutdown = shutdown) *>
IO(sce.getServletContext.mountRoutes("example", routes, dispatcher = dispatcher))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse
import scala.annotation.nowarn
import scala.concurrent.duration.Duration

class AsyncHttp4sServlet[F[_]] @deprecated("Use AsyncHttp4sServlet.builder", "0.23.16") (
class AsyncHttp4sServlet[F[_]] @deprecated("Use AsyncHttp4sServlet.builder", "0.23.17") (
httpApp: HttpApp[F],
asyncTimeout: Duration = Duration.Inf,
servletIo: ServletIo[F],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import javax.servlet._
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

@deprecated("Not releated to http4s. Will be removed from public API", "0.23.16")
@deprecated("Not releated to http4s. Will be removed from public API", "0.23.17")
trait DefaultFilter extends Filter {
override def init(filterConfig: FilterConfig): Unit = {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class AsyncHttp4sServletSuite extends CatsEffectSuite {
.orNotFound

private val servletServer =
ResourceFixture[Int](Dispatcher[IO].flatMap(d => TestEclipseServer(servlet(d))))
ResourceFixture[Int](Dispatcher.parallel[IO].flatMap(d => TestEclipseServer(servlet(d))))

private def get(client: HttpClient, serverPort: Int, path: String): IO[String] =
IO.blocking(
Expand Down Expand Up @@ -134,7 +134,8 @@ class AsyncHttp4sServletSuite extends CatsEffectSuite {
servletServer.test("AsyncHttp4sServlet handle two-chunk, deferred POST") { server =>
// Show that we can read, be blocked, and read again
val bytes = Stream.range(0, DefaultChunkSize).map(_.toByte).to(Array)
Dispatcher[IO]
Dispatcher
.parallel[IO]
.use { dispatcher =>
clientR.use { client =>
for {
Expand Down Expand Up @@ -174,7 +175,8 @@ class AsyncHttp4sServletSuite extends CatsEffectSuite {

// We shouldn't block when we receive less than a chunk at a time
servletServer.test("AsyncHttp4sServlet handle two itsy-bitsy deferred chunk POST") { server =>
Dispatcher[IO]
Dispatcher
.parallel[IO]
.use { dispatcher =>
clientR.use { client =>
for {
Expand Down Expand Up @@ -214,7 +216,8 @@ class AsyncHttp4sServletSuite extends CatsEffectSuite {

servletServer.test("AsyncHttp4sServlet should not reorder lots of itsy-bitsy chunks") { server =>
val body = (0 until 4096).map(_.toByte).toArray
Dispatcher[IO]
Dispatcher
.parallel[IO]
.use { dispatcher =>
clientR.use { client =>
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BlockingHttp4sServletSuite extends CatsEffectSuite {
.orNotFound

private val servletServer = ResourceFixture(
Dispatcher[IO].flatMap(d => TestEclipseServer(servlet(d)))
Dispatcher.parallel[IO].flatMap(d => TestEclipseServer(servlet(d)))
)

private def get(serverPort: Int, path: String): IO[String] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,28 @@ class RouterInServletSuite extends CatsEffectSuite {
)

private val serverWithoutRouter =
ResourceFixture[Int](Dispatcher[IO].flatMap(d => mkServer(mainRoutes, dispatcher = d)))
ResourceFixture[Int](Dispatcher.parallel[IO].flatMap(d => mkServer(mainRoutes, dispatcher = d)))
private val server =
ResourceFixture[Int](Dispatcher[IO].flatMap(d => mkServer(router, dispatcher = d)))
ResourceFixture[Int](Dispatcher.parallel[IO].flatMap(d => mkServer(router, dispatcher = d)))
private val serverWithContextPath =
ResourceFixture[Int](
Dispatcher[IO].flatMap(d => mkServer(router, contextPath = "/context", dispatcher = d))
Dispatcher
.parallel[IO]
.flatMap(d => mkServer(router, contextPath = "/context", dispatcher = d))
)
private val serverWithServletPath =
ResourceFixture[Int](
Dispatcher[IO].flatMap(d => mkServer(router, servletPath = "/servlet/*", dispatcher = d))
Dispatcher
.parallel[IO]
.flatMap(d => mkServer(router, servletPath = "/servlet/*", dispatcher = d))
)
private val serverWithContextAndServletPath =
ResourceFixture[Int](
Dispatcher[IO].flatMap(d =>
mkServer(router, contextPath = "/context", servletPath = "/servlet/*", dispatcher = d)
)
Dispatcher
.parallel[IO]
.flatMap(d =>
mkServer(router, contextPath = "/context", servletPath = "/servlet/*", dispatcher = d)
)
)

serverWithoutRouter.test(
Expand Down

0 comments on commit 5ea779d

Please sign in to comment.