Re: ProxySelector2

Peter Hansson <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <CAC55jYP78XLmBrCHj-oKjLNd-TiGd7CiFQcFdh0gXWxej_ssYA@mail.gmail.com>
> I confirm that with the plugin installed, using “auto-detect proxy” in the Windows settings and “System proxy” in Netbeans, the connection test fails but the start page is actually able to connect to internet, as well as the update center. This is good news!



Very good.



> The disappointing point is that the connection test fails, which mislead the final user…



Doesn't surprise me. The code that tests the Proxy setup from the
Options UI sits outside the plugin, meaning this is core NB talking
here.  It sits in a place in the NB code tree where I wouldn't know
how to overwrite it using a plugin. I've had a look at it and it seems
to me that it will not work if you are changing into "Use system proxy
settings" and then *not* hitting "Reload" button and then attempting
the "Test connection" button. Conclusion: Just make sure to hit the
"Reload" button first.  (I'm kinda guessing here but 90% sure)


What goes on is this:  When your site is using PAC it means that which
network proxy to use is actually not determined until the destination
URL is called. In essence use of PAC creates some overhead for each
network connection as the PAC script must be evaluated for each and
every network connection. The Plugin tries to alleviate this by
caching previously results. Browsers like IE, FF and Chrome use the
same trick.


Ok, so the Platform has to ask the PAC evaluator the question: "which
network proxy should I use if I want to reach endpoint
http://netbeans.org" ?  (yes, netbeans.org is actually what gets
tested against). The result of this is cached every time you hit the
"Reload" button but also on startup of app or IDE. You can see this in
the log as:



INFO [org.netbeans.core2.network.proxy.NetworkProxyReloader]: System
network proxy TEST - http host: blablabla.proxy.mycompany.blabla INFO
[org.netbeans.core2.network.proxy.NetworkProxyReloader]: System
network proxy TEST - http port: 8080


When you hit the "Test connection" button NB core tries to see if it
can reach http://netbeans.org by going via
blablabla.proxy.mycompany.blabla:8080, or this is what it *SHOULD* be
doing. Ok?


> Now I am trying to reuse it in my own application, but I use Ant, not  Maven. I will probably have some adaptations to do. Advices are welcome ;-)


I guess the recipe is not different from any other Plugin that you
want to use in your NB Platform application. Unfortunately I haven't
used Ant for many years and my mind seems to have erased everything
about it. (not saying one is better than the other, I just cannot
remember anything from those days).



Best of luck


Peter


On Fri, Apr 22, 2016 at 11:58 AM, Casqueiro Gilles
<[email protected]> wrote:
> Hi Peter,
>
>
>
> I confirm that with the plugin installed, using “auto-detect proxy” in the
> Windows settings and “System proxy” in Netbeans, the connection test fails
> but the start page is actually able to connect to internet, as well as the
> update center. This is good news!
>
>
>
> The disappointing point is that the connection test fails, which mislead the
> final user…
>
>
>
> Now I am trying to reuse it in my own application, but I use Ant, not
> Maven. I will probably have some adaptations to do. Advices are welcome ;-)
>
>
>
> Thanks
>
>
>
> Gilles
>
>
>
> From: Peter Hansson [mailto:[email protected]]
> Sent: mercredi 20 avril 2016 18:02
>
>
> To: [email protected]
> Subject: [platform-dev] Re: ProxySelector2
>
>
>
>
>
> If NetBeans IDE is not able connect to Internet then you'll not see content
> in the "Start Page" tab. This really the best test if NetBeans IDE can
> access Internet or not.
>
> I can tell from your log output that your site is using WPAD method to
> discover the location of your site's PAC file. (which in your case seems to
> reside on your intranet on address http://wpad/wpad.dat). You can actually
> download the PAC file and view it as it is plain text JavaScript. Anyway, in
> this sense your site is pretty main stream compared to any other corporate
> site.
>
> Every time an URL is called NetBeans will evaluate this little JavaScript
> file. This is true both with and without the plugin. The plugin improves a
> lot on this. Without the plugin PAC file evaluation just doesn't work in NB
> if your are using Java 8. As you may be aware Java 8 included a new and
> improved JavaScript engine called Nashorn. However this particular piece in
> NB core code was made long before Java 8 became available so it was
> developed and tested against another JavaScript engine ... and now the code
> just doesn't work anymore (bug 245116). The other reason is that the NB core
> code in this area doesn't implement all the mandatory PAC JavaScript
> functions, say for example the script calls JavaScript function dnsResolve()
> (which the PAC standard mandates to exist, and guess what: many, many PAC
> scripts out there indeed calls this function) then the proxy resolution will
> silently fail in NB core, that is if you are NOT using the plugin.  Ok, I'll
> stop with the reasons why you should be using the plugin. :-)
>
> Anyway, to get closer to a resolution you'll need to enable some logging. Go
> to your NetBeans IDE installation directory and locate the file
> etc/netbeans.conf. Now edit the "netbeans_default_options" variable so that
> you append to it as follows:
>
>
> netbeans_default_options="........
> -J-Dorg.netbeans.core2.network.proxy.level=FINEST"
>
> Make sure the plugin is installed. Restart your IDE and wait 1-2 minutes and
> then post all relevant lines from messages log here. Those lines relevant
> would all be containing "org.netbeans.core2.network.proxy".
>
> If you want - out of curiosity - to do the same but WITHOUT the plugin (i.e.
> using bare NetBeans) then it would be
> "org.netbeans.core.network.proxy.level=FINEST" instead but core NB code does
> less logging than my plugin. Still helpful though.
>
>
>
> Peter
>
>
>
>
>
>
>
> On Mon, Apr 18, 2016 at 11:25 AM, Casqueiro Gilles
> <[email protected]> wrote:
>
> Hello Peter,
>
>
>
> Yes I can, in Chrome and Firefox the internet connection works fine with the
> auto-detect proxy settings.
>
>
>
> Here are probably the relevant lines of the log file:
>
>
>
> INFO [org.netbeans.core2.network.proxy.NetworkProxyReloader]: System network
> proxy resolver: Windows
>
> INFO [org.netbeans.core2.network.proxy.windows.WindowsNetworkProxy]: Windows
> system proxy resolver: auto detect
>
> INFO [org.netbeans.core2.network.proxy.NetworkProxyReloader]: System network
> proxy reloading succeeded.
>
> INFO [org.netbeans.core2.network.proxy.ProxyAutoConfig]: PAC file evaluator
> using:  LanguageName="ECMAScript" LanguageVersion="ECMA - 262 Edition 5.1"
> EngineName="Oracle Nashorn" EngineVersion="1.8.0_60"
>
> INFO [org.netbeans.core2.network.proxy.NetworkProxyReloader]: System network
> proxy - mode: auto
>
> INFO [org.netbeans.core2.network.proxy.NetworkProxyReloader]: System network
> proxy - pac url: http://wpad/wpad.dat
>
> INFO [org.netbeans.core2.network.proxy.NetworkProxyReloader]: System network
> proxy TEST - http host: blablabla.proxy.mycompany.blabla
>
> INFO [org.netbeans.core2.network.proxy.NetworkProxyReloader]: System network
> proxy TEST - http port: 8080
>
>
>
> Even if it is written in these lines that the proxy was found, Netbeans
> isn’t actually able to connect to internet. For example, the “Test
> connection” button in Tools/Option fails. And I have error messages related
> to the internet connection when I try to update or install a plugin. Do
> Netbeans know how to resolve this host name into an ip address? My DNS work
> fine in the Windows command line.
>
>
>
> Thanks!
>
>
>
> Gilles
>
>
>
> From: Peter Hansson [mailto:[email protected]]
> Sent: vendredi 15 avril 2016 17:38
> To: [email protected]
> Subject: [platform-dev] Re: ProxySelector2
>
>
>
> Hello Gilles,
>
> I'm the author of this plugin.  If you get same issue with or without the
> plugin installed then there must be something else going on.
>
> You can send me the messages log from the IDE (with the plugin installed and
> after the IDE has been restarted and up for 1-2 minutes) and I'll be happy
> to look at it.
>
> The purpose of the plugin is to be on par with what modern browsers is able
> to do when it comes to detect and choose proxy without a lot of
> configuration hassle.  So if you can make your internet connection work in
> IE or Chrome with only "Automatically detect proxy" in Windows settings then
> the same should be true for the IDE with the plugin installed.  Can you ??
>
> Peter
>
>
>
>
>
>
>
> On Fri, Apr 15, 2016 at 4:18 PM, Casqueiro Gilles
> <[email protected]> wrote:
>
> Hello everyone,
>
>
>
> Does anyone successfully used the project “ProxySelector2”
> https://bitbucket.org/phansson/netbeansproxy2/overview, also available as a
> plugin for Netbeans here:
> http://plugins.netbeans.org/plugin/55258/?show=true ?
>
>
>
> First I tried to use the plugin on my Netbeans IDE installation on Windows.
> When I specify manually the address and port of the proxy either in Netbeans
> or in the Windows settings, the internet connection works. But if I choose
> “System proxy”  in Netbeans and “Automatically detect proxy” in Windows
> settings, which are default values I think, it fails to connect. Same result
> with and without the plugin. Maybe I misunderstood how to use it?
>
>
>
> Note: Our proxy is apparently a Microsoft solution, but I don’t know that
> much about it.
>
>
>
> Gilles
>
>
>
> -----------------------------------------------------------------------
>
> Le informazioni contenute in questo messaggio di posta elettronica e
> relativi allegati sono riservate e confidenziali e ne è vietata la
> diffusione in qualunque modo eseguita. Qualora Lei non fosse la persona a
> cui il presente messaggio è destinato, La invitiamo ad eliminarlo e a
> darcene gentile comunicazione.
>
> The information contained in this e-mail and any attachments is confidential
> and may also be privileged. If you are not the named recipient please notify
> the sender immediately and do not disclose the contents to any other person,
> use it for any purpose, or store or copy the information in any medium.
>
> -----------------------------------------------------------------------
>
>
>
>
>
> -----------------------------------------------------------------------
>
> Le informazioni contenute in questo messaggio di posta elettronica e
> relativi allegati sono riservate e confidenziali e ne è vietata la
> diffusione in qualunque modo eseguita. Qualora Lei non fosse la persona a
> cui il presente messaggio è destinato, La invitiamo ad eliminarlo e a
> darcene gentile comunicazione.
>
> The information contained in this e-mail and any attachments is confidential
> and may also be privileged. If you are not the named recipient please notify
> the sender immediately and do not disclose the contents to any other person,
> use it for any purpose, or store or copy the information in any medium.
>
> -----------------------------------------------------------------------
>
>
>
>
>
> -----------------------------------------------------------------------
>
> Le informazioni contenute in questo messaggio di posta elettronica e
> relativi allegati sono riservate e confidenziali e ne è vietata la
> diffusione in qualunque modo eseguita. Qualora Lei non fosse la persona a
> cui il presente messaggio è destinato, La invitiamo ad eliminarlo e a
> darcene gentile comunicazione.
>
> The information contained in this e-mail and any attachments is confidential
> and may also be privileged. If you are not the named recipient please notify
> the sender immediately and do not disclose the contents to any other person,
> use it for any purpose, or store or copy the information in any medium.
>
> -----------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.