frellan
11/01/2018, 10:48 AMval config = HoconApplicationConfig(ConfigFactory.load())
is an experimental API, what is the correct way to load the application,conf now?Vinicius Carvalho
11/01/2018, 2:03 PMdimkoss11
11/04/2018, 5:02 PMjcechace
11/05/2018, 8:09 AMdimkoss11
11/05/2018, 8:14 AMSergio Casero
11/05/2018, 10:14 AMoverride suspend fun addLocation(location: Location): Unit = <http://client.post|client.post> {
path(LOCATION)
body = location
}
It throws
java.lang.ClassCastException: com.sergiocasero.model.Location cannot be cast to io.ktor.client.call.HttpClientCall
My first impression was a problem with the serializer, but
override suspend fun getLocation(parent: Int): Location =
client.get<Location> { path("$LOCATION/$parent") }
works perfect, the model is quite simple:
@Serializable
data class Location(
val id: Int,
val parentId: Int,
val name: String
)
Any suggestions?dave08
11/05/2018, 11:10 AMRiccardo Montagnin
11/06/2018, 10:06 AMkrotki
11/06/2018, 12:37 PMException in thread "main" java.lang.NoClassDefFoundError: kotlinx/coroutines/io/ByteChannelKt
. I searched coroutines lib and I can't find this class. Is there any special dependency that I'm missing ?Tsvetozar Bonev
11/06/2018, 1:00 PMdave08
11/06/2018, 2:55 PMfun Application.main() {
routing {
get("/") {
if (call.request.local.port == 8080) {
call.respondText("Connected to public api")
} else {
call.respondText("Connected to private api")
}
}
}
}
I think no one would want to handle internal/external apis in this way... is there a way to do:
fun Application.main() {
routing {
port(8080) {
get("/") {
call.respondText("Connected to public api")
}
}
port(9090) {
get("/") {
call.respondText("Connected to private api")
}
}
}
}
?patjackson52
11/06/2018, 3:13 PMcoder82
11/06/2018, 4:37 PMtw
11/07/2018, 11:11 AMcoder82
11/07/2018, 2:21 PMgaetan
11/07/2018, 4:01 PMorangy
11/07/2018, 4:33 PMorangy
11/07/2018, 4:39 PMorangy
11/07/2018, 4:42 PMtomreay
11/07/2018, 5:38 PMproceed
and proceedWith
both take Unit
. I'm trying to read the request body in to use in request signing as part of an authorisation flow - I wonder if there is a better way of accomplishing this? (me and @twwork together - fyi)mp
11/07/2018, 6:04 PMnapperley
11/08/2018, 12:40 AMAllan Wang
11/09/2018, 2:50 AMorangy
11/09/2018, 9:34 AMorangy
11/09/2018, 9:40 AMdefaultSerializer
.enleur
11/09/2018, 9:45 AMspand
11/09/2018, 12:13 PMtweissbeck
11/09/2018, 1:39 PMadeln
11/10/2018, 7:03 AM1.0.0-beta-3
I’m getting
Exception in thread "nettyWorkerPool-3-3" java.lang.NoClassDefFoundError: Could not initialize class kotlinx.coroutines.io.ByteBufferChannel
at kotlinx.coroutines.io.ByteChannelKt.ByteChannel(ByteChannel.kt:13)
at kotlinx.coroutines.io.ByteChannelKt.ByteChannel$default(ByteChannel.kt:38)
at kotlinx.coroutines.io.ByteReadChannel$Companion$Empty$2.invoke(ByteReadChannelJVM.kt:200)
at kotlinx.coroutines.io.ByteReadChannel$Companion$Empty$2.invoke(ByteReadChannelJVM.kt:199)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at kotlinx.coroutines.io.ByteReadChannel$Companion.getEmpty(ByteReadChannelJVM.kt)
at io.ktor.server.netty.http1.NettyHttp1Handler.handleRequest(NettyHttp1Handler.kt:45)
at io.ktor.server.netty.http1.NettyHttp1Handler.channelRead(NettyHttp1Handler.kt:29)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
at io.netty.handler.codec.http.HttpServerExpectContinueHandler.channelRead(HttpServerExpectContinueHandler.java:95)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
carolos
11/10/2018, 2:35 PMcarolos
11/10/2018, 2:35 PMe5l
11/12/2018, 5:23 AMdependencies
section of your build.gradle
script?