org.jurvis.net
Class JvRhinoConfigEvaluator

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by org.jurvis.net.JvRhinoConfigEvaluator
All Implemented Interfaces:
Serializable, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class JvRhinoConfigEvaluator
extends org.mozilla.javascript.ScriptableObject

A class to evaluate a proxy auto-config file using the Mozilla RhinoJavascript engine.

Author:
Neil W. Weber
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
DONTENUM, EMPTY, PERMANENT, READONLY
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
JvRhinoConfigEvaluator()
           
 
Method Summary
static boolean dnsDomainIs(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)
          Return true iff the domain of hostname matches.
static List evaluate(String scriptURL, URI uri)
          Evaluate the specified proxy auto-config script and return the list of proxies to be used to access the specified URI.
 String getClassName()
           
static boolean isInNet(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)
          Return true iff the IP address of the host matches the specified IP address pattern.
static boolean isPlainHostName(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)
          Return true iff there is no domain in the hostname (no dots).
static boolean isResolvable(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)
          Return true if the host can be resolved via DNS.
static boolean localHostOrDomainIs(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)
          Return true if the hostname matches exactly the specified hostname, or if there is no domain name part in the hostname, but the unqualified hostname matches.
static void main(String[] args)
           
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, callMethod, defineClass, defineClass, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, has, has, hasInstance, hasProperty, hasProperty, isSealed, put, put, putProperty, putProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JvRhinoConfigEvaluator

public JvRhinoConfigEvaluator()
Method Detail

evaluate

public static List evaluate(String scriptURL,
                            URI uri)
                     throws Exception
Evaluate the specified proxy auto-config script and return the list of proxies to be used to access the specified URI.

Parameters:
scriptURL - the URL of the auto-config script
uri - the URI of the desired resource
Returns:
an ordered list of JvProxyInfos or null if no proxies should be used (i.e. connect directly)
Throws:
Exception

getClassName

public String getClassName()
Specified by:
getClassName in interface org.mozilla.javascript.Scriptable
Specified by:
getClassName in class org.mozilla.javascript.ScriptableObject

isPlainHostName

public static boolean isPlainHostName(org.mozilla.javascript.Context cx,
                                      org.mozilla.javascript.Scriptable thisObj,
                                      Object[] args,
                                      org.mozilla.javascript.Function funObj)
Return true iff there is no domain in the hostname (no dots).


dnsDomainIs

public static boolean dnsDomainIs(org.mozilla.javascript.Context cx,
                                  org.mozilla.javascript.Scriptable thisObj,
                                  Object[] args,
                                  org.mozilla.javascript.Function funObj)
Return true iff the domain of hostname matches.


localHostOrDomainIs

public static boolean localHostOrDomainIs(org.mozilla.javascript.Context cx,
                                          org.mozilla.javascript.Scriptable thisObj,
                                          Object[] args,
                                          org.mozilla.javascript.Function funObj)
Return true if the hostname matches exactly the specified hostname, or if there is no domain name part in the hostname, but the unqualified hostname matches.


isResolvable

public static boolean isResolvable(org.mozilla.javascript.Context cx,
                                   org.mozilla.javascript.Scriptable thisObj,
                                   Object[] args,
                                   org.mozilla.javascript.Function funObj)
Return true if the host can be resolved via DNS.


isInNet

public static boolean isInNet(org.mozilla.javascript.Context cx,
                              org.mozilla.javascript.Scriptable thisObj,
                              Object[] args,
                              org.mozilla.javascript.Function funObj)
                       throws Exception
Return true iff the IP address of the host matches the specified IP address pattern.

Throws:
Exception

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.