From be5e8be4e0530f15fead4e190b7c18bba4a7653a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20D=C3=BCsterh=C3=B6ft?= Date: Thu, 21 Feb 2019 13:57:42 +0100 Subject: [PATCH] make objectmapper plugable --- .gitignore | 1 + src/main/kotlin/com/github/mduesterhoeft/router/ApiRequest.kt | 2 ++ .../kotlin/com/github/mduesterhoeft/router/RequestHandler.kt | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 644343cc..14670305 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ bin/ .project .classpath +*.iml .idea/ out/ diff --git a/src/main/kotlin/com/github/mduesterhoeft/router/ApiRequest.kt b/src/main/kotlin/com/github/mduesterhoeft/router/ApiRequest.kt index 065e0586..b3ea6985 100644 --- a/src/main/kotlin/com/github/mduesterhoeft/router/ApiRequest.kt +++ b/src/main/kotlin/com/github/mduesterhoeft/router/ApiRequest.kt @@ -33,4 +33,6 @@ package com.github.mduesterhoeft.router .firstOrNull { it.key.toLowerCase() == httpHeader.toLowerCase() } ?.value } + + public fun getHeader(httpHeader: String) = getHeaderCaseInsensitive(httpHeader) } \ No newline at end of file diff --git a/src/main/kotlin/com/github/mduesterhoeft/router/RequestHandler.kt b/src/main/kotlin/com/github/mduesterhoeft/router/RequestHandler.kt index 0e8c5da3..7eed1a25 100644 --- a/src/main/kotlin/com/github/mduesterhoeft/router/RequestHandler.kt +++ b/src/main/kotlin/com/github/mduesterhoeft/router/RequestHandler.kt @@ -14,7 +14,7 @@ import kotlin.reflect.jvm.reflect abstract class RequestHandler : RequestHandler { - val objectMapper: ObjectMapper = jacksonObjectMapper() + open val objectMapper = jacksonObjectMapper() override fun handleRequest(input: ApiRequest, context: Context): ApiResponse? { log.info("handling request with method '${input.httpMethod}' and path '${input.path}' - Accept:${input.acceptHeader} Content-Type:${input.contentType} $input")