@Heiko... please how did you solve it ?

On Tuesday, July 28, 2015 at 11:45:19 PM UTC-5, Heiko Seeberger wrote:
>
> You need to show the definition of routes. I assume (speculation again) 
> that it’s a method in a different scope which doesn’t take an implicit 
> Materializer (or EC).
>
> Heiko
>
> --
>
> *Heiko Seeberger*
> Home: heikoseeberger.de
> Twitter: @hseeberger <https://twitter.com/hseeberger>
> Public key: keybase.io/hseeberger
>
> On 28 Jul 2015, at 23:10, Harit Himanshu <[email protected] 
> <javascript:>> wrote:
>
> I have similar issue, how did you people resolve it?
>
> On Friday, July 24, 2015 at 2:19:06 AM UTC-7, Kabir Idris wrote:
>>
>> Hi Heiko, 
>> Here is my code 
>>
>>  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)
>>
>>
>>
>>
>> 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 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 [email protected] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> Visit this group at http://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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to