Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 4302 invoked by uid 98); 5 Dec 2002 15:38:37 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Received: (qmail 3843 invoked from network); 5 Dec 2002 15:38:32 -0000 Received: from daedalus.apache.org (HELO apache.org) (63.251.56.142) by nagoya.betaversion.org with SMTP; 5 Dec 2002 15:38:32 -0000 Received: (qmail 45358 invoked by uid 500); 5 Dec 2002 15:37:25 -0000 Received: (qmail 45348 invoked from network); 5 Dec 2002 15:37:24 -0000 Received: from smtprelay7.dc2.adelphia.net (64.8.50.39) by daedalus.apache.org with SMTP; 5 Dec 2002 15:37:24 -0000 Received: from KYA ([68.71.53.6]) by smtprelay7.dc2.adelphia.net (Netscape Messaging Server 4.15 smtprelay7 Dec 7 2001 09:58:59) with SMTP id H6NKQC03.E0C for ; Thu, 5 Dec 2002 10:37:24 -0500 Message-ID: <003b01c29c74$29757c60$6700000a@KYA> From: "Chris Smith" To: "Jakarta Commons Users List" Subject: Re: [HttpClient] Using httpclient in applets (includes dirty fix) Date: Thu, 5 Dec 2002 08:37:03 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N [Incidentally, someone let me know if you're getting two copies of my posts. Invariably, I always send from my work account by accident, then remember to change to personal address and resend. Hope that's not causing problems.] > 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