我需要在 mule 上发布两个具有相同路径但 URL 不同的服务。像这样
https://localhost:8443/etc/app/version1/Service
https://localhost:8443/etc/app/version2/Service
我在 web.xml 上使用 servlet 映射
<servlet-mapping>
<servlet-name>muleServlet</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
并尝试使用两个不同的连接器,因为路径属性不允许我使用“version1/Service”或“version2/Service”
<servlet:connector
name="conectorVersion1"
servletUrl="https://localhost:8443/etc/app/version1/">
</servlet:connector>
<servlet:connector
name="conectorVersion2"
servletUrl="https://localhost:8443/etc/app/version2/">
</servlet:connector>
最后,端点
<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,
提前致谢。