Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Proxy type in swt.Browser
Proxy type in swt.Browser [message #528917] Thu, 22 April 2010 07:47 Go to next message
Eclipse User
Originally posted by: ivo.hajducek.centrum.cz

Hello!

I'd like to set proxy type setting to some value, but
System.setProperty("network.proxy.type","2"); or -Dnetwork.proxy.type=2
as vm argument doesn't work.
Only what is working, is set the network.proxy_host. This will change
the network.proxy.type=1. As one can see in Mozilla.class property
"network.proxy.type" is used only for this case.

Could, please somebody help me, how to set network.proxy.type
programatically?

Best Regards!

Ivo
Re: Proxy type in swt.Browser [message #529324 is a reply to message #528917] Fri, 23 April 2010 15:22 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2148
Registered: July 2009
Senior Member
Hi Ivo,

First, the non-programmatic way for a user of your app to do this is to
navigate to about:config, search for network.proxy.type, and change its
value to 2.

Programmatically the easiest way to do this is with a line like:

browser.execute(
"var prefs =
Components.classes[\"@mozilla.org/preferences-service;1\"].getService(Compon
ents.interfaces.nsIPrefBranch);" +
"prefs.setIntPref(\"network.proxy.type\", 2);");

When looking into this I realized that the Browser has a bad behaviour when
the network.proxy_host and/or network.proxy_port properties are set, which
is that these values are persisted to the profile's preferences at the end
of the session, and will be applied to future sessions even if values are
not set for these properties. I've fixed this in the 3.6 stream (
https://bugs.eclipse.org/bugs/show_bug.cgi?id=310290 ). With this now in
place I suggest that you continue setting the proxy host and/or port via the
network.proxy_host/network.proxy_port java properties, and then set the
proxy type using the #execute line from above (just do this for the first
Browsr instance and it will be applied to all future Browser instances in
the current session as well). Setting these values this way will ensure
that all of these preferences, including the one that you set with the line
above, will be reverted to their initial values just before the preferences
are written out at shutdown time.

Grant


"Ivo Hajdu
Re: Proxy type in swt.Browser [message #532150 is a reply to message #529324] Fri, 07 May 2010 06:43 Go to previous message
Eclipse User
Originally posted by: ivo.hajducek.centrum.cz

Hello Grant!

I'm sorry for delay. It works, thank you.

Best Regards!
Ivo

Dne 23.4.2010 21:22, Grant Gayed napsal(a):
> Hi Ivo,
>
> First, the non-programmatic way for a user of your app to do this is to
> navigate to about:config, search for network.proxy.type, and change its
> value to 2.
>
> Programmatically the easiest way to do this is with a line like:
>
> browser.execute(
> "var prefs =
> Components.classes[\"@mozilla.org/preferences-service;1\"].getService(Compon
> ents.interfaces.nsIPrefBranch);" +
> "prefs.setIntPref(\"network.proxy.type\", 2);");
>
> When looking into this I realized that the Browser has a bad behaviour when
> the network.proxy_host and/or network.proxy_port properties are set, which
> is that these values are persisted to the profile's preferences at the end
> of the session, and will be applied to future sessions even if values are
> not set for these properties. I've fixed this in the 3.6 stream (
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=310290 ). With this now in
> place I suggest that you continue setting the proxy host and/or port via the
> network.proxy_host/network.proxy_port java properties, and then set the
> proxy type using the #execute line from above (just do this for the first
> Browsr instance and it will be applied to all future Browser instances in
> the current session as well). Setting these values this way will ensure
> that all of these preferences, including the one that you set with the line
> above, will be reverted to their initial values just before the preferences
> are written out at shutdown time.
>
> Grant
>
>
> "Ivo Hajdu─Źek"<ivo.hajducek@centrum.cz> wrote in message
> news:hqpd0u$e3t$1@build.eclipse.org...
>> Hello!
>>
>> I'd like to set proxy type setting to some value, but
>> System.setProperty("network.proxy.type","2"); or -Dnetwork.proxy.type=2
>> as vm argument doesn't work.
>> Only what is working, is set the network.proxy_host. This will change
>> the network.proxy.type=1. As one can see in Mozilla.class property
>> "network.proxy.type" is used only for this case.
>>
>> Could, please somebody help me, how to set network.proxy.type
>> programatically?
>>
>> Best Regards!
>>
>> Ivo
>
>
Previous Topic:Display Size with dual head?
Next Topic:Buffer to SWT image?
Goto Forum:
  


Current Time: Fri Aug 29 12:27:28 EDT 2014

Powered by FUDForum. Page generated in 0.08203 seconds