khttp のソースのダウンロード
git clone https://github.com/jkcclemens/khttp.git
org.json.jar のダウンロードはこちら
Download org.json.jar
http_get.kt
// ------------------------------------------------------------------
/*
http_get.kt
Mar/04/2018
*/
// ------------------------------------------------------------------
import khttp.get
fun main(args: Array<out String>) {
println("*** 開始 ***")
val url : String = "http://httpbin.org/get"
val rr = get(url)
println(rr)
println(rr.statusCode)
println(rr.text)
println("*** 終了 ***")
}
// ------------------------------------------------------------------
Makefile
JAR=../../jar
ORG_JSON=$(JAR)/org.json.jar
http_get.jar: http_get.kt
kotlinc -cp $(ORG_JSON) http_get.kt \
khttp/KHttp.kt \
khttp/responses/Response.kt \
khttp/responses/GenericResponse.kt \
khttp/requests/Request.kt \
khttp/requests/GenericRequest.kt \
khttp/structures/cookie/Cookie.kt \
khttp/structures/cookie/CookieJar.kt \
khttp/structures/files/FileLike.kt \
khttp/structures/authorization/Authorization.kt \
khttp/structures/parameters/Parameters.kt \
khttp/structures/maps/CaseInsensitiveMap.kt \
khttp/structures/maps/CaseInsensitiveMutableMap.kt \
khttp/extensions/Extensions.kt \
-include-runtime -d http_get.jar
clean:
rm -rf http_get.jar
実行コマンド
java -jar http_get.jar