val responseFuture: Future[HttpResponse] = Http().singleRequest(HttpRequest(uri = uri))
responseFuture onComplete {
case Success(response) =>
val timeout = 300.millis
response.status match {
case StatusCodes.OK =>
println("printing content")
// println(response.entity.dataBytes.runForeach(println))
// println(response.entity.dataBytes.map(_.utf8String))
// response.entity.dataBytes
// .map(line => println(line))
// println(response.entity.toStrict(5 seconds).map(_.data.decodeString("UTF-8")))
// println(Unmarshal(response.entity).to[String])
// val entity = Unmarshal(response.entity).to[String]
// entity onComplete { entity =>
// println(entity)
// }
// Unmarshaller.entityToString(response.entity)
// println(PredefinedFromEntityUnmarshallers.stringUnmarshaller(response.entity))
// println(response.entity.toStrict(5 seconds).map(_.data.decodeString("UTF-8")) )
val bs: Future[ByteString] = response.entity.toStrict(timeout).map { _.data }
// val s: Future[String] = bs.map(_.utf8String)
println(bs)
case _ =>
println("failed to get dynamic url")
}
case Failure(error) =>
println(error.toString)
}
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.