If I use reply.setContentType("application/json") to return a json file
tntnet adds unwanted spaces or line returns to the front of the reply
sent to the browser. If this reply is json, then jquery fails to parse
on Android devices (two that I tested) with SyntaxError: Unexpected
token ILLEGAL. Does not fail on FF or IE.
std::ifstream in(vtxJsonFile.c_str());
if (!in) {
return DECLINED;
}
tnt::MimeDb mimeDb("/etc/mime.types");
reply.setContentType(mimeDb.getMimetype(vtxJsonFile)); //This
appears to add spaces to the front which borks android.
// so does reply.setContentType("application/json")
reply.out() << in.rdbuf();
static@tntnet works fine.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general