powered by Jive Software

BOSH with Alternative Script Syntax

Hi,

I`m looking at the code of openfire and see that in HttpBindServlet there is a support for returning javascript:

private void respond(HttpServletResponse response, String content, String method)

throws IOException {

response.setStatus(HttpServletResponse.SC_OK);

response.setContentType(“GET”.equals(method) ? “text/javascript” : “text/xml”);

response.setCharacterEncoding(“utf-8”);

if (“GET”.equals(method)) {

content = “BOSH(”" + StringEscapeUtils.escapeJavaScript(content) + “”)";

}

byte[] byteContent = content.getBytes(“utf-8”);

response.setContentLength(byteContent.length);

response.getOutputStream().write(byteContent);

}

Is this true? If I`m sending a “GET” request I will get the responce in javascript with a call to “BOSH” function on my page?

It doesnt work for me. Ive tried calling with this url:

http://myserver:8080/http-bind/?A_URL_encoded_session_request

My session request not encoded looks like this:

“<body hold=‘1’ xmlns=‘http://jabber.org/protocol/httpbind’ to = ‘myserver.com’ wait=‘300’ rid=‘1573841820’ xml:lang=‘en’/>”

and I`m using encodeURIComponent on it.

I`m getting a 404 NOT_FOUND response.

Is it possible to do it in openfire? If not why do you send back the repsonce as a javascript?

Thanks