Hi there, I just copy pasted the file and have to say "it works here". Are you sure you have dependencies for akka-http-experimental in your build?
It works since ContentTypes is part of the akka.http.scaladsl.model package, and that we've imported all the symbols from at the top of the file: import akka.http.scaladsl.model._ Hope this helps. -- Konrad `ktoso` Malawski Akka <http://akka.io> @ Lightbend <http://lightbend.com> On 26 July 2016 at 21:14:29, Ajinkya Shukla (ajinkyashukl...@gmail.com) wrote: 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. object WebServer { 8. def main(args: Array[String]) { 9. implicit val system = ActorSystem("my-system") 10. implicit val materializer = ActorMaterializer() 11. // needed for the future flatMap/onComplete in the end 12. implicit val executionContext = system.dispatcher 13. val route = 14. path("hello") { 15. get { 16. complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to akka-http</h1>")) 17. } 18. } 19. val bindingFuture = Http().bindAndHandle(route, "localhost", 8080 ) 20. println(s"Server online at http://localhost:8080/\nPress RETURN to stop...") 21. StdIn.readLine() // let it run until user presses return 22. bindingFuture 23. .flatMap(_.unbind()) // trigger unbinding from the port 24. .onComplete(_ => system.terminate()) // and shutdown when done 25. } 26. } 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- >>>>>>>>>> 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+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.