Search in sources :

Example 1 with RequestEnrichingInterceptor

use of com.hotels.styx.proxy.interceptors.RequestEnrichingInterceptor in project styx by ExpediaGroup.

the class BuiltInInterceptors method internalStyxInterceptors.

static List<HttpInterceptor> internalStyxInterceptors(StyxConfig config, HttpMessageFormatter httpMessageFormatter) {
    List<HttpInterceptor> builder = new ArrayList<>();
    boolean loggingEnabled = config.get("request-logging.inbound.enabled", Boolean.class).orElse(false);
    boolean longFormatEnabled = config.get("request-logging.inbound.longFormat", Boolean.class).orElse(false);
    if (loggingEnabled) {
        builder.add(new HttpMessageLoggingInterceptor(longFormatEnabled, httpMessageFormatter));
    }
    builder.addAll(asList(new TcpTunnelRequestRejector(), new ConfigurationContextResolverInterceptor(EMPTY_CONFIGURATION_CONTEXT_RESOLVER), new UnexpectedRequestContentLengthRemover(), config.proxyServerConfig().via().map(ViaHeaderAppendingInterceptor::new).orElseGet(ViaHeaderAppendingInterceptor::new), new HopByHopHeadersRemovingInterceptor(), new RequestEnrichingInterceptor(config.styxHeaderConfig())));
    return List.copyOf(builder);
}
Also used : ConfigurationContextResolverInterceptor(com.hotels.styx.proxy.interceptors.ConfigurationContextResolverInterceptor) TcpTunnelRequestRejector(com.hotels.styx.proxy.interceptors.TcpTunnelRequestRejector) HttpInterceptor(com.hotels.styx.api.HttpInterceptor) ArrayList(java.util.ArrayList) UnexpectedRequestContentLengthRemover(com.hotels.styx.proxy.interceptors.UnexpectedRequestContentLengthRemover) HopByHopHeadersRemovingInterceptor(com.hotels.styx.proxy.interceptors.HopByHopHeadersRemovingInterceptor) ViaHeaderAppendingInterceptor(com.hotels.styx.proxy.interceptors.ViaHeaderAppendingInterceptor) HttpMessageLoggingInterceptor(com.hotels.styx.proxy.interceptors.HttpMessageLoggingInterceptor) RequestEnrichingInterceptor(com.hotels.styx.proxy.interceptors.RequestEnrichingInterceptor)

Aggregations

HttpInterceptor (com.hotels.styx.api.HttpInterceptor)1 ConfigurationContextResolverInterceptor (com.hotels.styx.proxy.interceptors.ConfigurationContextResolverInterceptor)1 HopByHopHeadersRemovingInterceptor (com.hotels.styx.proxy.interceptors.HopByHopHeadersRemovingInterceptor)1 HttpMessageLoggingInterceptor (com.hotels.styx.proxy.interceptors.HttpMessageLoggingInterceptor)1 RequestEnrichingInterceptor (com.hotels.styx.proxy.interceptors.RequestEnrichingInterceptor)1 TcpTunnelRequestRejector (com.hotels.styx.proxy.interceptors.TcpTunnelRequestRejector)1 UnexpectedRequestContentLengthRemover (com.hotels.styx.proxy.interceptors.UnexpectedRequestContentLengthRemover)1 ViaHeaderAppendingInterceptor (com.hotels.styx.proxy.interceptors.ViaHeaderAppendingInterceptor)1 ArrayList (java.util.ArrayList)1