@Override
    public boolean applyFilterToCamelHeaders(String headerName, Object headerValue, Exchange exchange) {
        boolean answer = super.applyFilterToCamelHeaders(headerName, headerValue, exchange);
        // using rest producer then headers are mapping to uri and query parameters using {key} syntax
        // if there is a match to an existing Camel Message header, then we should filter (=true) this
        // header as its already been mapped by the RestProducer from camel-core, and we do not want
        // the header to included as HTTP header also (eg as duplicate value)
        if (!answer) {
            if (templateUri != null) {
                String token = "{" + headerName + "}";
                if (templateUri.contains(token)) {
                    answer = true;
                }
            }
            if (!answer && queryParameters != null) {
                String[] tokens = new String[4];
                tokens[0] = "={" + headerName + "}";
                tokens[1] = "={" + headerName + "?}";
                tokens[2] = "=%7B" + headerName + "%7D";
                tokens[3] = "=%7B" + headerName + "%3F%7D";
                for (String token : tokens) {
                    if (queryParameters.contains(token)) {
                        answer = true;
                        break;
                    }
                }
            }
        }
        return answer;
    }
@Test
    public void shouldDecideOnApplingHeaderFilterToTemplateTokens() {
        final HttpRestHeaderFilterStrategy strategy = new HttpRestHeaderFilterStrategy(
                "{uriToken1}{uriToken2}",
                "q1=%7BqueryToken1%7D%26q2=%7BqueryToken2%3F%7D%26");

        assertTrue(strategy.applyFilterToCamelHeaders("uriToken1", "value", NOT_USED));
        assertTrue(strategy.applyFilterToCamelHeaders("uriToken2", "value", NOT_USED));
        assertTrue(strategy.applyFilterToCamelHeaders("queryToken1", "value", NOT_USED));
        assertTrue(strategy.applyFilterToCamelHeaders("queryToken2", "value", NOT_USED));
        assertFalse(strategy.applyFilterToCamelHeaders("unknown", "value", NOT_USED));
    }