骆驼-使用cookie参数作为to或toD uri

时间:2020-06-24 19:46:45

标签: java cookies apache-camel netty http-proxy

假设我有一个名为<table> <tr> <td class="smallerCell"><img src="https://i.ya-webdesign.com/images/avatar-png-1.png"/></td> <td class="smallerCell"><img src="https://i.ya-webdesign.com/images/avatar-icon-png-1.png"/></td> <td><img src="https://i.ya-webdesign.com/images/avatar-icon-png-1.png"/></td> <td class="imgStackText"><strong>Male</strong> and <strong>Female</strong> are in the copy of this Email.</td> </tr> </table>的cookie,我想使用它来动态路由。如何使用骆驼将动态值uri设置为该cookie的值?

我目前正在使用netty-http作为一种反向代理,因此我希望能够做到以下几点:

<div style="padding-left:32px;" >
  <img src="https://i.ya-webdesign.com/images/avatar-png-1.png" style="width:64px;height:64px;border-width:4px;border-style:solid;border-color:white;border-radius:64px;margin-left:-32px;background-color:transparent;background-image:none;background-repeat:repeat;background-position:top left;background-attachment:scroll;" />
  <img src="https://i.ya-webdesign.com/images/avatar-icon-png-1.png" style="width:64px;height:64px;border-width:4px;border-style:solid;border-color:white;border-radius:64px;margin-left:-32px;background-color:transparent;background-image:none;background-repeat:repeat;background-position:top left;background-attachment:scroll;" />
  <span style="font-family:Helvetica;position:relative;bottom:28px;" ><strong>Male</strong> and <strong>Female</strong> are in the copy of this Email.</span>
</div>

现在,我所看到的唯一真正的解决方案是添加一个处理器,该处理器从标头中提取Cookie并为x_url进行解析,然后创建一个新的自定义标头,然后将其用于toD。

public void configure() {
   from("netty-http:proxy://0.0.0.0:5000")
      .toD("${x_url cookie value here});
}

我已经尝试了多种其他方法,例如x_url等,我认为这将是更简单,更一致的方法,而任何一种都不起作用。

我想相信有更清洁的方法可以做到这一点。如果有人有任何想法,请告诉我。

编辑 这是运行的输出

...
   .process(...)
   .toD("${header.customHeader}")
header.cookie[x_url]

0 个答案:

没有答案