public interface PacScriptEvaluator
This is a bridge between Java and the PAC script, which is implemented in
JavaScript. PacScriptEvaluator
s are created via
PacScriptEvaluatorFactory
.
Modifier and Type | Method and Description |
---|---|
List<Proxy> |
findProxyForURL(URI uri)
Returns the proxy/proxies appropriate to use for the given URI.
|
String |
getEngineInfo()
Gets relevant information about the engine, typically the name
of the JavaScript engine, version number, etc.
|
String |
getJsEntryFunction()
Gets the entry function to the PAC script which the engine uses.
|
String |
getPacScriptSource()
Gets the JavaScript source code of the PAC script.
|
boolean |
usesCaching()
Returns if the Evaluator uses result caching or not.
|
List<Proxy> findProxyForURL(URI uri) throws PacValidationException
The method calls the JavaScript FindProxyForURL(url, host)
function in the PAC script (or alternatively the
FindProxyForURLEx(url, host)
function), parses the result and
returns it as a prioritized list of proxies.
uri
- URI to get proxies for.PacValidationException
- when the result from the JavaScript function
cannot be interpreted.boolean usesCaching()
PacScriptEvaluator.findProxyForURL(java.net.URI)
will
not result in a call to JavaScript function FindProxyForURL
if the URL has been resolved previously. But the Evaluator cannot use
caching if the PAC Script uses methods which depends on time and the Evaluator
may therefore have decided to turn off result caching.
If an implementation of PacScriptEvaluator
never uses result caching
(because it simply isn't implemented) then this method will always return
false
.
String getJsEntryFunction()
String getEngineInfo()
String getPacScriptSource()