commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Smith" <ch...@mindiq.com>
Subject Re: [HttpClient] Using httpclient in applets (includes dirty fix)
Date Thu, 05 Dec 2002 15:33:54 GMT
> This raises a funny question: is there a way for a library
> being called from an applet to test wether it's in an applet ?
> I would do it precisely with System.getProperties() catching
> the exception but there should be a cleaner way !

The problem you want to solve is not determining whether the code is running
in an applet, but whether you can get the system properties that you want.
The best way to solve that problem is very similar to what you said: try to
do so, and catch the SecurityException if it doesn't work.  This isn't just
about applets... it's about ANY code that's running under a security
manager, with a wide range of possible security policies.  That could
include applets, any of a bunch of other framework based environments, and
even some servlet containers.

The one change I'd suggest would be to make sure we always call getProperty
for the specific property we're interested in, rather than
System.getProperties... some security policies may allow access to some
properties, but not all.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



Mime
View raw message