Skip to main content
Inspiring
June 11, 2020
質問

Cannot pass cookie through acrobat using JavaScript

  • June 11, 2020
  • 返信数 7.
  • 919 ビュー

 

 

 

 

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

 

このトピックへの返信は締め切られました。

返信数 7

nishant13作成者
Inspiring
June 15, 2020

Could anyone provide even the slightest clue to solve this issue? @adobe community professionals, please help! I would really appreciate that.

Legend
June 15, 2020

It is best in these forums not to edit your original reply to add new information. People are unlikely to visit and read it again. Please always post new information in the form of a reply.

nishant13作成者
Inspiring
June 15, 2020

Okay, I will try to take care of it from next time. But for this specific issue, do you have any possible solutions?

try67
Community Expert
Community Expert
June 11, 2020

Post your full code, please.

nishant13作成者
Inspiring
June 11, 2020

added now.