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

net.optionfactory.spring.upstream.scopes.UpstreamHttpExchangeAdapterAdapter Maven / Gradle / Ivy

There is a newer version: 20.1
Show newest version
package net.optionfactory.spring.upstream.scopes;

import java.util.function.Supplier;
import net.optionfactory.spring.upstream.contexts.InvocationContext;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.service.invoker.HttpExchangeAdapter;
import org.springframework.web.service.invoker.HttpRequestValues;

public class UpstreamHttpExchangeAdapterAdapter implements HttpExchangeAdapter {

    private final UpstreamHttpExchangeAdapter inner;
    private final Supplier invocation;

    public UpstreamHttpExchangeAdapterAdapter(UpstreamHttpExchangeAdapter inner, Supplier invocation) {
        this.inner = inner;
        this.invocation = invocation;
    }

    @Override
    public boolean supportsRequestAttributes() {
        return inner.supportsRequestAttributes(invocation.get());
    }

    @Override
    public void exchange(HttpRequestValues requestValues) {
        inner.exchange(invocation.get(), requestValues);
    }

    @Override
    public HttpHeaders exchangeForHeaders(HttpRequestValues requestValues) {
        return inner.exchangeForHeaders(invocation.get(), requestValues);
    }

    @Override
    public  T exchangeForBody(HttpRequestValues requestValues, ParameterizedTypeReference bodyType) {
        return inner.exchangeForBody(invocation.get(), requestValues, bodyType);
    }

    @Override
    public ResponseEntity exchangeForBodilessEntity(HttpRequestValues requestValues) {
        return inner.exchangeForBodilessEntity(invocation.get(), requestValues);
    }

    @Override
    public  ResponseEntity exchangeForEntity(HttpRequestValues requestValues, ParameterizedTypeReference bodyType) {
        return inner.exchangeForEntity(invocation.get(), requestValues, bodyType);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy