Akka HTTP模糊隐式转换

时间:2015-09-03 07:52:48

标签: scala rest akka-stream akka-http

我正在使用此example来切断Akka HTTP。出于学习目的,我将其转换为Maven项目。但是,我使用Akka v2.3.12和Akka Stream v1.0获得如下编译错误。 POST DSL因类似错误而失败,我不会为了简洁而发布。我怎样才能让这个例子运行?

pathPrefix("ip") {
(get & path(Segment)) { ip =>
  complete {
    fetchIpInfo(ip).map[ToResponseMarshallable] {
      case Right(ipInfo) => ipInfo
      case Left(errorMessage) => BadRequest -> errorMessage
    }
  }
}
[ERROR]  found   : akka.http.scaladsl.server.Directive[(String,)]
[ERROR]  required: ?{def apply: ?}
[ERROR] Note that implicit conversions are not applicable because they are ambiguous:
[ERROR]  both method addDirectiveApply in object Directive of type [L](directive: akka.http.scaladsl.server.Directive[L])(implicit hac: akka.http.scaladsl.server.util.ApplyConverter[L])hac.In => akka.http.scaladsl.server.Route
[ERROR]  and method fromDirective in object ConjunctionMagnet of type [L, R](other: akka.http.scaladsl.server.Directive[R])(implicit join: akka.http.scaladsl.server.util.TupleOps.Join[L,R])akka.http.scaladsl.server.ConjunctionMagnet[L]{type Out = akka.http.scaladsl.server.Directive[join.Out]}
[ERROR]  are possible conversion functions from akka.http.scaladsl.server.Directive[(String,)] to ?{def apply: ?}
[ERROR]         (get & path(Segment)) { ip =>
error: akka.http.scaladsl.server.Directive[(String,)] does not take parameters
[ERROR]         (get & path(Segment)) { ip =>

0 个答案:

没有答案