Could anyone provide information on setting the content length of response message send from an acceptor which is configured as Content Reply.
If you're talking about doing this within ESB you can have a custom service (Java) or use the xml transformation service (JavaScript) to get the content, obtain the length, then set the Header property Content-Length on the msg with the value you obtained when you checked the length.
For example:
(ESB Custom Service - Java):
public synchronized void service(XQServiceContext ctx) throws XQServiceException {
XQEnvelope env = null;
XQMessage msg = null;
while (ctx.hasNextIncoming()) {
msg = env.getMessage();
int i = msg.getPart(0).getContent().toString().length();
if (i > 0) {
if (msg.containsHeader("Content-Length") {
msg = msg.removeHeader("Content-Length");
}
msg.setHeaderValue("Content-Length", i);
}
...
}
}
JavaScript:
function rule() {
msgPart = XQMessage.getPart(0);
msgContent = XQMessage.getPart(0).getContent();
i = msgContent.toString().length();
if (i > 0) {
if (XQMessage.containsHeader("Content-Length")
XQMessage.removeHeader("Content-Length");
XQMessage.setHeaderValue("Content-Length", i);
}
}
...
}
HTH.
-Jeff