Patrick C.
Patrick C.

Reputation: 1429

Ways to call a java filter inside a Apache Camel processor

I would like to ask about if there is a way to call a Filter (javax.servlet.Filter) inside an Apache Camel processor.

Scenario
Inside an Apache Camel Processor (org.apache.camel.Processor), I need to make use of some existing Filter class to perform some logics on the request.

import org.apache.camel.Exchange;
import org.apache.camel.Processor;

public class TestProcessor implements Processor {
    @Override
    public void process(Exchange exchange) throws Exception {
    RequestParameters parameters = exchange.getIn().getBody(RequestParameters.class);
    ...
    ......

    // Can we call an existing Filter class here?
    // e.g. addInfoFilter.doFilter(request, response, filterChain)

    ...
    ......

    exchange.getIn().setBody(requestParams);
}

I'm not sure how this could be achieved. Please let me know if you have any insights, thanks.

Upvotes: 0

Views: 613

Answers (1)

Patrick C.
Patrick C.

Reputation: 1429

It seems it is not possible to call a filter inside a Camel processor. Probably the best (or only way) is to intercept the request with the filter, using configuration in web.xml.

Upvotes: 0

Related Questions