addamsson
11/13/2018, 8:17 AMDashishmakov
11/13/2018, 8:29 AMreflection
to change the value of val
variable? I use Java 8 right now but reflection
is not pure trick for Java 11 for example.addamsson
11/13/2018, 8:34 AMaddamsson
11/13/2018, 8:34 AMaddamsson
11/13/2018, 8:41 AMDashishmakov
11/13/2018, 8:43 AMaddamsson
11/13/2018, 8:44 AMaddamsson
11/13/2018, 8:44 AMaddamsson
11/13/2018, 8:44 AMmp
11/13/2018, 2:54 PMkatsharp
11/13/2018, 2:56 PMjchildress
11/13/2018, 3:05 PMaddamsson
11/13/2018, 3:08 PMaddamsson
11/13/2018, 3:08 PMchristophsturm
11/13/2018, 3:24 PMfred.deschenes
11/13/2018, 3:33 PMShawn
11/13/2018, 3:33 PMfrellan
11/13/2018, 5:11 PMfrellan
11/13/2018, 5:12 PMnwh
11/13/2018, 6:03 PMNir Golan
11/21/2018, 11:49 AMpackage com.example
import io.ktor.application.*
import io.ktor.response.*
import io.ktor.request.*
import io.ktor.routing.*
import io.ktor.http.*
import io.ktor.gson.*
import io.ktor.features.*
import io.ktor.client.*
import io.ktor.client.features.json.*
import io.ktor.client.request.*
import java.net.URL
import kotlinx.coroutines.*
fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
@Suppress("unused") // Referenced in application.conf
@kotlin.jvm.JvmOverloads
fun Application.module(testing: Boolean = false) {
install(ContentNegotiation) {
gson {
}
}
val client = HttpClient() {
install(JsonFeature) {
serializer = GsonSerializer()
}
}
runBlocking {
// Sample for making a HTTP Client request
// /*
// val message = <http://client.post|client.post><JsonSampleClass> {
// url(URL("<http://127.0.0.1:8080/path/to/endpoint>"))
// contentType(ContentType.Application.Json)
// body = JsonSampleClass(hello = "world")
// }
// */
}
routing {
get("/") {
call.respondText("HELLO WORLD!", contentType = ContentType.Text.Plain)
}
get("/json/gson") {
call.respond(mapOf("hello" to "world"))
}
}
}
data class JsonSampleClass(val hello: String)
when i'm commenting out the client its working, can any one help?
Slack Conversationemily
11/21/2018, 7:54 PMmartinh
11/21/2018, 8:43 PMNir Golan
11/22/2018, 5:47 AMclient
wasn't in, added one and all good, still its very strange that the ktor template come unfinished...emily
11/22/2018, 11:46 AMNir Golan
11/22/2018, 11:50 AMBernhard
11/22/2018, 8:06 PMBernhard
11/22/2018, 8:07 PMBernhard
11/22/2018, 8:07 PMJared
11/26/2018, 1:01 PM