akka spray:java.lang.IllegalArgumentException:要求失败

我是akka喷雾中的新人:)

我有这个路由器演员:

class ProjectResource extends HttpServiceActor with DefaultJsonFormats  {
  import spray.http.MediaTypes.`application/json`

  def receive = runRoute {
    pathPrefix("rest" / "1.2") {
      path("users" / Segment / "projects" / Segment / "auth_url") { 
        case (key, id) =>
          get {
            respondWithMediaType(`application/json`) {
              requestContext =>
                val responder = context actorOf Responder.props(sender(), requestContext)
                context actorOf GetTask.props(key, id, responder)
            }
          }
      }
    }
  }
}

和响应者:

class Responder(replyTo: ActorRef, ctx: RequestContext) extends Actor with DefaultJsonFormats {
  implicit val authFormat = jsonFormat2(AuthDTO)

  def receive = {
    case x: AuthDTO =>
      ctx.complete(200, x)
      context stop self
  }
}

当我试图

卷曲-v http://localhost:8080/rest/1.2/users/123/projects/1/auth_url

我收到此错误(在ctx.complete(200,x)字符串...):

[ERROR] [07/11/2016 18:40:32.954] [default-akka.actor.default-dispatcher-3] [akka://default/user/projectResource] Error during processing of request HttpRequest(GET,http://localhost:8080/rest/1.2/users/123/projects/1/auth_url,List(User-Agent: curl/7.35.0, Host: localhost:8080),Empty,HTTP/1.1)
  java.lang.IllegalArgumentException: requirement failed

我做错了什么?请帮忙!

回答(0)