Search in sources :

Example 1 with SanitisedHttpHeaderFormatter

use of com.hotels.styx.common.format.SanitisedHttpHeaderFormatter in project styx by ExpediaGroup.

the class StyxServerComponents method newEnvironment.

private static Environment newEnvironment(StyxConfig config, MeterRegistry registry) {
    SanitisedHttpHeaderFormatter headerFormatter = new SanitisedHttpHeaderFormatter(config.get("request-logging.hideHeaders", List.class).orElse(emptyList()), config.get("request-logging.hideCookies", List.class).orElse(emptyList()));
    SanitisedHttpMessageFormatter sanitisedHttpMessageFormatter = new SanitisedHttpMessageFormatter(headerFormatter);
    return new Environment.Builder().configuration(config).registry(registry).buildInfo(readBuildInfo()).eventBus(new AsyncEventBus("styx", newSingleThreadExecutor())).httpMessageFormatter(sanitisedHttpMessageFormatter).build();
}
Also used : StartupConfig.newStartupConfigBuilder(com.hotels.styx.StartupConfig.newStartupConfigBuilder) SanitisedHttpHeaderFormatter(com.hotels.styx.common.format.SanitisedHttpHeaderFormatter) SanitisedHttpMessageFormatter(com.hotels.styx.common.format.SanitisedHttpMessageFormatter) AsyncEventBus(com.google.common.eventbus.AsyncEventBus)

Example 2 with SanitisedHttpHeaderFormatter

use of com.hotels.styx.common.format.SanitisedHttpHeaderFormatter in project styx by ExpediaGroup.

the class NettyToStyxRequestDecoderTest method decode.

private LiveHttpRequest decode(HttpRequest request) {
    HttpRequestRecorder requestRecorder = new HttpRequestRecorder();
    HttpMessageFormatter formatter = new SanitisedHttpMessageFormatter(new SanitisedHttpHeaderFormatter(Arrays.asList("secret-header"), Arrays.asList("secret-cookie")));
    EmbeddedChannel channel = new EmbeddedChannel(new NettyToStyxRequestDecoder.Builder().uniqueIdSupplier(uniqueIdSupplier).httpMessageFormatter(formatter).build(), requestRecorder);
    channel.writeInbound(request);
    return requestRecorder.styxRequest;
}
Also used : HttpMessageFormatter(com.hotels.styx.common.format.HttpMessageFormatter) SanitisedHttpMessageFormatter(com.hotels.styx.common.format.SanitisedHttpMessageFormatter) SanitisedHttpHeaderFormatter(com.hotels.styx.common.format.SanitisedHttpHeaderFormatter) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) SanitisedHttpMessageFormatter(com.hotels.styx.common.format.SanitisedHttpMessageFormatter)

Aggregations

SanitisedHttpHeaderFormatter (com.hotels.styx.common.format.SanitisedHttpHeaderFormatter)2 SanitisedHttpMessageFormatter (com.hotels.styx.common.format.SanitisedHttpMessageFormatter)2 AsyncEventBus (com.google.common.eventbus.AsyncEventBus)1 StartupConfig.newStartupConfigBuilder (com.hotels.styx.StartupConfig.newStartupConfigBuilder)1 HttpMessageFormatter (com.hotels.styx.common.format.HttpMessageFormatter)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1