The minimal example give at the following
http://doc.akka.io/docs/akka/2.4.8/scala/http/routing-dsl/index.html does
not work.
It gives an error on line no 19.
Error:(19, 31) not found: value ContentTypes
complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say
hello to akka-http</h1>"))
1. import akka.actor.ActorSystem
2. import akka.http.scaladsl.Http
3. import akka.http.scaladsl.model._
4. import akka.http.scaladsl.server.Directives._
5. import akka.stream.ActorMaterializer
6. import scala.io.StdIn
7.
8. object WebServer {
9. def main(args: Array[String]) {
10.
11. implicit val system = ActorSystem("my-system")
12. implicit val materializer = ActorMaterializer()
13. // needed for the future flatMap/onComplete in the end
14. implicit val executionContext = system.dispatcher
15.
16. val route =
17. path("hello") {
18. get {
19. complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say
hello to akka-http</h1>"))
20. }
21. }
22.
23. val bindingFuture = Http().bindAndHandle(route, "localhost", 8080
)
24.
25. println(s"Server online at http://localhost:8080/\nPress RETURN
to stop...")
26. StdIn.readLine() // let it run until user presses return
27. bindingFuture
28. .flatMap(_.unbind()) // trigger unbinding from the port
29. .onComplete(_ => system.terminate()) // and shutdown when done
30. }
31. }
Can you please help me fixing the error ?
--
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.