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

dev.vality.woody.api.interceptor.ContainerCommonInterceptor Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
package dev.vality.woody.api.interceptor;

import dev.vality.woody.api.trace.TraceData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ContainerCommonInterceptor implements CommonInterceptor {

    private static final Logger LOG = LoggerFactory.getLogger(ContainerCommonInterceptor.class);

    private RequestInterceptor requestInterceptor;
    private ResponseInterceptor responseInterceptor;

    public ContainerCommonInterceptor(RequestInterceptor requestInterceptor, ResponseInterceptor responseInterceptor) {
        this.requestInterceptor = requestInterceptor != null ? requestInterceptor : new EmptyCommonInterceptor();
        this.responseInterceptor = responseInterceptor != null ? responseInterceptor : new EmptyCommonInterceptor();
    }

    @Override
    public boolean interceptRequest(TraceData traceData, Object providerContext, Object... contextParams) {
        LOG.trace("Request interceptor container");
        return requestInterceptor.interceptRequest(traceData, providerContext, contextParams);
    }

    @Override
    public boolean interceptResponse(TraceData traceData, Object providerContext, Object... contextParams) {
        LOG.trace("Response interceptor container");
        return responseInterceptor.interceptResponse(traceData, providerContext, contextParams);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy