aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-ktor/src/main/kotlin
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-02-18 17:10:10 +0100
committerRobert Jaros <rjaros@finn.pl>2019-02-18 17:10:10 +0100
commit667b3f983a3a77865e4fb89c0cf531ce982904ac (patch)
treea65572ca6ee9ee728d8fbe8b50bc18d866316cfb /kvision-modules/kvision-server-ktor/src/main/kotlin
parent29f0867506334d0f7387f654e7d84b6840a1ad86 (diff)
downloadkvision-667b3f983a3a77865e4fb89c0cf531ce982904ac.tar.gz
kvision-667b3f983a3a77865e4fb89c0cf531ce982904ac.tar.bz2
kvision-667b3f983a3a77865e4fb89c0cf531ce982904ac.zip
Make kvision-remote module independent of kvision itself.
Change the default JSON serialization format of Date objects (plain long value).
Diffstat (limited to 'kvision-modules/kvision-server-ktor/src/main/kotlin')
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt6
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt6
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt2
3 files changed, 2 insertions, 12 deletions
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt
index 4ca27ebd..fef3c3c6 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt
@@ -37,14 +37,10 @@ import io.ktor.http.content.static
import io.ktor.jackson.jackson
import io.ktor.routing.routing
import io.ktor.util.AttributeKey
-import pl.treksoft.kvision.types.KV_JSON_DATE_FORMAT
-import java.text.SimpleDateFormat
fun Application.kvisionInit(vararg modules: Module) {
install(ContentNegotiation) {
- jackson {
- dateFormat = SimpleDateFormat(KV_JSON_DATE_FORMAT)
- }
+ jackson()
}
routing {
static("/") {
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 4b67bf43..d4985adf 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -36,8 +36,6 @@ import io.ktor.util.pipeline.PipelineContext
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import pl.treksoft.kvision.types.KV_JSON_DATE_FORMAT
-import java.text.SimpleDateFormat
import kotlin.reflect.KClass
/**
@@ -58,9 +56,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
val optionsRequests: MutableMap<String, suspend PipelineContext<Unit, ApplicationCall>.(Unit) -> Unit> =
mutableMapOf()
- val mapper = jacksonObjectMapper().apply {
- dateFormat = SimpleDateFormat(KV_JSON_DATE_FORMAT)
- }
+ val mapper = jacksonObjectMapper()
var counter: Int = 0
/**
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index 86fab30a..b1f72d6f 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -25,8 +25,6 @@ import java.text.SimpleDateFormat
actual val KV_DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"
-actual val KV_JSON_DATE_FORMAT = "yyyy-MM-dd HH:mm:ssZ"
-
actual typealias Date = java.util.Date
actual fun String.toDateF(format: String): Date = SimpleDateFormat(format).parse(this)