https://kotlinlang.org logo
#kotless
Title
# kotless
g

gumil

06/18/2020, 7:10 PM
Are there good documentation on how to use
@Post
usin kotless dsl?
I want to know specifically how to handle form parameters or json body text
t

TanVD

06/18/2020, 7:15 PM
To get body you can access context directly: https://github.com/JetBrains/kotless/wiki/Kotless-HTTP-API#context
g

gumil

06/18/2020, 7:42 PM
can you help me make sense of this error
Copy code
java.lang.IllegalStateException: STREAMED
	at org.eclipse.jetty.server.Request.getReader(Request.java:1178)
	at io.kotless.local.handler.DynamicHandler.handle(DynamicHandler.kt:40)
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:501)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
	at java.base/java.lang.Thread.run(Thread.java:834)
it happens when i add a form url encoded parameter.
Is you repository open? Or do you have any reproducible example
It is possible that I have misconfigured Jetty for local start here. Most likely you would not get this problem during cloud run
The problem itself is that for some reason request stream was read two times.
g

gumil

06/18/2020, 8:08 PM
oh, thanks for the help, it works when using json body. i'll stick to it for a while and try running in cloud for forms
t

TanVD

06/18/2020, 9:08 PM
Oh, ok 🙂
5 Views