@Test public void shouldFilterOutEverythingButInwardContentTypeHeader() { final SyndesisHeaderStrategy headerStrategy = new SyndesisHeaderStrategy(); assertThat(headerStrategy.applyFilterToCamelHeaders("Content-Type", "", exchange)).isTrue(); assertThat(headerStrategy.applyFilterToExternalHeaders("Content-Type", "", exchange)).isFalse(); assertThat(headerStrategy.applyFilterToCamelHeaders("Host", "", exchange)).isTrue(); assertThat(headerStrategy.applyFilterToExternalHeaders("Host", "", exchange)).isTrue(); assertThat(headerStrategy.applyFilterToCamelHeaders("Forward", "", exchange)).isTrue(); assertThat(headerStrategy.applyFilterToExternalHeaders("Forward", "", exchange)).isTrue(); }
@Override public boolean applyFilterToCamelHeaders(final String headerName, final Object headerValue, final Exchange exchange) { if (isWhitelisted(exchange, headerName)) { return false; } return super.applyFilterToCamelHeaders(headerName, headerValue, exchange); }
SyndesisHeaderStrategy extends HttpHeaderFilterStrategy { @Override public boolean applyFilterToCamelHeaders(final String headerName, final Object headerValue, final Exchange exchange) { if (isWhitelisted(exchange, headerName)) { return false; } return super.applyFilterToCamelHeaders(headerName, headerValue, exchange); } }
SyndesisHeaderStrategy extends HttpHeaderFilterStrategy { @Override public boolean applyFilterToCamelHeaders(final String headerName, final Object headerValue, final Exchange exchange) { if (isWhitelisted(exchange, headerName)) { return false; } return super.applyFilterToCamelHeaders(headerName, headerValue, exchange); }  }
SyndesisHeaderStrategy extends HttpHeaderFilterStrategy { @Override public boolean applyFilterToCamelHeaders(final String headerName, final Object headerValue, final Exchange exchange) { if (isWhitelisted(exchange, headerName)) { return false; } return super.applyFilterToCamelHeaders(headerName, headerValue, exchange); }  @Override boolean applyFilterToCamelHeaders(final String headerName, final Object headerValue, final Exchange exchange); static boolean isWhitelisted(final Exchange exchange, String headerName); static void whitelist(final Exchange exchange, final Collection<String> headerNames); static void whitelist(final Exchange exchange, final String headerName); }
SyndesisHeaderStrategy extends HttpHeaderFilterStrategy { @Override public boolean applyFilterToCamelHeaders(final String headerName, final Object headerValue, final Exchange exchange) { if (isWhitelisted(exchange, headerName)) { return false; } return super.applyFilterToCamelHeaders(headerName, headerValue, exchange); }  @Override boolean applyFilterToCamelHeaders(final String headerName, final Object headerValue, final Exchange exchange); static boolean isWhitelisted(final Exchange exchange, String headerName); static void whitelist(final Exchange exchange, final Collection<String> headerNames); static void whitelist(final Exchange exchange, final String headerName); static final SyndesisHeaderStrategy INSTANCE; static final String WHITELISTED_HEADERS; }