LoginSignup
5
5

More than 5 years have passed since last update.

Finagleのバージョンを上げる

Last updated at Posted at 2016-01-19

com.twitter.finagle.httpがだいぶ活躍する印象。

前提

  • 6.28から6.31へ上げる
  • Scalaは2.11.7

build.sbt

  • build.sbtのfinagle-coreとfinagle-httpのバージョンを6.31.+に変更
  • finagle-httpxはエラーが出たため、試しに削除。問題なく動作
  • twitter-serverは1.13のままだとエラーが出たので、1.16.+に変更

ソースコード

  • 今までHttpRequest, HttpResponseだったところはhttp.Request, http.Responseに変更(com.twitter.finagle.httpのimportが必要)。

    • メソッドもかなり変わっている
    • 記述が簡単になっているところが多いが、逆に面倒になっている場合もある

      response.getContent.toString(Charsets.Utf8)
      

      response.getContentString()
      
      new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, urlParam)
      

      val req:http.Request = http.RequestBuilder.safeBuilder(http.RequestBuilder.create().url(urlParam))
      req.version = http.Version.Http11
      
  • HTTPステータスコードが「HttpResponseStatus.NOT_FOUND」のように書いていた部分が「http.Status.NotFound」のようになる。

5
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5