代码之家  ›  专栏  ›  技术社区  ›  Ben ODay

具有自定义http头的camel cxfrs

  •  0
  • Ben ODay  · 技术社区  · 16 年前

    from(CXF_RS_ENDPOINT_URI)
          .process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                            Message inMessage = exchange.getIn();    
                            System.out.println("headers->" + inMessage.getHeaders());
                            ...
    

    这是我的单元测试代码来模拟客户端请求。。。

        HttpGet get = new HttpGet("http://localhost:9000/rest/customerservice/customers/126");
        get.addHeader("myHeader", "1234");
        HttpClient httpclient = new DefaultHttpClient();
        HttpResponse response = httpclient.execute(get);
    

    问题是自定义头“myHeader”在我的路由中不可用。还有别的办法吗?

    通过查看camelcxf源代码,我可以看到默认的头策略/绑定逻辑只设置预定义的HTTP头。有没有其他头文件不能通过的原因?

    谢谢

    1 回复  |  直到 16 年前
        1
  •  1
  •   Ben ODay    16 年前

    经过进一步调查,发现这是CAMEL-CXF中的一个bug。它已被修复为支持驼峰中继中的自定义标头(计划在2.5版本中发布)。。。

    推荐文章