https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
ktor
  • c

    Casey Brooks

    11/22/2019, 7:58 PM
    Is it possible to use the ktor HTTP client to parse x-www-form urlencoded responses to models, similar to how it parses JSON?
    m
    p
    • 3
    • 2
  • g

    gotoOla

    11/23/2019, 5:54 PM
    hey! Has anyone managed to get hot-reloading to work when you have some objects in your Application::myModule-function?
    c
    • 2
    • 4
  • t

    Timur Atakishiev

    11/24/2019, 1:04 PM
    Hi, is it any tutorial on session authentication in ktor?
    a
    • 2
    • 1
  • b

    bod

    11/24/2019, 4:20 PM
    people apparently workaround this by dispatching on the main thread but I don't think that's reasonable?
    r
    • 2
    • 2
  • g

    gotoOla

    11/24/2019, 9:46 PM
    How do people do hot reloading with parameter stuff? Do you controll all based on system.envs/properties or is there any smart way to do it? My first take was to use an object which held my dependency context but it seems that auto reloading doesn't work in those cases (I guess it's hard do to fiddle with the class loaders with the static contents)
    • 1
    • 1
  • c

    cymessmer

    11/25/2019, 8:43 PM
    I’m starting out on a new project and get to choose my framework, and I wanted to get a feel for if the community finds ktor to be production ready. The other lightweight framework/library I have in mind is vertx since it’s been around a bit longer and is backed by eclipse which is also established in a way I see as equal to jetbrains
    h
    t
    a
    • 4
    • 4
  • h

    Hexa

    11/25/2019, 9:54 PM
    anyone knows how to fix this error
    testproject_1  | java.lang.UnsatisfiedLinkError: no netty_transport_native_epoll_x86_64 in java.library.path
    testproject_1  | 	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    testproject_1  | 	at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    testproject_1  | 	at java.lang.System.loadLibrary(System.java:1122)
    testproject_1  | 	at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
    testproject_1  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    testproject_1  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    testproject_1  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    testproject_1  | 	at java.lang.reflect.Method.invoke(Method.java:498)
    testproject_1  | 	at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:369)
    testproject_1  | 	at java.security.AccessController.doPrivileged(Native Method)
    testproject_1  | 	at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:361)
    testproject_1  | 	at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:339)
    testproject_1  | 	at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136)
    testproject_1  | 	at io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:186)
    testproject_1  | 	at io.netty.channel.epoll.Native.<clinit>(Native.java:57)
    testproject_1  | 	at io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:38)
    testproject_1  | 	at io.ktor.server.netty.EventLoopGroupProxy$Companion.create(NettyApplicationEngine.kt:186)
    testproject_1  | 	at io.ktor.server.netty.NettyApplicationEngine.<init>(NettyApplicationEngine.kt:74)
    testproject_1  | 	at io.ktor.server.netty.Netty.create(Embedded.kt:14)
    testproject_1  | 	at io.ktor.server.netty.Netty.create(Embedded.kt:12)
    testproject_1  | 	at io.ktor.server.engine.EmbeddedServerKt.embeddedServer(EmbeddedServer.kt:79)
    testproject_1  | 	at com.mycomp.tst.service.AppKt.main(App.kt:18)
    c
    • 2
    • 2
  • l

    Lauritz Hilsøe

    11/26/2019, 9:59 AM
    Hi, I have the same problem as this issue https://github.com/ktorio/ktor/issues/1058 - I have an endpoint for receiving form data but I can easily receive data above 65kb, how can I increase this limit? Only solution I've found involves using internal APIs
    c
    • 2
    • 17
  • p

    Patrick Jackson

    11/26/2019, 6:06 PM
    I'm perplexed with behavior here:
    val byteArray = ByteArray(throwable.response.content.availableForRead)
    response.content.readfully(response.content.availableForRead)
    val text = String(byteArray, 0, byteArray.size, Charsets.UTF_8)
    When debugging and stepping through it reads the response fine. Without stepping through
    text
    is an empty String. Seems like a race condition. Will
    readFully
    stream the complete content? Or is there some sort of waiting that must be done for the request to complete?
    • 1
    • 2
  • h

    Hexa

    11/27/2019, 6:48 AM
    what does
    @Suppress("unused")
    do here
    @Suppress("unused") // Referenced in application.conf
    fun Application.module()
    a
    • 2
    • 1
  • r

    ribesg

    11/27/2019, 2:04 PM
    Anyone tried uploading very big files from ios using Ktor? Looks like nothing is happening. It’s just hanging
    • 1
    • 1
  • c

    Cyberpunk Keanu

    11/28/2019, 1:24 PM
    Hello, is there a way to make a RestAPI in Ktor but it uses an SQL Database ?
    a
    p
    • 3
    • 2
  • a

    Andrey Tarasevich

    11/28/2019, 1:32 PM
    Hi! I have a question regarding call logging in Ktor (1.2.4). When a request comes with 'bad' json, i.e. some fields are missing and deserializaition is failing, then with
    CallLogging
    feature the bad request message is logged to the default level setup in CallLoggin feature configuration. So if I have a default level
    INFO
    then I'll see something like this in logs
    {
      "level": "INFO",
      "logger": "Application",
      "message": "400 Bad Request: POST - <routing_path>"
    }
    Is there a way to change the logging level of such request? Even if I do something like this in the
    CallLogging
    configuration, the log level is still a default one, i.e.
    INFO
    in my case
    filter { call ->
       val status = call.response.status()?.value
       level = Level.WARN
       status !in (200..399)
    }
    m
    • 2
    • 3
  • g

    george_racu

    11/28/2019, 2:25 PM
    Hello everyone, a beginner's question: Do we have an app startup hook that we can use to load some data in a database? Or is there such a functionality built into Ktor? Thanks 🙂
    s
    • 2
    • 4
  • h

    Hexa

    11/28/2019, 6:57 PM
    What's the process for turning 'http' into an 'https' for my Ktor service?
    b
    • 2
    • 3
  • j

    Joris

    11/29/2019, 10:38 AM
    Hi guys, I'm using Ktor as a server, for contentNegotiation I'm using jackson and I was wondering how can we add custom ContentType to make jackson accept for example
    application/vnd.api+json
    that in the end is also Json ? My current settings for ContentNegotiation
    install(ContentNegotiation) {
        jackson {
            enable(SerializationFeature.INDENT_OUTPUT)
            disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
            registerKotlinModule()
        }
    }
    t
    • 2
    • 2
  • a

    andreasmattsson

    11/29/2019, 1:01 PM
    Hi there! New to Ktor. Is there a particular reason all the base64 methods have been marked as internal or hidden? does there exist a public version somewhere else I'm just missing? https://github.com/ktorio/ktor/blob/master/ktor-utils/common/src/io/ktor/util/Base64.kt
    e
    • 2
    • 1
  • n

    neil

    11/29/2019, 9:22 PM
    Does anyone use opentracing with ktor? I have looked online but I only see two libraries that don't seem under active development
    f
    • 2
    • 1
  • i

    ivano

    12/01/2019, 12:55 PM
    My question is how can I use Vuejs instead of Freemarker?
    r
    e
    • 3
    • 5
  • j

    Jørund Amsen

    12/02/2019, 12:32 PM
    So I can't seem to get
    install(CORS){
       host("*.<http://somedomain.com|somedomain.com>")
    }
    to work, does it not support the
    *.
    notation?
    j
    • 2
    • 12
  • g

    gotoOla

    12/03/2019, 5:21 PM
    stupid question but how do I get the body of a failed request when using the ktor-client? E.g. The server logic looks like this:
    this.context.respond(status = HttpStatusCode.BadRequest, message = "My custom message")
    But when performing a request with the ktor-client in a test I can't get that custom message
    val response = <http://client.post|client.post>("<http://localhost:8080/test>") { body = "invalidBody" } // If this returns a 400
    response.readText() // I'm not able to receive the body "My custom message" from this readText()
    d
    • 2
    • 4
  • c

    Cyberpunk Keanu

    12/04/2019, 7:08 AM
    Would someone please tell me why my most basic of the basic Ktor server doesn't run? 🤷‍♀️
    d
    m
    e
    • 4
    • 3
  • r

    Robert Menke

    12/05/2019, 6:23 PM
    Curious, is the whole Jetbrains Space back-end a ktor app?
    c
    t
    g
    • 4
    • 6
  • r

    René

    12/06/2019, 8:53 PM
    I'm using ktor client and am wondering why two calls of
    httpClient.get<some data class>
    are working but one is throwing
    No transformation found: class <http://kotlinx.coroutines.io|kotlinx.coroutines.io>.ByteBufferChannel -> class my.data.Class
    • 1
    • 2
  • g

    Gerard Klijs

    12/06/2019, 11:29 PM
    Anyone here who might have tries using graphQL with ktor like with https://github.com/excitement-engineer/ktor-graphql ? Maybe start experimenting with graphql soon.
    m
    • 2
    • 2
  • s

    Shan

    12/07/2019, 2:01 AM
    Does anyone have an example of how to receive Server-Sent Events with Ktor's HttpClient? I see how to set them up on the server-end, but am unsure how to do it when receiving from a server (not using Ktor) that I request events from with a header.
    j
    • 2
    • 4
  • r

    Rodrigo Silva

    12/08/2019, 2:17 PM
    How do you implemente hateoas with ktor?
    s
    s
    m
    • 4
    • 7
  • i

    izyaboi

    12/09/2019, 11:54 AM
    hello, i have one question how can i stop my http apache server instance?
    m
    • 2
    • 1
  • c

    coderskitchen

    12/09/2019, 12:31 PM
    Hi! I have a question about the routing. I want to achieve something similar to
    routing {
      route("/accounts") {
        param("name") {
          get {
            findAccountsByName(...)
          }
      }
      get {
        findAllAccounts()
      }
    }
    so that a GET /accounts?name=me would execute findAccountsByName(...) and GET /accounts would execute findAllAccounts() Apparently it always executes findAllAccounts(). Any idea why?
    s
    • 2
    • 2
  • l

    Luiz Aguiar

    12/10/2019, 2:01 PM
    Hi folks! Is there a scheduler feature for Ktor? didn't find anything in the documentation.
    m
    • 2
    • 3
Powered by Linen
Title
l

Luiz Aguiar

12/10/2019, 2:01 PM
Hi folks! Is there a scheduler feature for Ktor? didn't find anything in the documentation.
m

Matteo Mirk

12/11/2019, 1:47 PM
not provided by Ktor, I think you should just use coroutines or a library built on it. If you want you can even use Java’s
ScheduledExecutorService
l

Luiz Aguiar

12/11/2019, 2:56 PM
@Matteo Mirk any sample on how to achieve this with coroutines?
m

Matteo Mirk

12/11/2019, 3:15 PM
Sorry I don’t have any… I’m still studying coroutines myself 😞 Maybe these simple extensions could be of some use? https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.concurrent/java.util.-timer/index.html
👍 1
View count: 3