cvmocanu
09/21/2018, 12:31 PMif (AngularForwardingSelector.shouldForward(requestURI)) {
val requestDispatcher = request.getRequestDispatcher(forwardToUrl)
requestDispatcher.forward(request, response)
} else {
chain.doFilter(request, response)
}
Trying the conversion, I have 2 questions:
- does ktor have around intercerptors? If not, is there a way to stop pipeline from continuing in a before interceptor?
- does kotlin have something similar to request dispatcher (for internal forwarding)?
I tried looking into interceptors, but the documentation is slim, and I can't figure it out how to make it work.Hamza
09/22/2018, 5:56 AMrharter
09/22/2018, 8:19 PMoshai
09/22/2018, 9:09 PM4.1.24
? latest is 4.1.29
cvmocanu
09/23/2018, 12:07 PMcall.receive<List<Variable>>
It looks like the JacksonConverter ends up doing something like ``objectmapper.readValue(reader, List::class.java)``, which will obviously won't work.
It my suspicions are true, this is a big design issue in the Ktor API.
Jackson accepts a ``TypeReference`` instead of a ``Class`` precisely to suport this use case.
I guess my question is what are my options?
- writing my own converter is impossible, since I can't pass a TypeReference to call.receive
- changing the REST API is unacceptable
Is reading the request body as String and using Jackson manually my only option?vngantk
09/23/2018, 12:23 PMNikky
09/23/2018, 1:24 PMAdrianTodt
09/23/2018, 9:13 PMget("/") { _ ->
val session = call.sessions.get<DashSession>() ?: return@get call.respondRedirect("/login")
/* code */
}
octylFractal
09/23/2018, 9:40 PMApplicationCall
and use that:
fun ApplicationCall.requireSession(): DashSession? {
val session = sessions.get<DashSession>()
if (session == null) respondRedirect("/login")
return session
}
use it like this:
val session = call.requireSession() ?: return@get
Nikky
09/25/2018, 9:37 PM[
and ]
in the redirects, making apache httpclient itself barf
and trying to handle itmyself by encoding the characters in a RedirectFeature seems to only result in double encoding of the url and gets me a error xml
<https://files.forgecdn.net/files/2574/880/BiblioCraft[v2.4.5][MC1.12.2].jar>
Hamza
09/26/2018, 2:45 AMintercept(ApplicationCallPipeline.Features) {
if (call.sessions.get<ChatSession>() == null) {
call.sessions.set(ChatSession(nextNonce()))
}
}
although, the class? ApplicationCallPipeline.Features
is not found (But ApplicationCallPipeline
is.
I am lead to believe that i am missing some dependency which contains this, but i am not entirely sure which one.
here are my ependencies:
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "io.ktor:ktor-server-netty:$ktor_version"
compile "ch.qos.logback:logback-classic:$logback_version"
compile "io.ktor:ktor-server-core:$ktor_version"
compile "io.ktor:ktor-server-host-common:$ktor_version"
compile "io.ktor:ktor-websockets:$ktor_version"
compile "io.ktor:ktor-jackson:$ktor_version"
kluck
09/26/2018, 1:06 PMhead {
styleLink(url(MainCss))
}
And for my style definition:
@Location("/styles/main.css")
object MainCss
fun Route.styles() {
get<MainCss> {
call.respond(call.resolveResource("app.css")!!)
}
}
This works correctly without SSL, but when I start using https, the browser wouldn't load my css, as it's presented using basic http (here's my response):
<head>
<link rel="Stylesheet" type="text/css" href="<http://my.domain.com/styles/main.css>">
</head>
Any idea what I should modify to make it https friendly?gotoOla
09/26/2018, 1:48 PMrocketraman
09/27/2018, 4:27 PMException in thread "main" java.lang.NoSuchMethodError: kotlinx.coroutines.experimental.ExecutorsKt.asCoroutineDispatcher(Ljava/util/concurrent/Executor;)Lkotlinx/coroutines/experimental/CoroutineDispatcher;
in JettyApplicationEngine:kt.13
Dias
09/27/2018, 9:23 PMDias
09/27/2018, 9:24 PMDias
09/28/2018, 5:54 PMHullaballoonatic
09/28/2018, 11:45 PMZargorNET
09/30/2018, 6:47 PMval bytes = ByteArrayOutputStream()
val multipart = call.receiveMultipart()
multipart.forEachPart { part ->
if (part is PartData.FileItem) {
val stream = part.streamProvider()
var data = stream.read()
while (data != -1) {
bytes.write(data)
data = stream.read()
}
stream.close()
}
part.dispose()
}
jvassbo
10/01/2018, 10:47 AMMarc Knaup
10/01/2018, 9:45 PMmp
10/01/2018, 10:12 PMmp
10/02/2018, 3:50 PM./gradlew check
and it looks suspiciously like they're stuck. Does it maybe not support parallel builds? CPUs are idle, test counts aren't ticking upwards 🤔otakusenpai
10/04/2018, 12:31 AMotakusenpai
10/04/2018, 2:31 AMotakusenpai
10/04/2018, 6:46 AMmp
10/04/2018, 10:58 AMbdawg.io
10/05/2018, 4:13 AMexperimental
in the package name. If you've successfully migrated off of the deprecated APIs available in the latest coroutines release, it'll just be a dependency update, removal of enabling coroutines as experimental in your Gradle project, and migrating off of the experimental
pathyatsinar
10/05/2018, 2:31 PMjkbbwr
10/06/2018, 3:35 AM