Merge pull request #19815 from ktoso/wip-fixups-for-2.12.0-M3-ktoso
=htc make HTTP compile under Scala 2.12.0-M3
This commit is contained in:
commit
06e17602ef
5 changed files with 32 additions and 20 deletions
|
|
@ -32,7 +32,7 @@ public final class CacheDirectives {
|
|||
public static final CacheDirective MUST_REVALIDATE = akka.http.scaladsl.model.headers.CacheDirectives.must$minusrevalidate$.MODULE$;
|
||||
|
||||
public static CacheDirective NO_CACHE(String... fieldNames) {
|
||||
return akka.http.scaladsl.model.headers.CacheDirectives.no$minuscache$.MODULE$.apply(fieldNames);
|
||||
return akka.http.scaladsl.model.headers.CacheDirectives.no$minuscache$.MODULE$.apply(akka.japi.Util.immutableSeq(fieldNames));
|
||||
}
|
||||
public static final CacheDirective PUBLIC = akka.http.scaladsl.model.headers.CacheDirectives.getPublic();
|
||||
public static CacheDirective PRIVATE(String... fieldNames) {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ object CacheDirectives {
|
|||
|
||||
// http://tools.ietf.org/html/rfc7234#section-5.2.1.4
|
||||
case object `no-cache` extends SingletonValueRenderable with RequestDirective with ResponseDirective {
|
||||
@varargs def apply(fieldNames: String*): `no-cache` = apply(immutable.Seq(fieldNames: _*))
|
||||
def apply(fieldNames: String*): `no-cache` = new `no-cache`(immutable.Seq(fieldNames: _*))
|
||||
}
|
||||
|
||||
// http://tools.ietf.org/html/rfc7234#section-5.2.1.5
|
||||
|
|
@ -97,11 +97,11 @@ object CacheDirectives {
|
|||
// http://tools.ietf.org/html/rfc7234#section-5.2.2.6
|
||||
final case class `private`(fieldNames: immutable.Seq[String]) extends FieldNamesDirective with ResponseDirective
|
||||
object `private` {
|
||||
@varargs def apply(fieldNames: String*): `private` = apply(immutable.Seq(fieldNames: _*))
|
||||
def apply(fieldNames: String*): `private` = new `private`(immutable.Seq(fieldNames: _*))
|
||||
}
|
||||
|
||||
/** Java API */
|
||||
@varargs def createPrivate(fieldNames: String*): ResponseDirective = `private`.apply(immutable.Seq(fieldNames: _*))
|
||||
@varargs def createPrivate(fieldNames: String*): ResponseDirective = new `private`(immutable.Seq(fieldNames: _*))
|
||||
|
||||
// http://tools.ietf.org/html/rfc7234#section-5.2.2.7
|
||||
case object `proxy-revalidate` extends SingletonValueRenderable with ResponseDirective
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@ object FastFuture {
|
|||
def isCompleted = true
|
||||
def result(atMost: Duration)(implicit permit: CanAwait) = a
|
||||
def ready(atMost: Duration)(implicit permit: CanAwait) = this
|
||||
def transform[S](f: scala.util.Try[A] => scala.util.Try[S])(implicit executor: scala.concurrent.ExecutionContext): scala.concurrent.Future[S] =
|
||||
FastFuture(f(Success(a)))
|
||||
def transformWith[S](f: scala.util.Try[A] => scala.concurrent.Future[S])(implicit executor: scala.concurrent.ExecutionContext): scala.concurrent.Future[S] =
|
||||
new FastFuture(this).transformWith(f)
|
||||
}
|
||||
private case class ErrorFuture(error: Throwable) extends Future[Nothing] {
|
||||
def value = Some(Failure(error))
|
||||
|
|
@ -87,6 +91,10 @@ object FastFuture {
|
|||
def isCompleted = true
|
||||
def result(atMost: Duration)(implicit permit: CanAwait) = throw error
|
||||
def ready(atMost: Duration)(implicit permit: CanAwait) = this
|
||||
def transform[S](f: scala.util.Try[Nothing] => scala.util.Try[S])(implicit executor: scala.concurrent.ExecutionContext): scala.concurrent.Future[S] =
|
||||
FastFuture(f(Failure(error)))
|
||||
def transformWith[S](f: scala.util.Try[Nothing] => scala.concurrent.Future[S])(implicit executor: scala.concurrent.ExecutionContext): scala.concurrent.Future[S] =
|
||||
new FastFuture(this).transformWith(f)
|
||||
}
|
||||
|
||||
implicit class EnhancedFuture[T](val future: Future[T]) extends AnyVal {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue