Servlets 如何在Mule 3.2上发布具有相同路径但不同URL的两个服务
我需要在mule上发布两个路径相同但URL不同的服务。像这样Servlets 如何在Mule 3.2上发布具有相同路径但不同URL的两个服务,servlets,mule,esb,endpoint,inbound,Servlets,Mule,Esb,Endpoint,Inbound,我需要在mule上发布两个路径相同但URL不同的服务。像这样 https://localhost:8443/etc/app/version1/Service https://localhost:8443/etc/app/version2/Service Im在web.xml上使用servlet映射 <servlet-mapping> <servlet-name>muleServlet</servlet-name> <url-p
https://localhost:8443/etc/app/version1/Service
https://localhost:8443/etc/app/version2/Service
Im在web.xml上使用servlet映射
<servlet-mapping>
<servlet-name>muleServlet</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
提前感谢。我不认为声明两个servlet连接器是有效的:只有一个servlet上下文,所以一个连接器就足够了。实际上,我从未声明Servlet连接器,因为默认配置工作正常 因此,仅使用以下配置:
<flow name="FlowVersion1" processingStrategy="synchronous">
<servlet:inbound-endpoint
path="version1/Service" />
<set-payload value="version 1" />
</flow>
<flow name="FlowVersion2" processingStrategy="synchronous">
<servlet:inbound-endpoint
path="version2/Service" />
<set-payload value="version 2" />
</flow>
我可以在servlet容器(Jetty)中部署,我可以点击
/{context}/app/version1/Service
和/{context}/app/version2/Service
。谢谢David,我已经发现了这一点,它起了作用,我正要发布我的awnser,但现在我接受你的。我只是好奇:你知道为什么包含下划线的路径只使用斜杠作为第一个字符吗?这不起作用,但这只是对我来说是个bug:在幕后,骡将端点表示为URI,似乎考虑了<代码>。servlet://service_v1_01_01/Hello和servlet://service_v2_01_01/Hello
作为冲突,而servlet:///service_v1_01_01/Hello
和servlet:///service_v2_01_01/Hello
不是。。。打开吉拉:原来如此:再次感谢大卫。
<flow
name="FlowVersion1"
processingStrategy="synchronous">
<servlet:inbound-endpoint
connector-ref="conectorVersion1"
path="Service">
<-- processors, jaxws-service, interceptors etc.. -->
</servlet:inbound-endpoint>
</flow>
<flow
name="FlowVersion2"
processingStrategy="synchronous">
<servlet:inbound-endpoint
connector-ref="conectorVersion2"
path="Service">
<-- processors, jaxws-service, interceptors etc.. -->
</servlet:inbound-endpoint>
</flow>
[[/etc]] StandardWrapper.Throwable: java.lang.IllegalStateException:
There are at least 2 connectors matching protocol "servlet", so the connector to use must be
specified on the endpoint using the 'connector' property/attribute.
Connectors in your configuration that support "servlet" are: conectorVersion1, conectorVersion2,
<flow name="FlowVersion1" processingStrategy="synchronous">
<servlet:inbound-endpoint
path="version1/Service" />
<set-payload value="version 1" />
</flow>
<flow name="FlowVersion2" processingStrategy="synchronous">
<servlet:inbound-endpoint
path="version2/Service" />
<set-payload value="version 2" />
</flow>