Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save AravindaM/04cbb488faaa9425b279102340a0b2c1 to your computer and use it in GitHub Desktop.

Select an option

Save AravindaM/04cbb488faaa9425b279102340a0b2c1 to your computer and use it in GitHub Desktop.

Revisions

  1. @jarek-przygodzki jarek-przygodzki created this gist Oct 1, 2016.
    14 changes: 14 additions & 0 deletions play-ws-standalone.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    import play.api.libs.ws.ahc.AhcWSClient
    import akka.stream.ActorMaterializer
    import akka.actor.ActorSystem

    implicit val system = ActorSystem()
    implicit val materializer = ActorMaterializer()
    val ws = AhcWSClient()

    val req = ws.url("http://example.com").get().map{
    resp => resp.body
    }(system.dispatcher)

    // after all futures completed...
    ws.close()