How to configure jpos channel header with spaces

2019-05-21 10:13发布

I came across an issue, when the jpos channel header string has spaces. I configured that in the channel adaptor configuration as below, but when I start the Q2 server, it seems it trims the header value. As a result of that, I'm not getting any response from the jpos server for certain requests.

<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>

The CBCChannel just extends the 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);
    }
}

Is there any way to configure channel header which contains spaces without neglecting the spaces?

标签: iso8583 jpos
1条回答
\"骚年 ilove
2楼-- · 2019-05-21 10:29

I guess you only need to override setHeader method:

public CBCChannel extends RawChannel {
....
    public void setHeader(String header){
        super.setHeader(header.getBytes());
    }

}

But you would only be doing what BaseChannel does in regard to the header. Are you sure you need a RawChannel based channel?

查看更多
登录 后发表回答