databinder -dispatch 0.8.3を使用して、302 http応答からリダイレクトURLを取得しようとしていますが、次の例外が発生します。
Caused by: dispatch.StatusCode: Unexpected response code: 302
これが私が試みたものです、いくつかの助けを借りて:
import dispatch._
import org.apache.http.{HttpRequest,HttpResponse}
import org.apache.http.protocol.HttpContext
import org.apache.http.HttpStatus._
val http = new Http {
override def make_client = {
val client = new ConfiguredHttpClient(new Http.CurrentCredentials(None))
client.setRedirectStrategy(new org.apache.http.impl.client.DefaultRedirectStrategy {
override def isRedirected(req: HttpRequest, res: HttpResponse, ctx: HttpContext) = false
})
client
}
}
val req: Request = :/("graph.facebook.com") / "kmels" / "picture"
val pictureURL: String = http(req.secure >:> { _("Location").head }) //error prone code, but we're just testing. This is the line where the exception is thrown.
私は何が欠けていますか?いつものように、よろしくお願いします。