dave08
11/11/2018, 12:20 PMdave08
11/11/2018, 2:23 PMwithTestApplication
and multiple connectors (and testing on port), how will the test know how to request from a particular port?cy
11/12/2018, 12:47 PM1.0.0-beta-4
has been published
- kotlinx.coroutines 1.0.1
- ktor client improvements
- per-call memory consumption optimizations
- eliminated I/O errors logging in Netty
- fixed hanging compression feature with HTML/writeTo
- MockEngine improvements, moved to ktor-client-mock
- cookies handling fixes
- other minor bugfixes and improvementsMarc Knaup
11/12/2018, 5:26 PMDima Avdeev
11/13/2018, 2:09 AMjeggy
11/13/2018, 9:40 AMrusshwolf
11/14/2018, 3:14 AMLucas Borges
11/14/2018, 10:28 AMSergio Casero
11/14/2018, 6:54 PMdave08
11/15/2018, 5:00 PMPOST
requests with specified [path] receiving request body content of type [R]
*/
@ContextDsl
@JvmName("postTyped")
inline fun <reified R : Any> Route.post(
path: String,
crossinline body: suspend PipelineContext<Unit, ApplicationCall>.(R) -> Unit
): Route {
return route(path, HttpMethod.Post) {
handle {
body(call.receive())
}
}
}
/**
* Builds a route to match POST
requests
*/
@ContextDsl
fun Route.post(body: PipelineInterceptor<Unit, ApplicationCall>): Route {
return method(HttpMethod.Post) { handle(body) }
}
```
Shouldn't the second also do call.receive()
?serebit
11/16/2018, 3:10 AMrocketraman
11/17/2018, 4:06 PM"DefaultDispatcher-worker-5" - Thread t@95
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked <1c724d56> (a sun.nio.ch.Util$3)
- locked <2daa5d57> (a java.util.Collections$UnmodifiableSet)
- locked <69cba374> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.selectNow(SelectorImpl.java:105)
at io.ktor.network.selector.ActorSelectorManager.process(ActorSelectorManager.kt:76)
at io.ktor.network.selector.ActorSelectorManager$process$1.invokeSuspend(ActorSelectorManager.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
at kotlinx.coroutines.DispatchedTask$DefaultImpls.run(Dispatched.kt:235)
at kotlinx.coroutines.DispatchedContinuation.run(Dispatched.kt:81)
at kotlinx.coroutines.scheduling.Task.run(Tasks.kt:94)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:732)
Locked ownable synchronizers:
- None
"DefaultDispatcher-worker-5" - Thread t@78
java.lang.Thread.State: TIMED_WAITING
at sun.misc.Unsafe.park(Native Method)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:338)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.doPark(CoroutineScheduler.kt:835)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.cpuWorkerIdle(CoroutineScheduler.kt:813)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:721)
Locked ownable synchronizers:
- None
It isn't executing any application code, just continuously parking/unparking, AFAICT. How can I tell what is going on here and why this has happened?gabin
11/17/2018, 4:56 PMfrellan
11/19/2018, 8:53 AMenleur
11/19/2018, 4:08 PMenleur
11/19/2018, 6:28 PMImproved performancewhere can I read more about this?
serebit
11/19/2018, 8:17 PMsteamstreet
11/19/2018, 11:15 PM/api/something
and it will automatically resolve from the page's host?anidotnet
11/20/2018, 4:56 AMTim Büthe
11/20/2018, 8:46 AMshopodg
11/20/2018, 9:12 AMhdarritchon
11/20/2018, 1:21 PMSaša Šijak
11/20/2018, 5:17 PMdave08
11/20/2018, 5:23 PMrobin
11/21/2018, 9:29 AMhdarritchon
11/21/2018, 10:57 AMNir Golan
11/21/2018, 11:45 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?v79
11/21/2018, 1:19 PMfun Routing.customer() { get("/customer") {... } }
and fun Routing.admin() { get("/admin") {...} }
and then call each of them inside Application.mainModule() ...
? Any way of using classes instead of top-level functions?arocnies
11/21/2018, 3:05 PMgabin
11/21/2018, 4:17 PMgabin
11/21/2018, 4:17 PMcy
11/21/2018, 4:18 PMHttpRedirect
featuregabin
11/21/2018, 4:20 PMcy
11/21/2018, 4:21 PMgabin
11/21/2018, 4:21 PMcy
11/21/2018, 4:22 PMfollowRedirects
settinggabin
11/21/2018, 4:26 PMcy
11/21/2018, 4:27 PMgabin
11/21/2018, 4:27 PMcy
11/21/2018, 4:28 PMgabin
11/21/2018, 4:29 PMe5l
11/21/2018, 4:33 PMgabin
11/21/2018, 4:33 PMe5l
11/21/2018, 4:35 PMgabin
11/21/2018, 4:35 PMe5l
11/21/2018, 4:43 PMgabin
11/21/2018, 4:48 PMe5l
11/21/2018, 4:52 PMval client = HttpClient {
...
install(HttpCookies)
}
gabin
11/21/2018, 4:54 PMe5l
11/22/2018, 6:00 AM1.0.1
releasegabin
11/22/2018, 8:23 AM