Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@
import org.apache.camel.support.DefaultHeaderFilterStrategy;

public class Sns2HeaderFilterStrategy extends DefaultHeaderFilterStrategy {

public Sns2HeaderFilterStrategy() {
initialize();
}

protected void initialize() {
setLowerCase(true);

// filter headers begin with "Camel" or "org.apache.camel"
setOutFilterPattern("(breadcrumbId|Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
getOutFilter().add("breadcrumbId");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@
import org.apache.camel.support.DefaultHeaderFilterStrategy;

public class Sqs2HeaderFilterStrategy extends DefaultHeaderFilterStrategy {

public Sqs2HeaderFilterStrategy() {
initialize();
}

protected void initialize() {
setLowerCase(true);
// filter headers begin with "Camel" or "org.apache.camel"
setOutFilterPattern("(breadcrumbId|Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
getOutFilter().add("breadcrumbId");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void inboundAllowsNonCamelHeaders() {
@Test
void outboundFiltersCamelAndBreadcrumbHeaders() {
assertTrue(strategy.applyFilterToCamelHeaders("CamelHttpUri", "value", null));
assertTrue(strategy.applyFilterToCamelHeaders("org.apache.camel.internal", "value", null));
assertTrue(strategy.applyFilterToCamelHeaders("breadcrumbId", "value", null));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ public class ServiceBusHeaderFilterStrategy extends DefaultHeaderFilterStrategy
Date.class,
UUID.class);

public ServiceBusHeaderFilterStrategy() {
super();
setLowerCase(true);
setOutFilterStartsWith(DefaultHeaderFilterStrategy.CAMEL_FILTER_STARTS_WITH);
setInFilterStartsWith(DefaultHeaderFilterStrategy.CAMEL_FILTER_STARTS_WITH);
}

@Override
public boolean applyFilterToCamelHeaders(String headerName, Object headerValue, Exchange exchange) {
return headerValue == null || !SUPPORTED_TYPES.contains(headerValue.getClass())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
import org.apache.camel.support.DefaultEndpoint;
import org.apache.camel.support.DefaultHeaderFilterStrategy;
import org.apache.camel.support.jsse.ClientAuthentication;
import org.apache.camel.support.jsse.KeyManagersParameters;
import org.apache.camel.support.jsse.SSLContextParameters;
Expand Down Expand Up @@ -281,7 +282,7 @@ public void setClient(CoapClient client) {
@Override
public HeaderFilterStrategy getHeaderFilterStrategy() {
if (headerFilterStrategy == null) {
headerFilterStrategy = new CoAPHeaderFilterStrategy();
headerFilterStrategy = new DefaultHeaderFilterStrategy();
}
return headerFilterStrategy;
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.camel.Message;
import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.spi.Metadata;
import org.apache.camel.support.DefaultHeaderFilterStrategy;
import org.apache.camel.support.DefaultMessage;
import org.cometd.bayeux.server.ServerChannel;
import org.cometd.bayeux.server.ServerMessage;
Expand Down Expand Up @@ -57,7 +58,7 @@ public CometdBinding(BayeuxServerImpl bayeux) {
}

public CometdBinding(BayeuxServerImpl bayeux, boolean enableSessionHeader) {
this(bayeux, enableSessionHeader, new CometdHeaderFilterStrategy());
this(bayeux, enableSessionHeader, new DefaultHeaderFilterStrategy());
}

public CometdBinding(BayeuxServerImpl bayeux, boolean enableSessionHeader, HeaderFilterStrategy headerFilterStrategy) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public static void propagateCamelToCxf(

camelHeaders.entrySet().forEach(entry -> {
// Need to make sure the cxf needed header will not be filtered
if (strategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), exchange)) {
if (strategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), exchange)
&& CAMEL_TO_CXF_HEADERS.get(entry.getKey()) == null) {
LOG.trace("Drop external header: {}={}", entry.getKey(), entry.getValue());
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,8 @@ public CxfRsHeaderFilterStrategy() {
}

protected void initialize() {

getOutFilter().add(CxfConstants.OPERATION_NAME.toLowerCase());

getOutFilter().add("Content-Type".toLowerCase());
// Support to filter the Content-Type case insensitive
setLowerCase(true);

// filter headers begin with "Camel" or "org.apache.camel"
setOutFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,9 @@ protected void initialize() {
// is passed to the other endpoint
getInFilter().add("content-length".toLowerCase());

setLowerCase(true);

// initialize message header filter map with default SOAP filter
messageHeaderFiltersMap = new HashMap<>();
addToMessageHeaderFilterMap(new SoapMessageHeaderFilter());

// filter headers begin with "Camel" or "org.apache.camel"
setOutFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public GooglePubsubHeaderFilterStrategy() {
}

public GooglePubsubHeaderFilterStrategy(boolean includeAllGoogleProperties) {
setLowerCase(true);
setOutFilterStartsWith(DefaultHeaderFilterStrategy.CAMEL_FILTER_STARTS_WITH);
setInFilterStartsWith(DefaultHeaderFilterStrategy.CAMEL_FILTER_STARTS_WITH);
// Filter authorization on both directions for security
getOutFilter().add("authorization");
getInFilter().add("authorization");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ public HttpHeaderFilterStrategy() {
protected void initialize() {
final Set<String> outFilter = getOutFilter();
HttpUtil.addCommonFilters(outFilter);

setLowerCase(true);

// filter headers begin with "Camel" or "org.apache.camel"
// must ignore case for Http based transports
setOutFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public HttpProtocolHeaderFilterStrategy() {

// Just add the http headers here
protected void initialize() {
// This strategy filters HTTP protocol headers only; Camel-prefixed headers must not be blocked
// so that they survive the request-to-response copy in HttpProducer.copyHeaders.
Comment thread
ammachado marked this conversation as resolved.
setInFilterStartsWith((String[]) null);
setOutFilterStartsWith((String[]) null);

getInFilter().add("content-encoding");
getInFilter().add("content-language");
Expand Down Expand Up @@ -68,7 +72,5 @@ protected void initialize() {
getInFilter().add("www-authenticate");

HttpUtil.addCommonFilters(getInFilter());

setLowerCase(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ public HttpHeaderFilterStrategy() {
protected void initialize() {
final Set<String> outFilter = getOutFilter();
HttpUtil.addCommonFilters(outFilter);

setLowerCase(true);

// filter headers begin with "Camel" or "org.apache.camel"
// must ignore case for Http based transports
setOutFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@
*/
package org.apache.camel.http.common;

/**
* @deprecated use {@link org.apache.camel.http.base.HttpProtocolHeaderFilterStrategy} directly
*/
@Deprecated(since = "4.21")
public class HttpProtocolHeaderFilterStrategy extends org.apache.camel.http.base.HttpProtocolHeaderFilterStrategy {
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
import org.apache.camel.WrappedFile;
import org.apache.camel.component.http.helper.HttpMethodHelper;
import org.apache.camel.http.base.HttpOperationFailedException;
import org.apache.camel.http.base.HttpProtocolHeaderFilterStrategy;
import org.apache.camel.http.base.cookie.CookieHandler;
import org.apache.camel.http.common.HttpHelper;
import org.apache.camel.http.common.HttpProtocolHeaderFilterStrategy;
import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.support.DefaultProducer;
import org.apache.camel.support.ExchangeHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
import org.apache.camel.support.DefaultEndpoint;
import org.apache.camel.support.DefaultHeaderFilterStrategy;
import org.apache.iggy.client.blocking.IggyBaseClient;
import org.apache.iggy.consumergroup.ConsumerGroupDetails;
import org.apache.iggy.identifier.ConsumerId;
Expand Down Expand Up @@ -170,7 +171,7 @@ public ExecutorService createExecutor() {
@Override
public HeaderFilterStrategy getHeaderFilterStrategy() {
if (headerFilterStrategy == null) {
headerFilterStrategy = new IggyHeaderFilterStrategy();
headerFilterStrategy = new DefaultHeaderFilterStrategy();
}
return headerFilterStrategy;
}
Expand Down
Loading
Loading