commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Libbrecht <>
Subject Re: [HttpClient] HttpClient and Applets
Date Thu, 03 Nov 2005 08:54:49 GMT
The AppletContext class gives you this and you should use it.
(getDocumentBase() or something such?)
This will be the URL of the proxy, of course, which you expect to relay 
your http call.


Le 3 nov. 05, à 09:42, Jeroen Kransen (DT) a écrit :

> Oleg, Paul,
> Thank you for your responses. I got it that the problem is not related
> to HttpClient, but to the AccessController. And indeed I wrote the host
> name right, or it wouldn't work without proxy. :-)
> For sure I'll be very glad to be able to /detect/ the proxy settings,
> and it looks like the classes you showed do that for me. However, I
> doubt that /knowing/ the proxy settings will solve the issue, since I
> already know the settings now. :-)
> My point was that I wonder if it will work at all, since the proxy will
> still be a different host than the one I downloaded the Applet from. 
> The
> existence of this PluginProxyTest suggests that it is useful in a Java
> applet to detect (and use?) the settings, so my real question(s) is
> (are):
> Dit anyone get an Applet contact the originating server successfully
> through a Proxy, other than by downloading images and sounds? And more
> specifically: by using HttpClient? Is there a more straightforward way
> to do GETs (and if possible, POSTs) from an Applet instead of by using
> HttpClient?
> Jeroen
>> -----Original Message-----
>> From: Oleg Kalnichevski []
>> Sent: woensdag 2 november 2005 12:34
>> To:
>> Subject: Re: HttpClient and Applets
>> On Tue, Nov 01, 2005 at 10:06:05AM +0100, Jeroen Kransen (DT) wrote:
>>> Hello,
>>> I have an applet that has to communicate with the originating server
>>> through HTTP. It has to send and retrieve custom data, through GETs
>>> and (if possible) POSTs. I am using HttpClient (I am open for
>>> suggestions on that), which works well in a direct connection.
>>> However, when I am behind a proxy, I get a AccessControlException. I
>>> could explain this by the fact that the proxy server is not the
>>> originating server, and that by specification I am only
>> allowed to contact the originating server.
>>> But I really don't want to bother about things like proxies at all.
>>> What I really want is that the Applet transparently hooking
>> on to the
>>> browser settings for the proxy. The only possibilities I see now to
>>> contact the originating server Applet-wise is through
>>> Applet.getAudioClip(), .getImage(),
>>> .getAppletContext().showDocument(), but none of this is what I want.
>>> I'm sure I'm not the only one who wants to do something like this.
>>> There's probably either a simple solution or it's just plain
>> impossible.
>>> I hope to hear it either way.
>>> Jeroen Kransen
>> Jeroen,
>> The AccessControlException is thrown by the AccessController
>> to indicate that a requested access (to a critical system
>> resource such as the file system or the network) is denied.
>> This problem has nothing to do with HttpClient
>> You may want to take a look at the classes (below) to see how
>> a (limited) proxy setting auto-detection could be implemented:
>> nt/trunk/src/contrib/org/apache/commons/httpclient/contrib/proxy/
>> Hope this helps
>> Oleg
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message