Reputation: 520
My need is to publish two services with same path on mule, but different URL's. Like this
https://localhost:8443/etc/app/version1/Service
https://localhost:8443/etc/app/version2/Service
Im using servlet mapping on web.xml
<servlet-mapping>
<servlet-name>muleServlet</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
And tried to use two different connectors since the path attribute doesn't allow me to use "version1/Service" or "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>
And finally, the endpoints
<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>
But i got this exception:
[[/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,
Thanks in advance.
Upvotes: 0
Views: 1053
Reputation: 33413
I don't think it's valid to declare two servlet connectors: there's only one servlet context so a single connector is enough. Actually, I never declare the Servlet connector, as the default configuration works just fine.
So with only the following configuration:
<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>
I'm able to deploy in a servlet container (Jetty) and I can hit /{context}/app/version1/Service
and /{context}/app/version2/Service
without problem.
Upvotes: 1