Class PathWrapper

java.lang.Object
org.mozilla.javascript.ScriptableObject
helma.scripting.rhino.PathWrapper
All Implemented Interfaces:
Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable, org.mozilla.javascript.SymbolScriptable

public class PathWrapper extends org.mozilla.javascript.ScriptableObject
This class wraps around instances of helma.framework.core.RequestPath and exposes them in an array-like fashion to the JavaScript runtime.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject

    org.mozilla.javascript.ScriptableObject.KeyComparator
  • Field Summary

    Fields inherited from class org.mozilla.javascript.ScriptableObject

    CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

    Fields inherited from interface org.mozilla.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
    Zero arg constructor for creating the PathWrapper prototype.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Checks if the given object is contained in the request path
    get(int idx, org.mozilla.javascript.Scriptable start)
    Returns a path object in the wrapped path by property name.
    get(String name, org.mozilla.javascript.Scriptable start)
    Returns a path object in the wrapped path by property name.
     
    Return a primitive representation for this object.
    Returns a list of array indices 0..length-1.
    long
    Getter for length property.
    boolean
    has(int index, org.mozilla.javascript.Scriptable start)
    Checks if an object with the given index is contained in the path.
    boolean
    has(String name, org.mozilla.javascript.Scriptable start)
    Checks if an object with the given name is contained in the path.
    href(Object action)
    Returns the wrapped path rendered as URL path.
     

    Methods inherited from class org.mozilla.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • get

      public Object get(String name, org.mozilla.javascript.Scriptable start)
      Returns a path object in the wrapped path by property name.
      Specified by:
      get in interface org.mozilla.javascript.Scriptable
      Overrides:
      get in class org.mozilla.javascript.ScriptableObject
    • get

      public Object get(int idx, org.mozilla.javascript.Scriptable start)
      Returns a path object in the wrapped path by property name.
      Specified by:
      get in interface org.mozilla.javascript.Scriptable
      Overrides:
      get in class org.mozilla.javascript.ScriptableObject
    • has

      public boolean has(String name, org.mozilla.javascript.Scriptable start)
      Checks if an object with the given name is contained in the path.
      Specified by:
      has in interface org.mozilla.javascript.Scriptable
      Overrides:
      has in class org.mozilla.javascript.ScriptableObject
    • has

      public boolean has(int index, org.mozilla.javascript.Scriptable start)
      Checks if an object with the given index is contained in the path.
      Specified by:
      has in interface org.mozilla.javascript.Scriptable
      Overrides:
      has in class org.mozilla.javascript.ScriptableObject
    • getIds

      public Object[] getIds()
      Returns a list of array indices 0..length-1.
      Specified by:
      getIds in interface org.mozilla.javascript.Scriptable
      Overrides:
      getIds in class org.mozilla.javascript.ScriptableObject
    • getLength

      public long getLength()
      Getter for length property.
    • href

      public String href(Object action) throws UnsupportedEncodingException
      Returns the wrapped path rendered as URL path.
      Throws:
      UnsupportedEncodingException
    • contains

      public int contains(Object obj)
      Checks if the given object is contained in the request path
      Parameters:
      obj - the element to check
      Returns:
      the index of the element, or -1 if it isn't contained
    • getClassName

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

      public String toString()
      Overrides:
      toString in class Object
    • getDefaultValue

      public Object getDefaultValue(Class hint)
      Return a primitive representation for this object. FIXME: We always return a string representation.
      Specified by:
      getDefaultValue in interface org.mozilla.javascript.Scriptable
      Overrides:
      getDefaultValue in class org.mozilla.javascript.ScriptableObject
      Parameters:
      hint - the type hint
      Returns:
      the default value for the object