-->
<!DOCTYPE apilanguagegoverningpermissions limitations
<!ENTITY api-questions SYSTEM "../../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
]>
<api-answers
question-version
author->
>
&api-questions;
<!-- <questionid="arch-overall"when="init"> Describetheoverallarchitecture. <hint> WhatwillbeAPIfor <ahref="http://wiki.netbeans.org/API_Design#Separate_API_for_clients_from_support_API"> clientsandwhatsupportAPI</a>? partswillbepluggable Howwillplug-insberegistered?Please="lbruun todescribeyourgeneralAPIsandspecifytheir <ahref="httpforjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 stabilitycategories</a>. Ifpossiblepleaseprovidesimplediagrams. </hint> </question>
-->
<answer id="arch-overall">
<p>
The Core Network module provide ProxySelector as well as utilities related
to network connections.
</p>
<p>
<b>ProxySelector</b>
</p>
<p>
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 <code>URLConnection</code>
classes and even the new HTTP client in JDK9 is using it, although it allows
more control over this than does the <code>URLConnection</code> classes.
Also, the Apache HttpClient is also using the default ProxySelector if you have instructed
it to use what is known in Apache HttpClient as <code>SystemDefaultRoutePlanner</code>.
</p>
<p>
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).
</p>
<p>
The ProxySelector is instantiated by the <i>Startup</i> module, but only
if module <i>Core</i> 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 <i>Core</i> 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 <a href="https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html">properties</a>).
</p>
<p>
Module <i>Core</i> 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.
</p>
<p>
<b>Proxy Auto-Config (PAC)</b>
</p>
<p>
Very often the proxy configuration on a corporate network is not
given explictly. Instead it is given in a little JavaScript file
which clients are supposed to download and execute in order to find
out which proxy to use. This is known as <a href="https://en.wikipedia.org/wiki/Proxy_auto-config">Proxy Auto-Config</a>
(or PAC). This module provides a pluggable PAC evaluation environment
based on available JavaScript engine installed in the JVM.
Execution of the downloaded JavaScript code is sandboxed.
</p>
<api name="org.netbeans.core.network.proxy.pac.impl.ALLOWED_PAC_ENGINES"type="export" category="stable" group="branding">
To further secure execution of downloaded scripts, it is possible
to restrict the set of allowed
<a href="@JDK@@JDKMODULE_JAVA_SCRIPTING@/javax/script/ScriptEngine.html">ScriptEngine</a>s
to evaluate the PAC scripts.
Provide a branding of bundle
<code>org.netbeans.core.network.proxy.pac.impl.Bundle</code>
in your own application
and change the value of <code>ALLOWED_PAC_ENGINES</code> key.
The default is <code>GraalVM:js,Graal.js,Nashorn</code> - e.g. the engines
currently considered secure.
</api>
<p>
If you don't like the PAC evaluation environment provided
by this module then you can plug in your own by registering
your own <code>PacScriptEvaluatorFactory</code> 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.
</p>
<p>
<b>Locating the PAC script (WPAD)</b>
</p>
<p>
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 <a href="https://en.wikipedia.org/wiki/Web_Proxy_Auto-Discovery_Protocol">WPAD</a>
This module currently only supports the case where URL is directly available
from the settings. There's no support for WPAD.
</p>
</answer>
<!-- <questionid="arch-usecases"when="init"> <hint> Contentofthisanswerwillbedisplayedaspartofpageat http://www.netbeans.org/download/dev/javadoc/usecases.html Youcanusetags<usecasename="name>regularhtmldescription</usecase> andifyouwanttouseanURLyoucanprefixifwith@TOP@tobegin attherootofyourjavadoc </hint> Describethemain<ahref="http://wiki.netbeans.org/API_Design#The_Importance_of_Being_Use_Case_Oriented"> usecases</a>ofthenewAPI.Whowilluseitunder whatcircumstances?Whatkindofcodewouldtypicallyneedtobewritten tousethemodule? </question>
-->
<answer id="arch-usecases">
<usecase name="Custom ProxySelector"id="custom-proxyselector">
You can provide your own ProxySelector instead of the one
provided by this module. You do this by registering your
own {@link java.net.ProxySelector}
in 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.
<api name="java.net.ProxySelector" category="standard" group="java"type="import"url="@JDK@@JDKMODULE_JAVA_BASE@/java/net/ProxySelector.html" />
</usecase>
<usecase name="Custom PAC Evaluator"id="custom-pac-evaluator">
You can plug in your own PAC evaluator if you are unhappy with
the {@link org.netbeans.core.network.proxy.pac.impl.NbPacScriptEvaluator default one}
provided in this module. You do this by registering your
own {@link org.netbeans.core.network.proxy.pac.PacScriptEvaluatorFactory}
in the Global Lookup. This factory must then in turn return an
instance of your custom {@link org.netbeans.core.network.proxy.pac.PacScriptEvaluator}.
<api name="org.netbeans.core.network.proxy.pac.PacScriptEvaluatorFactory" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/proxy/pac/PacScriptEvaluatorFactory.html" />
<api name="org.netbeans.core.network.proxy.pac.PacScriptEvaluator" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/proxy/pac/PacScriptEvaluator.html" />
</usecase>
<usecase name="Customizing the default PAC Evaluator"id="custom-pac-evaluator-helpers">
Instead of replacing all of the {@link org.netbeans.core.network.proxy.pac.impl.NbPacScriptEvaluator default PAC evaluator}
you can replace only its implementation of the <i>PAC Helper Functions</i>.
However, you have to play by rules set by the {@link org.netbeans.core.network.proxy.pac.impl.NbPacScriptEvaluator default PacScriptEvaluator},
namely that all the Helper Functions are implemented in Java (as opposed to JavaScript).
Simply register your sub-class of {@link org.netbeans.core.network.proxy.pac.PacHelperMethods}
in the Global Lookup and your implementation will automatically be picked
up. When creating your own <code>PacHelperMethods</code> you may
take benefit from the PAC utility functions provided by {@link org.netbeans.core.network.proxy.pac.PacUtils}
and {@link org.netbeans.core.network.proxy.pac.datetime.PacUtilsDateTime},
as well as the more general ones provided by {@link org.netbeans.core.network.utils network utils package}.
<api name="org.netbeans.core.network.proxy.pac.PacHelperMethods" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/proxy/pac/PacHelperMethods.html" />
<api name="org.netbeans.core.network.utils.HostnameUtils" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/utils/HostnameUtils.html" />
<api name="org.netbeans.core.network.utils.IpAddressUtils" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/utils/IpAddressUtils.html"/>
<api name="org.netbeans.core.network.utils.LocalAddressUtils" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/utils/LocalAddressUtils.html" />
<api name="org.netbeans.core.network.utils.SimpleObjCache" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/utils/SimpleObjCache.html"/>
<api name="org.netbeans.core.network.proxy.pac.PacUtils" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/proxy/pac/PacUtils.html" />
<api name="org.netbeans.core.network.proxy.pac.datetime.PacUtilsDateTime" category="friend" group="java"type="export"url="@TOP@/org/netbeans/core/network/proxy/pac/datetime/PacUtilsDateTime.html" />
</usecase>
</answer>
<!-- <questionid="arch-what"when="init"> Whatisthisprojectgoodfor? <hint> Pleaseprovidehereafewlinesdescribingtheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
<p>
The Core Network module provide ProxySelector as well as utilities related
to network connections.
</p>
</answer>
<!-- <questionid="compat-i18n"when="impl"> Isyourmodulecorrectlyinternationalized? <hint> Correctinternationalizationmeansthatitobeysinstructions at<ahref="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html"> NetBeansI18Npages</a>. </hint> </question>
-->
<answer id="compat-i18n">
<p>
XXX no answer for compat-i18n
</p>
</answer>
<!-- <questionid="compat-standards"when="init"> Doesthemoduleimplementordefineanystandards?Isthe implementationexactordoesitdeviatesomehow? </question>
-->
<answer id="compat-standards">
<p>
The module implements the <a href="https://en.wikipedia.org/wiki/Proxy_auto-config">Proxy-Auto Config (PAC)</a>
specification as first specified by Netscape and then later amended by Microsoft.
The PAC script is a small piece of JavaScript, typically downloaded from the network.
The purpose of the PAC script is to determine which proxy to use for a
given URL.
</p>
<p>
In particular the specification from Netscape was very vaque. This has led to various
inconsistencies between how browsers (or other software) has implemented
this. The implementation in this module aims to support just about
every corner case and to be as compatible as possible with how the PAC script is interpreted by various browsers. Whenever the standard is
ambigious, the implementation provided by the module deliberately
interprets the specification in the widest possible sense. More information in the Javadoc for
{@link org.netbeans.core.network.proxy.pac.impl.NbPacScriptEvaluator}.
</p>
</answer>
<!-- <questionid="dep-platform"when="init"> Onwhichplatformsdoesyourmodulerun?Doesitruninthesame wayoneach? <hint> IfyouplananydependencyonOSoranyusagefile)orfiles? pleasedescribewhyyouaredoingsoanddescribehowyouenvision bility. Pleasenotethatthereisasupportfor<ahref="&;=javaioFilename=yournametype""category=friend&;.&;/api&; enabledmodules</a>whichtogetherwithautoload/eagermodules canallowyoutoenabletoprovidethebestOSawaresupport onwhileprovidingcompatibilityjava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 supportedones. Alsopleaselistthesupported OSesplatformsmentionedversionofJDK foryourprojecttorunon.AlsostatewhetherJREisenoughor youreallyneedJDK. </hint> </question>
-->
<answer id="dep- in state it was beforeinstallation.
<p>
The module uses JNA to look up various information about the host.
Currently there' </intjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
KDE desktops noanswer for-
</p>
</answer>
<!-- <questionid="deploy-dependencies"when="final"> Whatdoothermodulesneedtodotodeclareadependencyonthisone, inadditiontoorinsteadofthenormalmoduledependencydeclaration (e.g.tokens/ <hint> Provideasampleoftheactuallinesyouwouldaddtoajava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 todeclareadependency,forexampleOpenIDE-Module-Requires:some.token. Ifothermodulesshouldnotdependonthismodule,orshouldjustusea simpleregularmoduledependency,youcanjustanswer"nothing".Ifyou intentionallyexposeasemistableAPItoclientsusingimplementation dependencies anexample<nswerid="deploy-ackages> < </question>
-->
p
XXX no answer for deploy-dependencies
/>
</answer>
<!-- <questionid="exec-reflection"when="impl"> DoesyourcodeuseJavaReflectiontoexecuteothercode? <hint> ThisusuallyindicatesamissingorinsufficientAPIintheother partofthesystem.Iftheothersideisnotawareofyourdependency thiscontractcanbeeasilybroken. </hint> </question>
-->
<answer id="exec-reflection">
p
For testing only a dirty hack is used in our <code>FakeDns</code> class.
This installs itself as a preferred name service in Java. This is done
via reflection. It also uses proprietary <code>sun.*</code> package.
However, it is only used for unit testing.
</p>
</answer>
<!-- <questionid="exec-threading"when="init"> Whatthreadingmodels,ifany,doesyourmoduleadhereto?Howthe projectbehaveswithrespecttothreading? <<> IsyourAPIthreadsafeCanitbeaccessedfromanythreadsor justjava.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 93 itsEventDispatchthread?Also ifyourmodulecallsforeignAPIswhichhaveaspecificthreadingmodel<> ,surethatisajava.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98 (synchronization,mutexes,etc.)applicabletothoseAPIs. IfyourmoduledefinesanyAPIs,orhascomplexinternalstructures thatmightbeusedfrommultiplethreads,declarehowyouprotect dataagainstconcurrentaccess,raceconditions,deadlocks,etc., andwhethersuchrulesareenforcedbyruntimewarnings,errors,assertions,etc. Examples:aclassmightbenon-thread-safe(likeJavaCollections);might befullythread-safe(internalquestionid="lookup-"when"init" (andmayormaynotoranysimilarfindanycomponentswithWhichones? mightbeabletorunonlyintheeventqueue;etc. Alsodescribewhenanyeventsarefired:synchronously,asynchronously,etc. Ideas:<ahref="http://core.netbeans.org/proposals/threading/index.html#recommendations">ThreadingRecommendations</a>(inprogress) </hint> </question>
-->
<answer id="exec-threading">
<p>
Documented in Javadoc where relevant.
</p>
</answer>
<!-- <questionid="lookup-register"when="final"> Doyouregisteranythingintolookupforothercodetofind? > Doyouregisterusinglayerfileorusingadeclarativeannotationsuchas<code>@ServiceProvider</code>? Whoissupposedtofindyourcomponent? </hint> </question>
-->
<answer id="lookup-register">
<
The, this module registers a If alot actions context, you can
the Global Lookup. It also registers a <code>PacScriptEvaluatorFactory</code>
which is used by the NetBeans ProxySelector itself.
</p>
</answer>
<!-- <questionid="perf-mem"when="final"> Howmuchmemorydoesyourcomponentconsume?Estimate witharelationtothenumberofwindows,etc. </question>
-->
<answer id="perf-mem">
<<hint
XXX no answer for perf-mem
</p>
</answer>
<!-- <</question> Doesyourmoduleusedynamicallyupdatedcontextmenus,or context-sensitiveactionswithcomplicatedandslowenablementlogic? <hint> Ifyoudoalotoftrickswhenaddingactionstoregularorcontextmenus,youcansignificantly slowdowndisplayofthemenu,evenwhentheuserisnotusingyouraction.Payattentionto actionsyouaddtothemainmenubar,andtocontextmenusofforeignnodesorcomponents.If theactionisconditionallyenabled,orchangesitsforeigncodetobeintoownmodule,how impactonperformance.Insomecasesitmaybemoreappropriatetomakeasimpleactionthatis alwaysenabled</uestionjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 </hint> <!-
-->
<module
<p>
Not applicable. There's no GUI in this module.
</p>
</
<!-- <questionid="perf-progress"when="final"> Doesyourmoduleexecuteanylong-runningtasks? >Longrunningshouldnever AWTthreadasitbadlyhurtstheUI <ahref="http://performance.netbeans.org/responsiveness/issues.html"> responsiveness</a>. Taskslikeconnectingover network,computinghugeamountofdata,compilation bedoneasynchronously(forexample using<code>RequestProcessor</code>),definitivelyitshould notblockAWTthread. </hint> </question>
-->
<answer id="perf-progress">
<p>
Yes. It executes tasks such as downloading PAC script from
network. This is done in a RequestProcessor.
It also provides utility methods for doing name lookup with
a timeout.
</p>
</answer>
<!-- <questionid="perf-spi"when="init"> Howtheperformance/answer> <hint> Ifyouallowforeigncodetobepluggedintoyourownmodule,how doyouenforcethatitwillbehavecorrectlyandquicklyandwillnot negativelyinfluencetheperformanceofyourownmodule? </hint> </question>
-->
<answer id="perf-spi">
<p>
XXX no answer for perf-spi
</p>
</answer>
<!-- <questionid="perf-startup"when="final"> Doesyourmodulerunanycodeonstartup? (uildmenutoolbar,windowlayout,oftemplatessetof
-->
<answer id="perf-startup/hint>
<p>
Yes. The initialization of the ProxySelector (i.e. calling its constructor)
is done as part of the platform<nswer id"esourceslayer"java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
it is done on the platform main thread. In other
to be quick as it <
this constructor is fairly lazy. For example it postpones download of
or be furtherimproved in terms
of startup speed.
</p>
</answer>
<!-- <questionid="perf-wakeup"when="final"> Doesanypieceofyourcodewakeupperiodicallyanddosomething evenwhenthesystemisotherwiseidle(nouserinteraction)? </question>
-->
<answer id you a fileprovidedby moduleyou depend
<p>
No
</p>
</answer>
<!-- <questionid="resources-file"when="final"> Doesyourmoduleuse<code>java.io.File</code>directly? <hint> NetBeansprovidealogicalwrapperoverplainfilescalled <code>org.openide.filesystems.FileObject</code>that providesuniformaccesstosuchresourcesandisthepreferred waythatshouldbeused.Butofcoursetherecanbesituationswhen thisisnotsuitable. </hint> </question>
-->
<answer id="resources-file">
< or regular JDKPreferences ?Does itread write orboth?java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
No
<>
</answer>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.