Hi! , I have a Route where if a function finds a data in the DB responds a 
value of type Json, 
when it does not find the value it responds with null and therefore the 
complete responds null. 
I want to validate this so that it does not respond null, but a String that 
says: "Not found", this is my route, any help? Thanks

val route = pathPrefix("auth") {
  path("signIn") {
    pathEndOrSingleSlash {
      post {
        entity(as[LoginPassword]) { loginPassword =>
          val a = signIn(loginPassword.login, 
loginPassword.password).map(_.asJson)
           if(signIn(loginPassword.login, loginPassword.password).map(_.asJson) 
== null){
             complete(states.map(_.asJson))
           }else {
             def getObject : Option[Any] = Option(signIn(loginPassword.login, 
loginPassword.password).map(_.asJson))
             val ahh = signIn(loginPassword.login, 
loginPassword.password).map(_.asJson)
             if(getObject.isEmpty || getObject == null){ ///////NOT FOUND
               complete("Not Found")
             }else {
               complete(complete(signIn(loginPassword.login, 
loginPassword.password).map(_.asJson))
             }
             //complete(signIn(loginPassword.login, 
loginPassword.password).map(_.asJson))
           }
        }
      }
    }
  } 


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