bbaldino
04/29/2020, 9:42 PMJettyApplicationEngine
, but didn't find much on how to use it.Grantas33
04/30/2020, 1:06 PMIvan Brko
04/30/2020, 4:42 PM@Serializable(with = LocalDateTimeSerializer::class)
Henry
04/30/2020, 5:32 PMmaxmello
04/30/2020, 6:12 PMhttpClient = HttpClient(CIO) {
install(HttpTimeout) {
requestTimeoutMillis = 60000
}
engine {
maxConnectionsCount = 10000
endpoint.apply {
maxConnectionsPerRoute = 1000
pipelineMaxSize = 100
keepAliveTime = 5000
connectTimeout = 5000
connectRetryAttempts = 3
}
}
}
and in my request, I specifically overwrite the requestTimeout:
<http://httpClient.post|httpClient.post><MyResponse> {
url(myUrl)
contentType(ContentType.Application.Json)
timeout {
requestTimeoutMillis = TimeUnit.MINUTES.toMillis(30)
}
body = myBody
}
But I still got a coroutine TimeoutCancellationException
after 15 seconds. I then specified the engine.endpoint.requestTimeout to be longer and the Exception went away - so am I not able to overwrite the CIO engines timeout with the Timeout feature? By the Timeout feature documentation, a HttpRequestTimeoutException
should be thrown, not a Coroutine timeout exception, so it appears to get ignored. Can I overwrite the request timeout for CIO for a specific request? Or should I increase the CIO timeout a lot and then use the HttpTimeout feature to reduce it again?Colton Idle
05/01/2020, 2:58 AMImran
05/01/2020, 8:57 AMJohn O'Reilly
05/01/2020, 4:46 PMIvan Brko
05/02/2020, 5:52 AMauthenticate{
minimalRoleAllowed(Role.Admin) { //this is the call to my custom feature for authorization
get{
...
}
}
}
So what I would expect here to happen is have authentication called, and then if it passes have authorization called. But it seems, somehow, that when all the pipelines are merged authorization gets called before authentication, which is of course wrong, because I can't authorize the user if I they are not authenticated.
This is the implementation for my minimalRouteAllowed
extension method:
fun Route.minimalRoleAllowed(role: Role, build: Route.() -> Unit): Route {
val authorisedRoute = createChild(AuthorisedRouteSelector()) //AuthorisedRouteSelector just returns a selector which evaluates to RouteSelectorEvaluation.Const
application.feature(RoleAuthorization).interceptPipeline(authorisedRoute, role)
authorisedRoute.build()
return authorisedRoute
}
And this is how I'm inserting phase and intercepting in the RoleAuthorization.interceptPipeline
called above (the pipeline
here is authorizedRoute
I sent in method above):
pipeline.insertPhaseAfter(ApplicationCallPipeline.Features, authorizationPhase)
pipeline.intercept(authorizationPhase) {...
Nikola Milovic
05/02/2020, 10:28 AMlouiscad
05/02/2020, 1:35 PMCIO
, and going multiplatform.
It seems to me that ktor sever doc got a lot more love than ktor client. If that's really the case, is reducing that imbalance planned?waltermcq
05/02/2020, 9:28 PMJitesh
05/03/2020, 12:26 PM2020-05-03 17:46:18.630 [main] DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration:
2020-05-03 17:46:18.634 [main] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension.............false
2020-05-03 17:46:18.635 [main] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit......................false
2020-05-03 17:46:18.635 [main] DEBUG com.zaxxer.hikari.HikariConfig - catalog.........................none
2020-05-03 17:46:18.635 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql...............none
2020-05-03 17:46:18.635 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery.............none
2020-05-03 17:46:18.635 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout...............30000
2020-05-03 17:46:18.635 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSource......................none
2020-05-03 17:46:18.635 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName.............none
2020-05-03 17:46:18.635 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI..................none
2020-05-03 17:46:18.675 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties............{password=<masked>}
2020-05-03 17:46:18.675 [main] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................."org.postgresql.Driver"
2020-05-03 17:46:18.675 [main] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties...........{}
2020-05-03 17:46:18.675 [main] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry.............none
2020-05-03 17:46:18.675 [main] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout.....................600000
2020-05-03 17:46:18.675 [main] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout.......1
2020-05-03 17:46:18.675 [main] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries..........false
2020-05-03 17:46:18.676 [main] DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl.........................jdbc:postgresql:testDB?user=postgres;
2020-05-03 17:46:18.683 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2020-05-03 17:46:18.736 [main] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Failed to create/setup connection: FATAL: role "postgres;" does not exist
2020-05-03 17:46:18.737 [main] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Cannot acquire connection from data source
codec
05/05/2020, 4:42 AMGiovanni Alluvatti
05/05/2020, 9:52 AM@SpringBootTest
, starting up my application with a real context (no mocks); then using a TestRestTemplate
I can call my rest api exposed to <http://localhost>:{springBootRandomPort}
. Does anybody know a similar smart way to test this scenario also for a ktor + kodein app? Unfortunately I wasn't able to find any examples on official documentation.melatonina
05/05/2020, 11:49 AMIvan Brko
05/06/2020, 2:31 PMDias
05/06/2020, 3:25 PMhttpClient.get<HttpResponse>(...)
. I doesn't look that httpresponse needs to be closed, but maybe I am leaking resources somewhere?Henry
05/07/2020, 8:01 AMfun fetchInternalClientInstance() { ...I need access to application.config in here...}
on a wider point could anyone link me to some resources discussing higher level application architecture with ktor as I'm starting to get beyond what is covered by the Youkube example?Ivan Brko
05/07/2020, 12:51 PMbitkid
05/07/2020, 3:14 PMcall.respondOutputStream{ throw BlaException()}
are not recoverable, meaning that they dont get propagated to the status pages handler?Nikky
05/07/2020, 8:35 PM@KtorExperimentalLocationsAPI
warns about thatMatthieu Stombellini
05/07/2020, 10:55 PMNikky
05/08/2020, 10:10 AMkotlin.serialization
for the Sessions feature? in particular how the data class is turned into some sort of string..
whni i extend SessionStorage
to store those strings in postgres, i would like to have json or structured data instead of however it serializes fieldsRodrigo Silva
05/09/2020, 7:26 PMKirill Prybylsky
05/10/2020, 2:15 PMwebSocket("/") {
while (true) {
delay(3000)
outgoing.send(Frame.Text("hi"))
}
}
Mario Trucco
05/10/2020, 2:57 PMscheme
returned instead of version
. Is it ok if I open an issue and link it in a fix PR?Robin Larsen
05/10/2020, 9:21 PMrudolf.hladik
05/11/2020, 8:36 AMdavid.bilik
05/12/2020, 6:22 AMauth
artifact. This is my build.gradle
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
}
apply plugin: 'java'
repositories {
jcenter()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
def ktor_version = '1.3.0'
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
implementation "io.ktor:ktor-client-gson:$ktor_version"
implementation "io.ktor:ktor-client-auth:$ktor_version"
implementation "io.ktor:ktor-client-logging:$ktor_version"
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
and I am trying to use Basic authentication when making a request from the client but import io.ktor.client.features.auth.Auth
is not resolved in the IDEA even though I can see it in external libraries in the project structure. I thought that it can be related with gradle version, but I’ve updated to 6.1.1 and nothing changeddavid.bilik
05/12/2020, 6:22 AMauth
artifact. This is my build.gradle
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
}
apply plugin: 'java'
repositories {
jcenter()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
def ktor_version = '1.3.0'
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
implementation "io.ktor:ktor-client-gson:$ktor_version"
implementation "io.ktor:ktor-client-auth:$ktor_version"
implementation "io.ktor:ktor-client-logging:$ktor_version"
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
and I am trying to use Basic authentication when making a request from the client but import io.ktor.client.features.auth.Auth
is not resolved in the IDEA even though I can see it in external libraries in the project structure. I thought that it can be related with gradle version, but I’ve updated to 6.1.1 and nothing changed"io.ktor:ktor-client-auth-jvm:$ktor_version"
helps but is it necessary?