当jpos通道标题字符串包含空格时,我遇到了一个问题。我在通道适配器配置中配置如下,但是当我启动Q2服务器时,似乎它修剪了标头值。因此,我没有从jpos服务器获得任何针对某些请求的响应。
<channel-adaptor class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2" name="my-channel">
<channel class="CBCChannel" logger="Q2"
packager="org.jpos.iso.packager.GenericPackager" header="ISOHEADER ">
<property name="packager-config" value="/path/to/PACKAGER/iso87ascii.xml" />
<property name="host" value="xxx.xx.xx.xx"/>
<property name="port" value="yyyy" />
</channel>
<in>channel-send</in>
<out>channel-receive</out>
<property name="timeout" value="300000" />
<property name="keep-alive" value="true" />
<reconnect-delay>10000</reconnect-delay>
</channel-adaptor>
CBCChannel只是扩展了RawChannel
public class CBCChannel extends RawChannel {
public CBCChannel() throws ISOException {
}
public CBCChannel(String host, int port, ISOPackager p, byte[] header) {
super(host, port, p, header);
}
public CBCChannel(ISOPackager p, byte[] header) throws IOException {
super(p, header);
}
public CBCChannel(ISOPackager p, byte[] header, ServerSocket serverSocket) throws IOException {
super(p, header, serverSocket);
}
}
有没有办法配置包含空格的通道标题而不忽略空格?
答案 0 :(得分:0)
我猜你只需要覆盖setHeader方法:
public CBCChannel extends RawChannel {
....
public void setHeader(String header){
super.setHeader(header.getBytes());
}
}
但是你只会做关于标题的BaseChannel做的事情。您确定需要基于RawChannel的频道吗?