All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.lsdconsulting.interceptors.http.LsdRestTemplateCustomizer.kt Maven / Gradle / Ivy

Go to download

Provides various interceptors to capture events for the lsd-core library to generate sequence diagrams

There is a newer version: 8.0.73
Show newest version
package io.lsdconsulting.interceptors.http

import org.springframework.boot.web.client.RestTemplateCustomizer
import org.springframework.http.client.BufferingClientHttpRequestFactory
import org.springframework.http.client.ClientHttpRequestInterceptor
import org.springframework.http.client.SimpleClientHttpRequestFactory
import org.springframework.web.client.RestTemplate

data class LsdRestTemplateCustomizer(
    private var interceptor: ClientHttpRequestInterceptor
) : RestTemplateCustomizer {

    override fun customize(restTemplate: RestTemplate) {
        val interceptors = restTemplate.interceptors
        if (!interceptors.contains(interceptor)) {
            interceptors.add(interceptor)
        }
        restTemplate.requestFactory = BufferingClientHttpRequestFactory(SimpleClientHttpRequestFactory())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy