From 6e557814fa27cfebe5c47f879bc35f409f2da946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=99=8E=E9=B8=A3?= Date: Sun, 5 Jul 2026 11:39:23 +0800 Subject: [PATCH] refactor: remove deprecated ConnectionContext.defaultPort (since Akka HTTP 10.2.0) --- .../remove-deprecated-methods.excludes | 5 +++++ .../pekko/http/scaladsl/ConnectionContext.scala | 13 +++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/http-core/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes b/http-core/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes index 23ad02cc72..ea3a74eded 100644 --- a/http-core/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes +++ b/http-core/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes @@ -125,3 +125,8 @@ ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scalad ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.settings.ServerSettings.websocketRandomFactory") ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.settings.ServerSettings.getWebsocketRandomFactory") ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.settings.ServerSettings.withWebsocketRandomFactory") + +# Remove deprecated ConnectionContext.defaultPort (since Akka HTTP 10.2.0) +ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.ConnectionContext.defaultPort") +ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.HttpsConnectionContext.defaultPort") +ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.HttpConnectionContext.defaultPort") diff --git a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/ConnectionContext.scala b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/ConnectionContext.scala index 4f0f844c1d..4f12f38fce 100644 --- a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/ConnectionContext.scala +++ b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/ConnectionContext.scala @@ -18,10 +18,7 @@ import javax.net.ssl._ import org.apache.pekko import pekko.annotation.{ ApiMayChange, InternalApi } -trait ConnectionContext extends pekko.http.javadsl.ConnectionContext { - @deprecated("Internal method, left for binary compatibility", since = "Akka HTTP 10.2.0") - protected[http] def defaultPort: Int -} +trait ConnectionContext extends pekko.http.javadsl.ConnectionContext object ConnectionContext { // #https-server-context-creation @@ -91,13 +88,9 @@ object ConnectionContext { @InternalApi final class HttpsConnectionContext private[http] ( private[http] val engineCreator: Option[(String, Int)] => SSLEngine) - extends pekko.http.javadsl.HttpsConnectionContext with ConnectionContext { - protected[http] override final def defaultPort: Int = 443 -} + extends pekko.http.javadsl.HttpsConnectionContext with ConnectionContext -sealed class HttpConnectionContext extends pekko.http.javadsl.HttpConnectionContext with ConnectionContext { - protected[http] override final def defaultPort: Int = 80 -} +sealed class HttpConnectionContext extends pekko.http.javadsl.HttpConnectionContext with ConnectionContext object HttpConnectionContext extends HttpConnectionContext {