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
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import pekko.util.ByteString
import pekko.Done

import javax.net.ssl.SSLEngine
import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent.Future
import scala.concurrent.duration.Duration
Expand Down Expand Up @@ -218,6 +219,7 @@ private[http] final class Http2Ext(implicit val system: ActorSystem)
def getChosenProtocol(): String = chosenProtocol.getOrElse(Http2AlpnSupport.HTTP11) // default to http/1, e.g. when ALPN jar is missing

var eng: Option[SSLEngine] = None
@nowarn("msg=deprecated") // TODO find an alternative way to do this
def createEngine(): SSLEngine = {
val engine = httpsContext.sslContextData match {
case Left(ssl) =>
Expand All @@ -230,6 +232,7 @@ private[http] final class Http2Ext(implicit val system: ActorSystem)
engine.setUseClientMode(false)
Http2AlpnSupport.enableForServer(engine, setChosenProtocol)
}
@nowarn("msg=deprecated") // TODO find an alternative way to do this
val tls = TLS(() => createEngine(), _ => Success(()), IgnoreComplete)

ProtocolSwitch(_ => getChosenProtocol(), http1, http2).join(
Expand All @@ -239,6 +242,7 @@ private[http] final class Http2Ext(implicit val system: ActorSystem)
def outgoingConnection(host: String, port: Int, connectionContext: HttpsConnectionContext,
clientConnectionSettings: ClientConnectionSettings, log: LoggingAdapter)
: Flow[HttpRequest, HttpResponse, Future[OutgoingConnection]] = {
@nowarn("msg=deprecated") // TODO find an alternative way to do this
def createEngine(): SSLEngine = {
val engine = connectionContext.sslContextData match {
// TODO FIXME configure hostname verification for this case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private[http2] abstract class Http2Demux(http2Settings: Http2CommonSettings,

pingState.tickInterval().foreach(interval =>
// to limit overhead rather than constantly rescheduling a timer and looking at system time we use a constant timer
schedulePeriodically(ConfigurablePing.Tick, interval))
scheduleAtFixedRate(ConfigurablePing.Tick, interval, interval))
}

override def pushGOAWAY(errorCode: ErrorCode, debug: String): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@
package org.apache.pekko.http.impl.engine.http2

import org.apache.pekko
import pekko.http.ccompat._

import pekko.annotation.InternalApi
import pekko.event.LoggingAdapter
import pekko.http.impl.engine.http2.FrameEvent._
import pekko.http.ccompat._
import pekko.http.scaladsl.settings.Http2CommonSettings
import pekko.macros.LogHelper
import pekko.stream.stage.GraphStageLogic
import pekko.stream.stage.OutHandler
import pekko.stream.stage.StageLogging
import scala.annotation.nowarn

import scala.annotation.nowarn
import scala.collection.mutable

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import java.util.{ Collection => JCollection, Optional }

import scala.annotation.nowarn

import org.apache.pekko
import pekko.annotation.{ ApiMayChange, DoNotInherit }
import pekko.http.impl.util.Util
Expand Down Expand Up @@ -60,14 +62,15 @@

// ConnectionContext
/** Used to serve HTTPS traffic. */
@Deprecated @deprecated("use httpsServer, httpsClient or the method that takes a custom factory",

Check warning on line 65 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / validate-links

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 65 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 8)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 65 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 11)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")
since = "Akka HTTP 10.2.0")
def https(sslContext: SSLContext): HttpsConnectionContext = // ...
// #https-context-creation
scaladsl.ConnectionContext.https(sslContext)

/** Used to serve HTTPS traffic. */
@nowarn("msg=deprecated")
@Deprecated @deprecated("use httpsServer, httpsClient or the method that takes a custom factory",

Check warning on line 73 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / validate-links

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 73 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 8)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 73 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 11)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")
since = "Akka HTTP 10.2.0")
def https(
sslContext: SSLContext,
Expand All @@ -86,7 +89,7 @@
sslParameters.toScala)

/** Used to serve HTTPS traffic. */
@Deprecated @deprecated("use httpsServer, httpsClient or the method that takes a custom factory",

Check warning on line 92 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / validate-links

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 92 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 8)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 92 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 11)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")
since = "Akka HTTP 10.2.0")
def https(
sslContext: SSLContext,
Expand All @@ -110,7 +113,7 @@
@DoNotInherit
abstract class ConnectionContext {
def isSecure: Boolean
@Deprecated

Check warning on line 116 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / validate-links

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 116 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 8)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 116 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 11)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")
@deprecated("Not always available", since = "Akka HTTP 10.2.0")
def sslConfig: Option[PekkoSSLConfig]
}
Expand All @@ -118,6 +121,7 @@
@DoNotInherit
abstract class HttpConnectionContext extends pekko.http.javadsl.ConnectionContext {
override final def isSecure = false
@nowarn("msg=deprecated")
override def sslConfig: Option[PekkoSSLConfig] = None
}

Expand All @@ -126,19 +130,19 @@
override final def isSecure = true

/** Java API */
@Deprecated @deprecated("here for binary compatibility", since = "Akka HTTP 10.2.0")

Check warning on line 133 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / validate-links

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 133 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 8)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 133 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 11)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")
def getEnabledCipherSuites: Optional[JCollection[String]]

/** Java API */
@Deprecated @deprecated("here for binary compatibility", since = "Akka HTTP 10.2.0")

Check warning on line 137 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / validate-links

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 137 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 8)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")

Check warning on line 137 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / Compile and test (2.13, 11)

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")
def getEnabledProtocols: Optional[JCollection[String]]

/** Java API */
@Deprecated @deprecated("here for binary compatibility", since = "Akka HTTP 10.2.0")

Check warning on line 141 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / validate-links

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")
def getClientAuth: Optional[TLSClientAuth]

/** Java API */
@Deprecated @deprecated("here for binary compatibility, not always available", since = "Akka HTTP 10.2.0")

Check warning on line 145 in http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala

View workflow job for this annotation

GitHub Actions / validate-links

Prefer the Scala annotation over Java's `@Deprecated` to provide a message and version: @deprecated("message", since = "MyLib 1.0")
def getSslContext: SSLContext

/** Java API */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ object ParserSettings extends SettingsCompanion[ParserSettings] {
*/
@Deprecated
@deprecated("Use forServer or forClient instead", since = "Akka HTTP 10.2.0")
@nowarn("msg=create overrides concrete, non-deprecated symbol")
@nowarn("msg=deprecated")
override def create(system: ActorSystem): ParserSettings = create(system.settings.config)

def forServer(system: ClassicActorSystemProvider): ParserSettings =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ class HttpExt @InternalStableApi /* constructor signature is hardcoded in Teleme
@deprecated(
"Use Http().newServerAt(...)...connectionSource() to create a source that can be materialized to a binding.",
since = "Akka HTTP 10.2.0")
@nowarn("msg=deprecated")
def bind(interface: String, port: Int = DefaultPortForProtocol,
connectionContext: ConnectionContext = defaultServerHttpContext,
settings: ServerSettings = ServerSettings(system),
Expand Down Expand Up @@ -239,7 +238,6 @@ class HttpExt @InternalStableApi /* constructor signature is hardcoded in Teleme
* use the `pekko.http.server` config section or pass in a [[pekko.http.scaladsl.settings.ServerSettings]] explicitly.
*/
@deprecated("Use Http().newServerAt(...)...bindFlow() to create server bindings.", since = "Akka HTTP 10.2.0")
@nowarn("msg=deprecated")
def bindAndHandle(
handler: Flow[HttpRequest, HttpResponse, Any],
interface: String, port: Int = DefaultPortForProtocol,
Expand Down Expand Up @@ -321,7 +319,6 @@ class HttpExt @InternalStableApi /* constructor signature is hardcoded in Teleme
* use the `pekko.http.server` config section or pass in a [[pekko.http.scaladsl.settings.ServerSettings]] explicitly.
*/
@deprecated("Use Http().newServerAt(...)...bindSync() to create server bindings.", since = "Akka HTTP 10.2.0")
@nowarn("msg=deprecated")
def bindAndHandleSync(
handler: HttpRequest => HttpResponse,
interface: String, port: Int = DefaultPortForProtocol,
Expand Down Expand Up @@ -350,7 +347,6 @@ class HttpExt @InternalStableApi /* constructor signature is hardcoded in Teleme
* Any other value for `parallelism` overrides the setting.
*/
@deprecated("Use Http().newServerAt(...)...bind() to create server bindings.", since = "Akka HTTP 10.2.0")
@nowarn("msg=deprecated")
def bindAndHandleAsync(
handler: HttpRequest => Future[HttpResponse],
interface: String, port: Int = DefaultPortForProtocol,
Expand Down Expand Up @@ -845,6 +841,7 @@ class HttpExt @InternalStableApi /* constructor signature is hardcoded in Teleme
private[http] def sslTlsServerStage(connectionContext: ConnectionContext) =
sslTlsStage(connectionContext, Server, None)

@nowarn("msg=deprecated") // TODO find an alternative way to do this
private def sslTlsStage(connectionContext: ConnectionContext, role: TLSRole, hostInfo: Option[(String, Int)]) =
connectionContext match {
case hctx: HttpsConnectionContext =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@

package org.apache.pekko.http.scaladsl.model

import java.util.OptionalLong

import language.implicitConversions
import java.io.File
import java.nio.file.{ Files, Path }
import java.lang.{ Iterable => JIterable }
import java.util.OptionalLong
import java.util.concurrent.CompletionStage

import scala.util.control.NonFatal
import scala.language.implicitConversions
import scala.annotation.nowarn
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.collection.immutable
import scala.util.control.NonFatal

import org.apache.pekko
import pekko.actor.ClassicActorSystemProvider
import pekko.annotation.{ DoNotInherit, InternalApi }
import pekko.util.ByteString
import pekko.stream.scaladsl._
import pekko.stream.stage._
Expand All @@ -37,16 +41,10 @@ import pekko.http.impl.util.JavaMapping.Implicits._
import pekko.util.FutureConverters._
import pekko.util.OptionConverters._

import java.util.concurrent.CompletionStage

import pekko.actor.ClassicActorSystemProvider
import pekko.annotation.{ DoNotInherit, InternalApi }

/**
* Models the entity (aka "body" or "content") of an HTTP message.
*/
sealed trait HttpEntity extends jm.HttpEntity {
import language.implicitConversions
private implicit def completionStageCovariant[T, U >: T](in: CompletionStage[T]): CompletionStage[U] =
in.asInstanceOf[CompletionStage[U]]

Expand Down Expand Up @@ -662,6 +660,7 @@ object HttpEntity {
private var maxBytes = -1L
private var bytesLeft = Long.MaxValue

@nowarn("msg=deprecated") // Attributes.getFirst is deprecated, but we need to use it here
override def preStart(): Unit = {
_attributes.getFirst[SizeLimit] match {
case Some(limit: SizeLimit) if limit.isDisabled =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ final class RouteAdapter(val delegate: pekko.http.scaladsl.server.Route) extends
scalaFlow(system, materializer).asJava

override def handler(system: ClassicActorSystemProvider): Function[HttpRequest, CompletionStage[HttpResponse]] = {
import pekko.http.impl.util.JavaMapping._
import pekko.util.FutureConverters._
val scalaFunction = scaladsl.server.Route.toFunction(delegate)(system)
request => (scalaFunction(request.asScala): Future[HttpResponse]).asJava
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ abstract class RouteDirectives extends RespondWithDirectives {
* Handle the request using a function.
*/
def handleSync(handler: pekko.japi.function.Function[HttpRequest, HttpResponse]): Route = {
import pekko.http.impl.util.JavaMapping._
RouteAdapter { ctx => FastFuture.successful(RouteResult.Complete(handler(ctx.request).asScala)) }
}

Expand Down
4 changes: 0 additions & 4 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ object Common extends AutoPlugin {
// Can be removed when we drop support for Scala 2.12:
"-Wconf:msg=object JavaConverters in package collection is deprecated:s",
"-Wconf:msg=is deprecated \\(since 2\\.13\\.:s",
// tolerate deprecations from Akka 2.6.0 until Pekko 1.1.x where we clean up
"-Wconf:cat=deprecation&msg=since Akka 2\\.6\\.:s",
// tolerate deprecations from Akka HTTP 10.2.0 until Pekko 1.1.x where we clean up
"-Wconf:cat=deprecation&msg=since Akka HTTP 10\\.2\\.:s",
"-Wconf:msg=reached max recursion depth:s",
"-release:8"),
scalacOptions ++= onlyOnScala2(Seq(
Expand Down
Loading