[error] /home/arhelmus/techmedia/akka-http/src/main/scala/utils/CustomDirectives.scala:31: could not find implicit value for parameter um: akka.http.unmarshalling.FromRequestUnmarshaller[utils.Credentials]
[error] entity(as[Credentials]).flatMap { credentials =>
package utils
import akka.http.marshallers.sprayjson.SprayJsonSupport
import akka.http.server.Directive1
import models.User
import spray.json._
case class Credentials(login: String, password: String)
trait Protocols extends DefaultJsonProtocol {
implicit val formatter: RootJsonFormat[Credentials] = jsonFormat2(Credentials.apply)
}
object CustomDirectives extends CustomDirectives
trait CustomDirectives extends SprayJsonSupport with Protocols {
import akka.http.server.directives.BasicDirectives._
import akka.http.server.directives.MarshallingDirectives._
import akka.http.server.directives.ParameterDirectives._
def authenticateByToken: Directive1[User] =
parameter("token").flatMap { code =>
provide(User(code, "asdsada", "asdsadasd"))
}
def authenticateByCredentials: Directive1[User] = {
entity(as[Credentials]).flatMap { credentials =>
provide(User(credentials.login, credentials.login, credentials.password))
}
}
}
--
>>>>>>>>>> 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+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Yes I do have an implicit actor materializer in scope
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/Vhm_zkTajJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
On 23 Jul 2015, at 22:04, Kabir Idris <bink...@gmail.com> wrote:
Yes I do have an implicit actor materializer in scope
On Thu, 23 Jul 2015 6:54 pm Heiko Seeberger <loe...@posteo.de> wrote:
Do you have an implicit Materializer in scope?HeikoOn 23 Jul 2015, at 15:25, Kabir Idris <bink...@gmail.com> wrote:
Hi all, Im facing the same error in akka-http 1.0
On Monday, March 16, 2015 at 12:16:37 AM UTC+1, Arthur Kushka wrote:
Hi. I was faced with a typical error with spray-json and akka-http that easy to find in Google, but none of solutions helps me.
Scala fail compiling in place where I parsing request body with `entity` directive. As error say, they can`t find implicit value for unmarshaller, but formatter and `SprayJsonSupport` are present in context (in documentation written that that`s enough).
Below is compiler message and my code.
Please help me with finding solution of this problem.
[error] /home/arhelmus/techmedia/akka-http/src/main/scala/utils/CustomDirectives.scala:31: could notfind implicit value for parameter um:akka.http.unmarshalling.FromRequestUnmarshaller[utils.Credentials]
implicit val system = ActorSystem()
implicit val executor: ExecutionContext = system.dispatcher
val log: LoggingAdapter = Logging(system, getClass)
implicit val materializer = ActorMaterializer()
Http().bindAndHandle(routes, httpInterface, httpPort)