Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 9 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ jobs:
matrix:
os: [ubuntu-22.04]
scala: [2.12, 2.13, 3]
java: [temurin@11, temurin@17]
java: [temurin@17]
project: [rootJVM]
exclude:
- scala: 2.12
java: temurin@17
- scala: 3
java: temurin@17
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
Expand All @@ -48,19 +43,6 @@ jobs:
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
Expand All @@ -78,26 +60,26 @@ jobs:
run: sbt githubWorkflowCheck

- name: Check headers and formatting
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-22.04'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Test
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test

- name: Check binary compatibility
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-22.04'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-22.04'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc

- name: Check scalafix lints
if: matrix.java == 'temurin@11' && !startsWith(matrix.scala, '3')
if: matrix.java == 'temurin@17' && !startsWith(matrix.scala, '3')
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' 'scalafixAll --check'

- name: Check unused compile dependencies
if: matrix.java == 'temurin@11'
if: matrix.java == 'temurin@17'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' unusedCompileDependenciesTest

- name: Make target directories
Expand All @@ -122,7 +104,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
java: [temurin@11]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand All @@ -133,19 +115,6 @@ jobs:
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
Expand Down Expand Up @@ -219,7 +188,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
java: [temurin@11]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand All @@ -230,19 +199,6 @@ jobs:
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
Expand Down Expand Up @@ -292,7 +248,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
java: [temurin@11]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand All @@ -303,19 +259,6 @@ jobs:
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
Expand Down
18 changes: 11 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// https://typelevel.org/sbt-typelevel/faq.html#what-is-a-base-version-anyway
ThisBuild / tlBaseVersion := "0.25" // your current series x.y
ThisBuild / tlBaseVersion := "0.26" // your current series x.y

ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / developers := List(
Expand All @@ -14,18 +14,22 @@ val Scala213 = "2.13.16"
ThisBuild / crossScalaVersions := Seq("2.12.20", Scala213, "3.3.5")
ThisBuild / scalaVersion := Scala213 // the default Scala

// Jetty 10+, for testing, requires Java 11.
// Jakarta EE 10 requires Java 11
ThisBuild / githubWorkflowJavaVersions -= JavaSpec.temurin("8")
ThisBuild / tlJdkRelease := Some(8)
ThisBuild / tlJdkRelease := Some(11)

// Jetty for Servlet 6 requires Jetty 17
ThisBuild / githubWorkflowJavaVersions -= JavaSpec.temurin("11")

ThisBuild / startYear := Some(2013)

lazy val root = tlCrossRootProject.aggregate(servlet, examples)

val asyncHttpClientVersion = "2.12.3"
val jettyVersion = "11.0.25"
val jettyVersion = "12.0.21"
val http4sVersion = "0.23.30"
val munitCatsEffectVersion = "2.1.0"
val servletApiVersion = "5.0.0"
val servletApiVersion = "6.0.0"

lazy val servlet = project
.in(file("servlet"))
Expand All @@ -36,7 +40,7 @@ lazy val servlet = project
"jakarta.servlet" % "jakarta.servlet-api" % servletApiVersion % Provided,
"org.eclipse.jetty" % "jetty-client" % jettyVersion % Test,
"org.eclipse.jetty" % "jetty-server" % jettyVersion % Test,
"org.eclipse.jetty" % "jetty-servlet" % jettyVersion % Test,
"org.eclipse.jetty.ee10" % "jetty-ee10-servlet" % jettyVersion % Test,
"org.http4s" %% "http4s-dsl" % http4sVersion % Test,
"org.http4s" %% "http4s-server" % http4sVersion,
"org.typelevel" %% "munit-cats-effect" % munitCatsEffectVersion % Test,
Expand All @@ -52,7 +56,7 @@ lazy val examples = project
description := "Examples for http4s-servlet",
startYear := Some(2013),
fork := true,
Jetty / containerLibs := List("org.eclipse.jetty" % "jetty-runner" % jettyVersion),
// Jetty / containerLibs := List("org.eclipse.jetty" % "jetty-runner" % jettyVersion),
libraryDependencies ++= Seq(
"jakarta.servlet" % "jakarta.servlet-api" % servletApiVersion % Provided
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import cats.syntax.all._
import fs2.Chunk
import fs2.Stream
import munit.CatsEffectSuite
import org.eclipse.jetty.client.AsyncRequestContent
import org.eclipse.jetty.client.BytesRequestContent
import org.eclipse.jetty.client.HttpClient
import org.eclipse.jetty.client.api.{Response => JResponse}
import org.eclipse.jetty.client.util.AsyncRequestContent
import org.eclipse.jetty.client.util.BytesRequestContent
import org.eclipse.jetty.client.{Response => JResponse}
import org.eclipse.jetty.util.Callback
import org.http4s.dsl.io._
import org.http4s.syntax.all._

Expand Down Expand Up @@ -126,7 +127,7 @@ class AsyncHttp4sServletSuite extends CatsEffectSuite {
})
}
.start
_ <- IO(content.offer(ByteBuffer.wrap(bytes)))
_ <- IO(content.write(ByteBuffer.wrap(bytes), Callback.NOOP))
_ <- IO(content.close())
body <- bodyFiber.joinWithNever
} yield body
Expand Down Expand Up @@ -166,9 +167,9 @@ class AsyncHttp4sServletSuite extends CatsEffectSuite {
})
}
.start
_ <- IO(content.offer(ByteBuffer.wrap(bytes)))
_ <- IO(content.write(ByteBuffer.wrap(bytes), Callback.NOOP))
_ <- firstChunkReceived.get
_ <- IO(content.offer(ByteBuffer.wrap(bytes)))
_ <- IO(content.write(ByteBuffer.wrap(bytes), Callback.NOOP))
_ <- IO(content.close())
body <- bodyFiber.joinWithNever
} yield body
Expand Down Expand Up @@ -207,9 +208,9 @@ class AsyncHttp4sServletSuite extends CatsEffectSuite {
})
}
.start
_ <- IO(content.offer(ByteBuffer.wrap(Array[Byte](0.toByte))))
_ <- IO(content.write(ByteBuffer.wrap(Array[Byte](0.toByte)), Callback.NOOP))
_ <- firstChunkReceived.get
_ <- IO(content.offer(ByteBuffer.wrap(Array[Byte](1.toByte))))
_ <- IO(content.write(ByteBuffer.wrap(Array[Byte](1.toByte)), Callback.NOOP))
_ <- IO(content.close())
body <- bodyFiber.joinWithNever
} yield body
Expand Down Expand Up @@ -248,7 +249,7 @@ class AsyncHttp4sServletSuite extends CatsEffectSuite {
}
.start
_ <- body.toList.traverse_(b =>
IO(content.offer(ByteBuffer.wrap(Array[Byte](b)))) >> IO(content.flush())
IO(content.write(ByteBuffer.wrap(Array[Byte](b)), Callback.NOOP)) >> IO(content.flush())
)
_ <- IO(content.close())
body <- bodyFiber.joinWithNever
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ final case class HttpServletRequestStub(
def getParts(): java.util.Collection[jakarta.servlet.http.Part] = ???
def getPathInfo(): String = ???
def getPathTranslated(): String = ???
def getProtocolRequestId(): String = ???
def getQueryString(): String = ???
def getRemoteUser(): String = ???
def getRequestId(): String = ???
def getRequestURI(): String = ???
def getRequestURL(): StringBuffer = ???
def getRequestedSessionId(): String = ???
def getServletConnection(): jakarta.servlet.ServletConnection = ???
def getServletPath(): String = ???
def getSession(): jakarta.servlet.http.HttpSession = ???
def getSession(x$1: Boolean): jakarta.servlet.http.HttpSession = ???
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import org.eclipse.jetty.server.HttpConfiguration
import org.eclipse.jetty.server.HttpConnectionFactory
import org.eclipse.jetty.server.ServerConnector
import org.eclipse.jetty.server.{Server => EclipseServer}
import org.eclipse.jetty.servlet.ServletContextHandler
import org.eclipse.jetty.servlet.ServletHolder
import org.eclipse.jetty.ee10.servlet.ServletContextHandler
import org.eclipse.jetty.ee10.servlet.ServletHolder

object TestEclipseServer {

Expand Down
Loading