https://kotlinlang.org logo
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
  • b

    bkenn

    02/04/2018, 3:38 AM
    How can i pass properties to the conf file?
    o
    • 2
    • 2
  • h

    hallvard

    02/05/2018, 7:18 AM
    Is there a shorthand to get the contents of an http POST operation in a map? I use the same procedure as the example linked from http://ktor.io/samples/post.html, but find it unneccessary to iterate over a MultipartData structure to get my values. Changing the content type from form-data to x-www-form-urlencoded doesn't help, I still don't find a simple
    toMap()
    . Am I missing something?
    c
    o
    d
    • 4
    • 12
  • t

    trathschlag

    02/05/2018, 9:53 AM
    Is there any way to react to a client closing a connection? My use case is doing some heavy calculations on request and then sending a small result. I would like to immediately stop the calculations when the client closes the connection.
    c
    • 2
    • 5
  • e

    elizarov

    02/07/2018, 1:06 PM
    There is a proposal to change the default log level for
    CallLogging
    Ktor feature to
    INFO
    and use
    INFO
    as a default log threshold in all the sample log configuration files. So, by default,
    INFO
    ,
    WARN
    , and
    ERROR
    will get printed. The idea that you should see all the requests in your logs and if you want to get more detailed logs (
    DEBUG
    or
    TRACE
    ) from certain subsystems/parts of your Ktor app, then you can go and turn on finer-grained logging level for those subsystems. What do you think? What is you experience with logging level?
    h
    s
    d
    • 4
    • 4
  • m

    Michael Kotlikov

    02/07/2018, 9:52 PM
    any benefits to use Application.main() over embeddedServer() or vice versa?
    o
    d
    • 3
    • 3
  • m

    mbickel

    02/09/2018, 2:14 PM
    I've trouble finding a way to end processing. I'm using a
    post()
    handler, go through all the multiparts and if I find a
    FileItem
    , I store it, send a redirect and want to be done. Of course, if there's none, I want to redirect back to the main site. But my code always runs into the second redirect (in addition to the first one).
    c
    • 2
    • 2
  • m

    Michael Kotlikov

    02/11/2018, 12:09 AM
    is this deprecated now with ktor
    0.9.1
    ?
    fun main(args: Array<String>) {
        val server = embeddedServer(Netty, commandLineEnvironment(args))
        server.start()
    }
    c
    • 2
    • 3
  • a

    aeruhxi

    02/12/2018, 8:23 AM
    Does
    call.receive<SomeDataClass>()
    parse json string?
    📝 1
    g
    • 2
    • 38
  • l

    lifk

    02/12/2018, 9:03 PM
    Hi, can ktor-client use socks5 proxies or it depends on jetty/apache etc?
    c
    e
    • 3
    • 4
  • n

    neworldlt

    02/13/2018, 8:29 PM
    What is best approach to handle exception for various accept content types? For example, if client asks
    application/json
    , I would like serialize exception using gson. If client asks
    text/html
    , then simple html page and for
    text/plain
    print only message.
    g
    c
    • 3
    • 5
  • d

    Dan T

    02/13/2018, 11:40 PM
    is there a recommended way to intercept the response across all routes? i'd like to audit the response information, and have access to an injected service. (basically i want to use an audit service i've defined and log the response information).
    c
    • 2
    • 3
  • e

    everald

    02/14/2018, 9:55 AM
    I was just setting up a new project with
    ktor-auth-jwt
    as a dependecy and I now wonder why I have a transitive dependency for
    ktor-server-test-host
    . I searched among the dependency tree and found that
    ktor-auth
    declares it. Excluding it within my build file would be an option but is there any need for this to be not declared as
    testCompile
    ?
    c
    • 2
    • 1
  • a

    adeln

    02/17/2018, 10:16 AM
    Hey folks! What kind of analytics service you would recommend to use with ktor?
    m
    • 2
    • 1
  • m

    miha-x64

    02/18/2018, 4:24 PM
    Sometimes I'm getting this:
    [nettyWorkerPool-3-1] WARN  i.n.channel.DefaultChannelPipeline - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
    java.nio.channels.ClosedChannelException: null
    	at io.netty.channel.AbstractChannel$AbstractUnsafe.write(...)(Unknown Source)
    Which is the correct way to set an exception handler to Netty while using ktor?
    o
    • 2
    • 3
  • m

    Michael Kotlikov

    02/18/2018, 11:05 PM
    I guess I should just use
    newSingleThreadContext()
    instead? https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md#dispatchers-and-threads
    o
    • 2
    • 2
  • m

    Michael Kotlikov

    02/19/2018, 2:26 AM
    It would be great if I could pass in an existing
    GsonBuilder
    and not only configure it in the
    gson
    block:
    install(ContentNegotiation) (
      gson {
        setDateFormat(DateFormat.LONG)
      }
    }
    like this:
    install(ContentNegotiation) (
      gson(existingGsonBuilder)
    }
    o
    • 2
    • 3
  • z

    Zaid

    02/19/2018, 5:03 PM
    I am new with ktor , Below is the nodejs code to return response with status code and json string (working fine and response is getting captured at client side)
    res.status(200).json({"message":"foo","something":"something"})
    I am trying to reproduce the same functionality with ktor and below is what i tried and it is not getting captured at client side, can someone please help me to wright it in ktor (in single line if possible )
    call.response.status(HttpStatusCode.OK)
    val item = ResponseJson("foo"  , "something")
    call.respond(item)
    c
    x
    • 3
    • 11
  • t

    tjb

    02/20/2018, 8:25 PM
    no main manifest attribute, in /my_app.jar
    was the error
    r
    m
    • 3
    • 52
  • h

    hallvard

    02/20/2018, 9:43 PM
    Seems ktor's
    StatusPages
    do not implement the 418 status code ... Outrageous!
    😞 1
    k
    • 2
    • 1
  • s

    spand

    02/22/2018, 3:33 PM
    If I have a routing setup and I cant figure out why something doesnt match.. what is the easiest way to debug it ?
    o
    • 2
    • 4
  • r

    ribesg

    02/24/2018, 11:03 AM
    Ok so I need
    resource("/{...}", "static/index.html")
    . My problem was that I was trying to use
    resource("*", "static/index.html")
    or
    resource("/*", "static/index.html")
    , but it doesn't work as
    /*
    matches
    /a
    but not
    /a/b
    . Something like
    /**
    would make much more sense than
    /{...}
    imho
    o
    r
    • 3
    • 6
  • j

    jkbbwr

    02/27/2018, 11:34 AM
    Anyone know how I can expose members to routes / application?
    c
    • 2
    • 8
  • r

    ribesg

    02/27/2018, 3:32 PM
    How do you configure timeouts on the ktor http client?
    c
    d
    • 3
    • 15
  • j

    jkbbwr

    02/27/2018, 8:27 PM
    Anyway to apply SSL / config to embedded config
    o
    • 2
    • 2
  • r

    rpalcolea

    02/27/2018, 11:48 PM
    Hi, is there an opinionated way to implement health checks ?
    o
    • 2
    • 1
  • j

    joshr

    02/28/2018, 5:02 AM
    oh, i think i got it
    :rubber_duck: 1
    a
    z
    • 3
    • 2
  • f

    frellan

    03/01/2018, 8:58 PM
    I have a vue-js app that is bundled together with webpack yes, I keep that in a separate folder and serve that folder as a static asset. What happens when CORS is not enabled at all? When it is not I can use relative paths but I cannot let another host call the server from javascript (which makes sense, that is how it should be) but when I enable CORS to give access to my javascript host, why is the self hosted javascript site then denied access? Do you have something I can look at concerning the webpack issue?
    o
    c
    • 3
    • 53
  • a

    aeruhxi

    03/02/2018, 6:07 AM
    is ping/pong in websocket handled automatically in ktor?
    o
    c
    • 3
    • 4
  • g

    gaetan

    03/02/2018, 11:32 AM
    I have a problem with paths. I want to make a redirect from
    /path
    to ‘/path/’ because the HTML returned by ‘/path/’ has some relative paths for images, css, … But when I declare theses 2 paths in
    routing
    , ktor seems to make no difference between them.
    o
    • 2
    • 15
  • g

    gin

    03/04/2018, 12:36 PM
    I've tried "compile project(':ktor-features:ktor-html-builder')"
    m
    • 2
    • 2
Powered by Linen
Title
g

gin

03/04/2018, 12:36 PM
I've tried "compile project(':ktor-features:ktor-html-builder')"
m

miha-x64

03/04/2018, 12:44 PM
compile "io.ktor:ktor-html-builder:$ktor_version"
g

gin

03/04/2018, 12:51 PM
Thx!
View count: 1