I need to call an url on my extension actionscript.
This url:
- set a cookie on the response and
- set a redirectUrl on the response.
redirectUrl use cookie information to performe some operations.
My actionscript follow this redirectUrl correctly but the cookie seems to be not set.
I use this script to call the url (I found it on this forum)
Code: Select all
function loadXml(httpUrl)
{
var theUrl = new java.net.URL(httpUrl);
var conn = theUrl.openConnection();
// set the connection for input
conn.setDoInput(true);
// Please, no cache
conn.setUseCaches(false);
var is = conn.getInputStream();
var isr = new java.io.InputStreamReader(is);
var br = new java.io.BufferedReader(isr);
var lineOfData = null;
sb = new java.lang.StringBuffer();
while((lineOfData = br.readLine()) != null)
{
sb.append(lineOfData);
}
return sb.toString()
}
Code: Select all
function checkSessionByJava(url){
var client = new org.apache.common.httpclient.HttpClient();
var getMethod = new org.apache.commons.httpclient.methods.GetMethod(url);
client.setFollowRedirects(true);
client.executeMethod(getMethod);
var responseBody = getMethod.getResponseBody();
var resp = new java.lang.String(responseBody);
trace("checkSessionByJava: "+resp)
return resp;
}ReferenceError: "org" is not defined ... Internal: 190 -- Line number:
So: how can I call an url and keep the session?
Thanks,
best regards.