I'm running a linux server with tomcat and Railo. If I try this simple code:
check = "";
jSoupClass = createObject( "java", "org.jsoup.Jsoup" );
if(IsInstanceOf(jSoupClass,"org.jsoup.Jsoup")){
check = "ok";
}
writeDump(check );
If I run this simple code the var check
is always empty. I run this simple test with many java class and all working perfectly.
In my app I use jsoup with no problem, but cannot seem to run this simple check. I use this for check the doctype of a document:
jSoupClass = createObject( "java", "org.jsoup.Jsoup" );
dom = jSoupClass.connect( "http://www.mutuiinpdap.net" ).userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6").timeout(10000).execute();
doc = dom.parse();
nods = doc.childNodes();
doctype = {};
for (key in nods) {
if(IsInstanceOf(key,"org.jsoup.nodes.DocumentType")){
doctype.string = key.toString();
switch(key) {
case "<!DOCTYPE html>":
doctype.declarations = "Html 5";
break;
case '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">':
doctype.declarations = "XHTML transitional";
break;
}
}
}
writeDump(doctype);
Is there a way to solve this? can I use a different code to check which doctype is a document?
This code run perfectly on my local Windows machine. But on my production server with Ubuntu installed on it breaks...
[Edit]
I have tested also with this code:
public function getDoctype(){
myClass = {};
jSoupClass = createObject( "java", "org.jsoup.Jsoup" );
whois = createObject("java", "org.apache.commons.net.whois.WhoisClient");
myClass.jj = "ko";
myClass.ww = "ko";
writeDump(jSoupClass);
writeDump(whois);
if(IsInstanceOf(jSoupClass,"org.jsoup.Jsoup")){
myClass.jj = "ok";
}
if(IsInstanceOf(whois,"org.apache.commons.net.whois.WhoisClient")){
myClass.ww = "ok";
}
return myClass;
}
I will get a myClass.jj = "ko"; and myClass.ww = "ok";