REST API骆驼的拦截器

时间:2020-10-21 06:01:27

标签: apache-camel spring-camel

在camelcontext中,API的定义格式为 如何为所有API REST请求编写一个通用的拦截器?

1 个答案:

答案 0 :(得分:1)

骆驼支持三种拦截器:

  1. 拦截可拦截每个处理步骤,而 在路由中路由Exchange。

  2. interceptFrom(String uri)拦截路由中的传入Exchange。

  3. interceptSendToEndpoint,在Exchange即将拦截时拦截 发送到给定的端点。

有几种方法可以为骆驼编写拦截器:

class CustomInterceptingRoute extends CustomRouteBuilder{
        void configure() {
            interceptFrom('rest:*')...
        }
    }