https://kotlinlang.org logo
Title
g

gschulze

06/30/2019, 10:37 AM
I have a rather specific question. Would it be possible from a technical perspective to "mount" a Ktor application at a specific path, e.g. "/dashboard1", inside a host application? I know I can achieve something similar by just writing an application module, but I'd prefer complete isolation of application features. If this is possible, could anyone outline the necessary steps, e.g. custom ApplicationEnvironment, etc. to achieve this? Many thanks in advance!
g

gildor

06/30/2019, 2:01 PM
You can do this by configuring some proxy and reroute requests to particular Ktor application
c

cy

07/01/2019, 11:32 AM
complete isolation of application features
Do you mean running in separate processes? Os some kind isolation like running inside of an OSGi container?
g

gschulze

07/01/2019, 12:00 PM
Right now I load those modules from separate JAR files, each with its own classloader. I got it working in the meantime by providing my own NestedApplicationCall implementation, with which I call the execute() method of the mounted application. I could share my code if there is any interest in including this functionality in the core framework.
c

cy

07/01/2019, 4:17 PM
Why do you need this nested application call?
I would use separate environemnts with different root paths instead
g

gschulze

07/03/2019, 3:23 PM
I already used the root path you mentioned in my own implementation of ApplicationEnvironment. I had to provide a custom ApplicationCall implementation as well, because the class carries the application instance as an attribute.