Re: Why my url can not open a connection to my servlet in a web browse# Java - 爪哇娇娃
m*e
1 楼
Hi, I think you guys might not focus on the right problem. The
problem may have nothing to do with the security constaints on applet.
From the error message, it is clear that a cast failed. Depend on
the implemetation of the Virtual Machine, the URL's openConnection
method might return something different, which can not be casted to
HttpURLConnection. I suggest you use the abstract class URLConnection
instead of the subclass. It may solve the problem.
problem may have nothing to do with the security constaints on applet.
From the error message, it is clear that a cast failed. Depend on
the implemetation of the Virtual Machine, the URL's openConnection
method might return something different, which can not be casted to
HttpURLConnection. I suggest you use the abstract class URLConnection
instead of the subclass. It may solve the problem.