首页 文章
  • 4 votes
     answers
     views

    如何在使用Dispatch和Scala时打印http请求

    当我使用Dispatch库和Scala时,出于调试目的,如何在写完这样的语句之后用文本中的 Headers 等打印出整个HTTP请求? val svc = url("http://api.hostip.info/country.php")
  • 1 votes
     answers
     views

    Scala Dispatch简单获取请求

    我试图用Scala Dispatch执行一个简单的GET请求,但是我错了404错误 . 意外的响应状态:404 这是一个有效的例子: https://www.google.com/finance/info?infotype=infoquoteall&q=tsla,goog 但我对我的错误在我的代码中的位置感到惊讶 import dispatch._ , Defaults._ objec...
  • 2 votes
     answers
     views

    在“Dispatch”库中等待超时响应

    我将使用Dispatch编写一个简单的HTTP客户端 . 我打电话给 dispatch.Http 以获得未来并致电未来以获得回应 val request = ... val future = Http(request) // call the server asynchronously val response = future() // wait for the response from th...
  • 1 votes
     answers
     views

    我该如何等待scala dispatch(0.11.0)http get请求完成?

    我正在使用scala dispatch(0.11.0)库向远程服务器发送HTTP GET请求 . 我想在执行请求之后的代码之前等待响应 . 我的要求是: val req = :/("myurl.com") <:< myheaders OK as.Response(identity) 如果我写: val future = http(req) future() var...
  • 7 votes
     answers
     views

    Scala Dispatch库:如何处理连接失败或超时?

    我一直在客户端使用Databinder Dispatch库来创建一个简单的REST-ish API . 我知道如何检测我是否收到错误状态的HTTP响应: Http x (request) { case (200, _, _, content) => successResult(content()) case (404, _, _, _) => notFoundError...
  • 2 votes
     answers
     views

    Databinder调度:获取403响应的未压缩内容

    只要Web服务器返回404,我就使用数据 Binders 调度来发出很好的HTTP请求 . 如果请求失败,Web服务器将返回403状态代码,并在响应正文中以XML格式提供详细的错误消息 . 如何读取xml主体(不管403),例如如何进行调度忽略所有403错误? 我的代码看起来像这样: class HttpApiService(val apiAccount:ApiAccount) extends A...
  • 0 votes
     answers
     views

    超时如何在Dispatch中工作

    在API,有: val http = Http.configure(_ .setConnectionTimeoutInMs(1) ) 这个配置是什么?我用它: .setMaxRequestRetry(0) 我打了很长时间后我将失败的未来 . 未来我这样创造: val f = http(u OK as.String) f.map { NotificationClientC...

热门问题