Proxy Auto-Config (PAC) script related.
NetBeans default implementation of a PAC script evaluation environment.
Utilities related to network.
The Core Network module provide ProxySelector as well as utilities related to network connections.
The role of a ProxySelector is to tell to the rest of Java which
proxy to use for a given URL. There's only one ProxySelector in a given
JVM. Most notably the ProxySelector is used by the
classes and even the new HTTP client in JDK9 is using it, although it allows
more control over this than does the
Also, the Apache HttpClient is also using the default ProxySelector if you have instructed
it to use what is known in Apache HttpClient as
This module provides an implementation of a ProxySelector which finds out which proxy to use by looking at preferences the user has stored. This is trivial for the case where the user has provided explicit proxy information. It is more complex for the case where the user has said "just use my system's proxy configuration" which is by the way the default in NetBeans. This requires us to go the underlying OS and try to figure out what the user's settings are. In many case case the user will not have explicit proxy setting in the OS either but will simply have "Automatically detect settings" or whatever. This makes it even more complex (see WPAD section below).
The ProxySelector is instantiated by the Startup module, but only if module Core also exists. Thus, for a minimal Platform application which only use the modules from the "Runtime Container", there will be no ProxySelector installed because module Core is not part of the Runtime Container. In this case, the standard ProxySelector in Java will then be used. This makes sense because a headless application will not have stored Preferences about proxy, etc, and will be much better off by just using the standard ProxySelector (which can be controlled by properties).
Module Core uses the Global Lookup to search for a ProxySelector, so you can register your own ProxySelector if you don't like the one provided by the Platform (i.e. this module). This will be somewhat difficult though, because in order to implement your own ProxySelector, you would need read access to the stored ProxySettings. This class is currently only exposed to friends.
Proxy Auto-Config (PAC)
org.netbeans.core.network.proxy.pac.impl.Bundlein your own application and change the value of
ALLOWED_PAC_ENGINESkey. The default is
GraalVM:js,Graal.js,Nashorn- e.g. the engines currently considered secure.
If you don't like the PAC evaluation environment provided
by this module then you can plug in your own by registering
PacScriptEvaluatorFactory class in the Global Lookup.
If you want to build your own PAC evaluation environment then you can
still make use of all the utility classes provided by this module.
Locating the PAC script (WPAD)
Normally, a Web Browser (in comparison) can locate the PAC script either explicitly, meaning the URL is directly available from the settings in the OS, or it can be located via WPAD This module currently only supports the case where URL is directly available from the settings. There's no support for WPAD.
The PAC Script Evaluation environment (as part of
has been completely rewritten and is now pluggable. (albeit for now only for friends)
ProxySelectorin the Global Lookup. However, make sure you understand that the instantiation of the ProxySelector (i.e. executing its constructor) is part of the main startup path of a NetBeans application. For this reason the constructor better be fast. Defer as much work as possible to later.
default oneprovided in this module. You do this by registering your own
PacScriptEvaluatorFactoryin the Global Lookup. This factory must then in turn return an instance of your custom
default PAC evaluatoryou can replace only its implementation of the PAC Helper Functions. However, you have to play by rules set by the
PacHelperMethodsin the Global Lookup and your implementation will automatically be picked up. When creating your own
PacHelperMethodsyou may take benefit from the PAC utility functions provided by
PacUtilsDateTime, as well as the more general ones provided by
network utils package.
The sources for the module are in the NetBeans Mercurial repositories.
XXX no answer for deploy-dependencies
Read more about the implementation in the answers to architecture questions.