public class NbPacScriptEvaluatorFactory extends Object implements PacScriptEvaluatorFactory
PacScriptEvaluatorFactory
.
Returns an instance of NbPacScriptEvaluator
.
Constructor and Description |
---|
NbPacScriptEvaluatorFactory() |
Modifier and Type | Method and Description |
---|---|
PacScriptEvaluator |
createPacScriptEvaluator(String pacSource)
Creates a PAC evaluator based on the given JavaScript source code.
|
PacScriptEvaluator |
getNoOpEvaluator()
Gets a no-op PAC evaluator, meaning one which always returns
Proxy.NO_PROXY
for any call to PacScriptEvaluator.findProxyForURL(java.net.URI) |
public PacScriptEvaluator createPacScriptEvaluator(String pacSource) throws PacParsingException
PacScriptEvaluatorFactory
The evaluator must treat the pacSource
as untrusted and evaluate
it in a sandbox.
The method will throw PacParsingException
if the JavaScript input
cannot be parsed/interpreted. In this case you may opt to either do
nothing, report to logging system or use a
no-op evaluator
as an alternative.
createPacScriptEvaluator
in interface PacScriptEvaluatorFactory
pacSource
- The JavaScript source code of the PAC script, as a string.
To be a correct PAC script, it must implement the
FindProxyForURL(url, host)
function. Most often the PAC script
is downloaded from a network location.PacParsingException
- if the source code cannot be parsedpublic PacScriptEvaluator getNoOpEvaluator()
PacScriptEvaluatorFactory
Proxy.NO_PROXY
for any call to PacScriptEvaluator.findProxyForURL(java.net.URI)
getNoOpEvaluator
in interface PacScriptEvaluatorFactory