@@ -29,43 +29,43 @@ import java.util.logging.Level
29
29
import java.util.logging.Logger
30
30
31
31
class ClientService
32
- @JvmOverloads
33
- constructor (
34
- val uri: String ,
35
- readTimeout: Int = DEFAULT_READ_TIMEOUT ,
36
- connectTimeout: Int = DEFAULT_CONNECT_TIMEOUT ,
37
- ) : AutoCloseable {
38
- private val mapper =
39
- jacksonObjectMapper()
40
- .setDefaultSetterInfo(JsonSetter .Value .forContentNulls(Nulls .AS_EMPTY ))
41
- .disable(DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES )
42
- .disable(SerializationFeature .WRITE_DATES_AS_TIMESTAMPS )
43
- .enable(SerializationFeature .WRITE_ENUMS_USING_TO_STRING )
44
- .enable(SerializationFeature .INDENT_OUTPUT )
32
+ @JvmOverloads
33
+ constructor (
34
+ val uri: String ,
35
+ readTimeout: Int = DEFAULT_READ_TIMEOUT ,
36
+ connectTimeout: Int = DEFAULT_CONNECT_TIMEOUT ,
37
+ ) : AutoCloseable {
38
+ private val mapper =
39
+ jacksonObjectMapper()
40
+ .setDefaultSetterInfo(JsonSetter .Value .forContentNulls(Nulls .AS_EMPTY ))
41
+ .disable(DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES )
42
+ .disable(SerializationFeature .WRITE_DATES_AS_TIMESTAMPS )
43
+ .enable(SerializationFeature .WRITE_ENUMS_USING_TO_STRING )
44
+ .enable(SerializationFeature .INDENT_OUTPUT )
45
45
46
- internal val client: Client by lazy {
47
- val config =
48
- ClientConfig ().apply {
49
- // Redirect ALL logs to SLF4J using logging.properties
50
- register(LoggingFeature (logger.apply { level = Level .ALL }, Short .MAX_VALUE .toInt()))
51
- register(JacksonJaxbJsonProvider (mapper, arrayOf(Annotations .JACKSON )))
52
- property(ClientProperties .READ_TIMEOUT , readTimeout)
53
- property(ClientProperties .CONNECT_TIMEOUT , connectTimeout)
54
- }
55
- ClientBuilder .newClient(config)
56
- }
46
+ internal val client: Client by lazy {
47
+ val config =
48
+ ClientConfig ().apply {
49
+ // Redirect ALL logs to SLF4J using logging.properties
50
+ register(LoggingFeature (logger.apply { level = Level .ALL }, Short .MAX_VALUE .toInt()))
51
+ register(JacksonJaxbJsonProvider (mapper, arrayOf(Annotations .JACKSON )))
52
+ property(ClientProperties .READ_TIMEOUT , readTimeout)
53
+ property(ClientProperties .CONNECT_TIMEOUT , connectTimeout)
54
+ }
55
+ ClientBuilder .newClient(config)
56
+ }
57
57
58
- override fun close () = client.close()
58
+ override fun close () = client.close()
59
59
60
- companion object {
61
- const val DEFAULT_READ_TIMEOUT : Int = 60000
62
- const val DEFAULT_CONNECT_TIMEOUT : Int = 60000
60
+ companion object {
61
+ const val DEFAULT_READ_TIMEOUT : Int = 60000
62
+ const val DEFAULT_CONNECT_TIMEOUT : Int = 60000
63
63
64
- init {
65
- SLF4JBridgeHandler .removeHandlersForRootLogger()
66
- SLF4JBridgeHandler .install()
67
- }
64
+ init {
65
+ SLF4JBridgeHandler .removeHandlersForRootLogger()
66
+ SLF4JBridgeHandler .install()
67
+ }
68
68
69
- private val logger = Logger .getLogger(ClientService ::class .java.canonicalName)!!
69
+ private val logger = Logger .getLogger(ClientService ::class .java.canonicalName)!!
70
+ }
70
71
}
71
- }
0 commit comments