Java 如何为mule入站端点指定多个内容类型

Java 如何为mule入站端点指定多个内容类型,java,web-services,mime-types,mule,content-type,Java,Web Services,Mime Types,Mule,Content Type,我们使用mule来部署一些服务 对于我们的一项服务,输入可以是application/xml或application/json。如何为同一入站端点指定多个内容类型 这就是当我们只有一种内容类型需要处理时的情况 <https:inbound-endpoint address="https://localhost:43123/v1/cars" exchange-pattern="request-response" contentType="application/xml

我们使用mule来部署一些服务

对于我们的一项服务,输入可以是application/xml或application/json。如何为同一入站端点指定多个内容类型

这就是当我们只有一种内容类型需要处理时的情况

<https:inbound-endpoint address="https://localhost:43123/v1/cars"
            exchange-pattern="request-response" contentType="application/xml">
            <mule-ss:http-security-filter realm="mule-realm" />
        </https:inbound-endpoint>


如何指定上述入站点应该能够处理“application/xml”和“application/json”的内容类型属性
contentType
对入站HTTP端点没有任何影响


只需删除它,并使用如下表达式检查名为
http.headers
的入站属性中的实际内容类型:
#[message.inboundProperties['http.headers']['content-type']]
contentType
属性对入站http端点没有任何影响


只需删除它,然后在名为
http.headers
的入站属性中使用如下表达式检查实际内容类型:
#[message.inboundProperties['http.headers']['content-type']]

感谢您的回复。contentType对出站HTTP端点有影响吗?。如何处理出站端点可以有多个内容类型的情况。在我的例子中,出站端点是一个RESTHTTP端点,它接受http:outbound标记上的json和xmlcontent类型属性,没有多大用处。如果要在出站http上设置内容类型,请尝试将“内容类型”设置为出站属性。感谢您的回复。contentType对出站HTTP端点有影响吗?。如何处理出站端点可以有多个内容类型的情况。在我的例子中,出站端点是一个RESTHTTP端点,它接受http:outbound标记上的json和xmlcontent类型属性,没有多大用处。如果要在出站http上设置内容类型,请尝试将“内容类型”设置为出站属性。