【问题标题】:WSO2 CONTENT_TYPE="text/plain" no use?WSO2 CONTENT_TYPE="text/plain" 没用?
【发布时间】:2013-01-04 14:36:18
【问题描述】:

在文档中,属性 CONTENT_TYPE 是:

In situations where the ESB is receiving HTTP response messages without the Content-type header, this property can be used to specify a default content type to be used. If no such content type is specified for responses the ESB will default to 'application/octet-stream'.

我有一个没有 Content-type 的 HTTP 测试服务响应消息,所以我在 ESB 配置中设置了属性 CONTENT_TYPE="text/plain"。回应是:

<axis2ns3:binary xmlns:axis2ns3="http://ws.apache.org/commons/ns/payload">UmV0dXJuQ29kZT0wMDAwMDANCg==</axis2ns3:binary>

如果我在我的 HTTP 测试服务中添加resp.setContentType("text/plain"),响应是:

<text xmlns="http://ws.apache.org/commons/ns/payload">ReturnCode=000000</text>

似乎上面的属性 CONTENT_TYPE 设置没有用,仍然默认为 'application/octet-stream'。

我有一个没有 Content-type 标头的 HTTP 服务,然后响应消息是二进制的。如何设置响应 CONTENT_TYPE="text/plain"?任何人都可以帮助我吗?非常感谢。

【问题讨论】:

  • 你能发布你用来设置内容类型的 ESB 配置吗?

标签: properties wso2 esb


【解决方案1】:

将以下行添加到axis2.xml ($ESB_HOME/repository/conf/axis2/axis2.xml) 中的messageFormatters

<messageFormatter contentType="text/plain" class="org.apache.axis2.format.PlainTextFormatter"/>

然后您可以使用属性调解器更改内容类型,如下所示:

<property name="messageType" value="text/plain" scope="axis2"/>

【讨论】:

    猜你喜欢
    • 2011-05-25
    • 1970-01-01
    • 2021-08-04
    • 1970-01-01
    • 2012-09-11
    • 2017-03-05
    • 2016-01-19
    • 2014-02-14
    • 1970-01-01
    相关资源
    最近更新 更多