Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

finatra 六歩目

More than 3 years have passed since last update.

外部通信

http通信は以下のとおり。
httpsはoverride val sslHostname = ""を追加して色々試してるけどエラーになってよくわからん。

import com.twitter.finagle.builder.{ClientBuilder, ServerBuilder}
import com.twitter.finagle.http._
import com.twitter.finatra.http.Controller
import com.twitter.finatra.httpclient.modules.HttpClientModule
import com.twitter.finatra.json.FinatraObjectMapper

// ~中略~

  get("/api/request") { request: Request =>

    val httpClientModule = new HttpClientModule() {
      val dest = "fscoward.hateblo.jp:80"
      override val hostname = "fscoward.hateblo.jp:80"
    }
    val req = Request.apply(Version.Http11, Method.Get, "/")

    val httpClient = httpClientModule.provideHttpClient(FinatraObjectMapper.create(), httpClientModule.provideHttpService)
    for {
      r <- httpClient.execute(req)
    } yield {
      r
    }
  }

もしくは

↓でもいける

    val http = com.twitter.finagle.Http
    http.fetchUrl("http://fscoward.hateblo.jp")
FScoward
i love sphere !!! http://www.planet-sphere.jp/main.php 元海岸沿いのSIer/現オフィス内に海岸のある某社 https://github.com/FScoward
http://fscoward.hateblo.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away