Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ on:

env:
# Java version to use for the release
RELEASE_JAVA_VERSION: 11
RELEASE_JAVA_VERSION: 17

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
java: [ 11, 17, 21 ]
java: [ 17, 21 ]

name: Java ${{ matrix.java }}

Expand Down
2 changes: 1 addition & 1 deletion jicoco-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</execution>
</executions>
<configuration>
<jvmTarget>11</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
</plugin>
</plugins>
Expand Down
4 changes: 2 additions & 2 deletions jicoco-health-checker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</execution>
</executions>
<configuration>
<jvmTarget>11</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -108,7 +108,7 @@
</execution>
</executions>
<configuration>
<release>11</release>
<release>17</release>
<compilerArgs>
<arg>-Xlint:all,-serial</arg>
</compilerArgs>
Expand Down
17 changes: 6 additions & 11 deletions jicoco-jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,22 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-proxy</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty.version}</version>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-servlets</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.xeustechnologies</groupId>
Expand Down Expand Up @@ -233,7 +228,7 @@
</execution>
</executions>
<configuration>
<jvmTarget>11</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -265,7 +260,7 @@
</execution>
</executions>
<configuration>
<release>11</release>
<release>17</release>
<compilerArgs>
<arg>-Xlint:all,-serial</arg>
</compilerArgs>
Expand Down
45 changes: 30 additions & 15 deletions jicoco-jetty/src/main/kotlin/org/jitsi/rest/JettyHelpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@
package org.jitsi.rest

import jakarta.servlet.DispatcherType
import org.eclipse.jetty.ee10.servlet.ServletContextHandler
import org.eclipse.jetty.ee10.servlet.ServletHolder
import org.eclipse.jetty.ee10.servlets.CrossOriginFilter
import org.eclipse.jetty.http.HttpStatus
import org.eclipse.jetty.server.Handler
import org.eclipse.jetty.server.HttpConfiguration
import org.eclipse.jetty.server.HttpConnectionFactory
import org.eclipse.jetty.server.Request
import org.eclipse.jetty.server.Response
import org.eclipse.jetty.server.SecureRequestCustomizer
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.server.ServerConnector
import org.eclipse.jetty.server.SslConnectionFactory
import org.eclipse.jetty.servlet.ServletContextHandler
import org.eclipse.jetty.servlet.ServletHolder
import org.eclipse.jetty.servlets.CrossOriginFilter
import org.eclipse.jetty.util.Callback
import org.eclipse.jetty.util.ssl.SslContextFactory
import java.nio.file.Paths
import java.util.EnumSet
Expand All @@ -39,15 +43,9 @@ import java.util.EnumSet
fun createJettyServer(config: JettyBundleActivatorConfig): Server {
val httpConfig = HttpConfiguration().apply {
sendServerVersion = config.sendServerVersion
addCustomizer { _, _, request ->
if (request.method.equals("TRACE", ignoreCase = true)) {
request.isHandled = true
request.response.status = HttpStatus.METHOD_NOT_ALLOWED_405
}
}
}
val server = Server().apply {
handler = ServletContextHandler()
handler = TraceBlockingHandler(ServletContextHandler())
}
val connector = ServerConnector(server, HttpConnectionFactory(httpConfig)).apply {
port = config.port
Expand Down Expand Up @@ -83,7 +81,7 @@ fun createSecureJettyServer(config: JettyBundleActivatorConfig): Server {
sendServerVersion = config.sendServerVersion
}
val server = Server().apply {
handler = ServletContextHandler()
handler = TraceBlockingHandler(ServletContextHandler())
}

val connector = ServerConnector(
Expand Down Expand Up @@ -114,11 +112,28 @@ fun createServer(config: JettyBundleActivatorConfig): Server {

fun JettyBundleActivatorConfig.isEnabled(): Boolean = port != -1 || tlsPort != -1

// Note: it's technically possible that this cast fails, but
// shouldn't happen in practice given that the above methods always install
// a ServletContextHandler handler.
/**
* A [Handler.Wrapper] that rejects HTTP TRACE requests with 405 Method Not Allowed,
* forwarding everything else to the wrapped [ServletContextHandler].
*/
private class TraceBlockingHandler(
val servletContextHandler: ServletContextHandler
) : Handler.Wrapper(servletContextHandler) {
override fun handle(request: Request, response: Response, callback: Callback): Boolean {
if (request.method.equals("TRACE", ignoreCase = true)) {
Response.writeError(request, response, callback, HttpStatus.METHOD_NOT_ALLOWED_405)
return true
}
return super.handle(request, response, callback)
}
}

val Server.servletContextHandler: ServletContextHandler
get() = handler as ServletContextHandler
get() = when (val h = handler) {
is TraceBlockingHandler -> h.servletContextHandler
is ServletContextHandler -> h
else -> error("Unexpected server handler type: ${h?.javaClass?.name}")
}

fun ServletContextHandler.enableCors(pathSpec: String = "/*") {
addFilter(CrossOriginFilter::class.java, pathSpec, EnumSet.of(DispatcherType.REQUEST)).apply {
Expand Down
4 changes: 2 additions & 2 deletions jicoco-jwt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</execution>
</executions>
<configuration>
<jvmTarget>11</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -150,7 +150,7 @@
</execution>
</executions>
<configuration>
<release>11</release>
<release>17</release>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
Expand Down
4 changes: 2 additions & 2 deletions jicoco-mediajson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</execution>
</executions>
<configuration>
<jvmTarget>11</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -131,7 +131,7 @@
</execution>
</executions>
<configuration>
<release>11</release>
<release>17</release>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
Expand Down
4 changes: 2 additions & 2 deletions jicoco-metrics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
</execution>
</executions>
<configuration>
<jvmTarget>11</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -175,7 +175,7 @@
</execution>
</executions>
<configuration>
<release>11</release>
<release>17</release>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
Expand Down
4 changes: 2 additions & 2 deletions jicoco-mucclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
</execution>
</executions>
<configuration>
<jvmTarget>11</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -190,7 +190,7 @@
</execution>
</executions>
<configuration>
<release>11</release>
<release>17</release>
<compilerArgs>
<arg>-Xlint:all,-serial</arg>
</compilerArgs>
Expand Down
2 changes: 1 addition & 1 deletion jicoco-test-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</execution>
</executions>
<configuration>
<jvmTarget>11</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
</plugin>
</plugins>
Expand Down
24 changes: 22 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
<mockk.version>1.13.8</mockk.version>
<prometheus.version>0.16.0</prometheus.version>
<dokka.version>1.9.10</dokka.version>
<jetty.version>11.0.21</jetty.version>
<jersey.version>3.0.10</jersey.version>
<jetty.version>12.0.35</jetty.version>
<jersey.version>3.1.11</jersey.version>
<jwt.version>0.12.6</jwt.version>
<bouncycastle.version>1.83</bouncycastle.version>
<smack.version>4.4.8-jitsi-4</smack.version>
Expand All @@ -85,6 +85,26 @@
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<!--
Pin all Jetty artifacts (transitive dependencies of Jersey, etc.)
to ${jetty.version}. Without this, Jersey's POM has JDK-activated
profiles that can swap in a Jetty 11.x version when Maven is run
under JDK < 17.
-->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-bom</artifactId>
<version>${jetty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-bom</artifactId>
<version>${jetty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
Loading