Cannot pass cookie through acrobat using JavaScript
Hello everyone,
I am trying to write a folder level script using javascript for acrobat API in acrobat pro. It should post to a HTTP server by a click on a toolbar button. I wrote the script using Net.HTTP.request() method which has a parameter 'aHeaders' to pass some headers along with the request. Since I am developing this for an organization, I need to pass some headers like Content-Type, Cookie, etc. When I try to pass a cookie, it does not pass through acrobat or we can say acrobat filter it out and at the server, I receive all headers in the request which I had added except the cookie. I checked this with the help of a network analyzer tool, Wireshark.
Can anyone provide a clue as to why is this happening? How can we solve this? Any help would be highly appreciated.
Thanks.
Edit: Below is my code for the same:
ajax = app.trustedFunction(function (furl){
app.beginPriv();
try {
Net.HTTP.request({
cVerb: "POST",
cURL: furl,
aHeaders: [ {name: "Content-Type" , value: "application/json"},
{name:"Cookie" , value:"sample_value"} ],
oHandler: ajaxcallbback
});
}catch(e){
console.println(e);
}
app.endPriv();
});
ajaxcallback = {
response: function(msg, url, e){
var stream = msg;
var string = "";
var error = e = undefined? "NO HTTP errors":"error: " + e.toSource();
console.println(error);
string = SOAP.stringFromStream(stream);
var oResult = JSON.parse(string);
console.println(oResult.submissionID);
}
app.addToolButton({
cName: "mytoolbutton",
cExec: "ajax("http://......com")",
cLabel:"push",
nPos:-1
})
