Make sure you have the latest version of the scala plugin.

And I'd rather ask such questions on the Intellij issue tracker.
Akka itself is doing the right thing as you mentioned... :)


-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 16 October 2016 at 15:49:51, Chuanlei Ni (nichuan...@gmail.com) wrote:

HI,

I copy the code example from introduction of akka-http (
http://doc.akka.io/docs/akka/2.4/scala/http/introduction.html)
I manage the project by maven, and the pom.xml is

<dependencies>
    <dependency>
        <groupId>com.typesafe.play</groupId>
        <artifactId>twirl-api_2.11</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-http-experimental_2.11</artifactId>
        <version>2.4.11</version>
    </dependency>
</dependencies>

and some plugins for scala and twirl are ignored.
The code is as follows

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer

import scala.io.StdIn


object Main{
  def main(args : Array[String]): Unit ={
    implicit val system = ActorSystem("my-system")
    implicit val materializer = ActorMaterializer()
    // needed for the future flatMap/onComplete in the end
    implicit val ec = system.dispatcher
    val RESOURCE_DIR = "spark/deploy/master/webui"
    val STATIC_RESOURCE_DIR = "spark/deploy/static"
    val route =
      path("world"){
        get{
          *complete(HttpEntity(ContentTypes.`text/html(UTF-8)`,
html.Hello.render("Jake").toString()))*
        }
      } ~
      path("hello") {
        get {
          *complete(HttpEntity(ContentTypes.`text/html(UTF-8)`,
html.Hello.render("Jake").toString()))*
        }~
          pathPrefix("static") {
            getFromResourceDirectory(STATIC_RESOURCE_DIR)
          } ~
          getFromResourceDirectory(RESOURCE_DIR)
      }
    val bindingFuture = Http().bindAndHandle(route, "localhost", 8080)

    println(s"Server online at http://localhost:8080";)
    StdIn.readLine() // let it run until user presses return
  }
}


But, some error hints appear in my intellj idea

Type mismatch, expected: ToResponseMarshallable, actual: HttpEntity.Strict
for

*complete(HttpEntity(ContentTypes.`text/html(UTF-8)`,
html.Hello.render("Jake").toString()))*


However, I can run this webservice without any error.

I also try to cast HttpEntity to ToResponseMarshallable, but the conversion
is forbidden

What shall I do to clear the error hint in intellj idea?

Thanks in advance.















--
>>>>>>>>>> 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.

Reply via email to