怎么设置apache camel servlet的header大小

怎么设置apache camel servlet的header大小,第1张

Apache Camel的Header、Property、Body配置示例

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:camel="http://camel.apache.org/schema/spring"

xsi:schemaLocation="

http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

<bean id="echo" class="com.lala.bean.Echo"></bean>

<bean id="bean1" class="com.lala.bean.Bean1"></bean>

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

<route autoStartup="true">

<from uri="timer://aaa?fixedRate=true&period=60000" />

<process ref="bean1"/>

<!-- 设置所有的headers(会去掉之前的所有header) -->

<setOutHeader headerName="name">

<constant>白展堂</constant>

</setOutHeader>

<!-- 添加一个header -->

<setHeader headerName="id">

<constant>100010</constant>

</setHeader>

<!-- 设置property -->

<setProperty propertyName="type">

<simple>${in.header.id}</simple>

</setProperty>

<!-- 设置body -->

<setBody>

<simple>name:${in.header.name},type:${property.type}</simple>

</setBody>

<process ref="echo"/>

</route>

</camelContext>

</beans>

1。运行VirutalBox(VirtualBox.exe),不要运行虚拟机;2。打开寄主机的“网络连接”页面,记下“virtualbox host-only network”的网络设置(我的默认设置为(安装完VirtualBox后,网络连接就自动多了个VirtualBox Host-Only Network):IP地址为192.168.56.1,掩码为255.255.255.0);3。启动虚拟机,将虚拟机的网络设置如下:IP地址:192.168.56.2掩码:255.255.255.0网关:192.168.56.1(我的试验发现,不需要设置DNS);4。尝试宿主机与虚拟机互ping如果发现ping不通,主要的可能原因是防火墙拦截了互ping时,可以将2台计算机的防火墙先关闭,证明互ping成功后再打开防火墙5。我的目标是宿主机连接使用虚拟机的数据库服务,SQLServer的默认端口为:1433,因此,对虚拟机 Windows XP防火墙设置例外端口,使得宿主机可连接虚拟机,对虚拟机 Windows XP设置如下:开始-->控制面板-->Windows防火墙-->点击“例外”选项卡-->点击“添加端口”按钮起一个容易记的名字,端口为:1433,单选按钮:TCP,点确定。宿主机测试是否能连接:在Windows 7WIN+R-->cmd-->telnet 192.168.68.2 1433出现新的命令窗口,命令窗口的标题是“telnet 192.168.68.2”,就证明成功了。如果告诉你telnet不是内部命令,依次打开“开始”→“控制面板”→“打开或关闭Windows功能”,在打开的窗口处,寻找并勾选“Telnet客户端”,然后点击“确定”。顺利安装后,再在运行下输入此命令就OK了。 通过Host-Only使宿主机与虚拟机通信,此时虚拟机无法访问外网。要解决该问题,最简单的方法是:为虚拟机再设置一块网卡,连接方式为NAT 另外,如果有路由器,则通过桥接方式(Bridge)就可以实现既互相通信又能上网了,因为此时宿主机与虚拟机是局域网上两台平等的计算机。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11282416.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-14
下一篇2023-05-14

发表评论

登录后才能评论

评论列表(0条)

    保存