aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-jooby/src
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-10-12 18:22:43 +0200
committerRobert Jaros <rjaros@finn.pl>2019-10-12 18:22:43 +0200
commitbcf7504392baccf1568e740c1d453eac7080fb5b (patch)
tree519489751032814bfc0d5426c48de257b788329f /kvision-modules/kvision-server-jooby/src
parent28b6e9d646123d774660ebdf0124eeb8a22fe087 (diff)
downloadkvision-bcf7504392baccf1568e740c1d453eac7080fb5b.tar.gz
kvision-bcf7504392baccf1568e740c1d453eac7080fb5b.tar.bz2
kvision-bcf7504392baccf1568e740c1d453eac7080fb5b.zip
Redesign spring-boot server module to use Spring WebFlux instead of Spring MVC.
Diffstat (limited to 'kvision-modules/kvision-server-jooby/src')
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt23
1 files changed, 22 insertions, 1 deletions
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 4c4d4af0..e2a26967 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -21,6 +21,7 @@
*/
package pl.treksoft.kvision.remote
+import com.fasterxml.jackson.databind.module.SimpleModule
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.google.inject.Injector
import kotlinx.coroutines.CoroutineStart
@@ -37,7 +38,14 @@ import org.jooby.Request
import org.jooby.Response
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import pl.treksoft.kvision.types.*
import kotlin.reflect.KClass
+import java.time.LocalDateTime
+import java.time.LocalDate
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
/**
* Multiplatform service manager for Jooby.
@@ -51,7 +59,20 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
}
val routes: MutableList<Kooby.() -> Unit> = mutableListOf()
- val mapper = jacksonObjectMapper()
+ val mapper = jacksonObjectMapper().apply {
+ val module = SimpleModule()
+ module.addSerializer(LocalDateTime::class.java, LocalDateTimeSerializer())
+ module.addSerializer(LocalDate::class.java, LocalDateSerializer())
+ module.addSerializer(LocalTime::class.java, LocalTimeSerializer())
+ module.addSerializer(OffsetDateTime::class.java, OffsetDateTimeSerializer())
+ module.addSerializer(OffsetTime::class.java, OffsetTimeSerializer())
+ module.addDeserializer(LocalDateTime::class.java, LocalDateTimeDeserializer())
+ module.addDeserializer(LocalDate::class.java, LocalDateDeserializer())
+ module.addDeserializer(LocalTime::class.java, LocalTimeDeserializer())
+ module.addDeserializer(OffsetDateTime::class.java, OffsetDateTimeDeserializer())
+ module.addDeserializer(OffsetTime::class.java, OffsetTimeDeserializer())
+ this.registerModule(module)
+ }
var counter: Int = 0
/**