java.lang.Object
ScriptableObject
com.meterware.httpunit.javascript.JavaScript.JavaScriptEngine
com.meterware.httpunit.javascript.JavaScript.Location
- All Implemented Interfaces:
- com.meterware.httpunit.scripting.ScriptingEngine
- Enclosing class:
- JavaScript
- public static class JavaScript.Location
- extends JavaScript.JavaScriptEngine
|
Method Summary |
void |
clearCaches()
Clears any cached values, permitting them to be recomputed as needed. |
protected void |
discardDocumentWriteBuffer()
|
java.lang.String |
evaluateScriptExpression(java.lang.String urlString)
Evaluates the specified string as JavaScript. |
java.lang.String |
executeScript(java.lang.String language,
java.lang.String script)
Interprets the specified script, which may include global function definitions. |
java.lang.Object |
get(int i,
Scriptable scriptable)
|
java.lang.Object |
get(java.lang.String propertyName,
Scriptable scriptable)
|
java.lang.String |
getClassName()
|
java.lang.Object |
getDefaultValue(java.lang.Class typeHint)
Returns the default value of this scriptable object. |
protected java.lang.StringBuffer |
getDocumentWriteBuffer()
|
(package private) java.lang.String |
getID()
|
(package private) java.lang.String |
getName()
|
boolean |
has(java.lang.String propertyName,
Scriptable scriptable)
|
(package private) void |
initialize(JavaScript.JavaScriptEngine parent,
com.meterware.httpunit.scripting.ScriptableDelegate scriptable)
|
(package private) void |
initialize(JavaScript.Window window,
java.net.URL url)
|
void |
jsFunction_replace(java.lang.String urlString)
|
java.lang.String |
jsGet_host()
|
java.lang.String |
jsGet_hostname()
|
java.lang.String |
jsGet_href()
|
java.lang.String |
jsGet_pathname()
|
java.lang.String |
jsGet_port()
|
java.lang.String |
jsGet_protocol()
|
java.lang.String |
jsGet_search()
|
void |
jsSet_href(java.lang.String urlString)
|
void |
jsSet_pathname(java.lang.String newPath)
|
void |
jsSet_search(java.lang.String newSearch)
|
com.meterware.httpunit.scripting.ScriptingEngine |
newScriptingEngine(com.meterware.httpunit.scripting.ScriptableDelegate child)
Returns a new scripting engine for the specified delegate. |
boolean |
performEvent(java.lang.String eventScript)
Interprets the specified script and returns a boolean result. |
void |
put(java.lang.String propertyName,
Scriptable scriptable,
java.lang.Object value)
|
boolean |
supportsScriptLanguage(java.lang.String language)
Returns true if this engine supports the specified script. |
protected JavaScript.ElementArray |
toElementArray(com.meterware.httpunit.scripting.ScriptableDelegate[] scriptables)
|
(package private) java.lang.Object |
toScriptable(com.meterware.httpunit.scripting.ScriptableDelegate delegate)
Converts a scriptable delegate obtained from a subobject into the appropriate Rhino-compatible Scriptable. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
protected static java.lang.String |
toStringIfNotUndefined(java.lang.Object object)
|
_url
private java.net.URL _url
_window
private JavaScript.Window _window
_scriptable
protected com.meterware.httpunit.scripting.ScriptableDelegate _scriptable
_parent
protected JavaScript.JavaScriptEngine _parent
JavaScript.Location
public JavaScript.Location()
getClassName
public java.lang.String getClassName()
initialize
void initialize(JavaScript.Window window,
java.net.URL url)
jsFunction_replace
public void jsFunction_replace(java.lang.String urlString)
throws java.io.IOException,
org.xml.sax.SAXException
jsGet_href
public java.lang.String jsGet_href()
jsSet_href
public void jsSet_href(java.lang.String urlString)
throws org.xml.sax.SAXException,
java.io.IOException
jsGet_protocol
public java.lang.String jsGet_protocol()
jsGet_host
public java.lang.String jsGet_host()
jsGet_hostname
public java.lang.String jsGet_hostname()
jsGet_port
public java.lang.String jsGet_port()
jsGet_pathname
public java.lang.String jsGet_pathname()
jsSet_pathname
public void jsSet_pathname(java.lang.String newPath)
throws org.xml.sax.SAXException,
java.io.IOException
jsGet_search
public java.lang.String jsGet_search()
jsSet_search
public void jsSet_search(java.lang.String newSearch)
throws org.xml.sax.SAXException,
java.io.IOException
getDefaultValue
public java.lang.Object getDefaultValue(java.lang.Class typeHint)
- Returns the default value of this scriptable object. In this case, it returns simply the URL as a string.
Note that this method is necessary, since Rhino will only call the toString method directly if there are no
Rhino methods defined (jsGet_*, jsFunction_*, etc.)
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).
- Overrides:
toString in class JavaScript.JavaScriptEngine
supportsScriptLanguage
public boolean supportsScriptLanguage(java.lang.String language)
- Description copied from interface:
com.meterware.httpunit.scripting.ScriptingEngine
- Returns true if this engine supports the specified script.
- Specified by:
supportsScriptLanguage in interface com.meterware.httpunit.scripting.ScriptingEngine
executeScript
public java.lang.String executeScript(java.lang.String language,
java.lang.String script)
- Description copied from interface:
com.meterware.httpunit.scripting.ScriptingEngine
- Interprets the specified script, which may include global function definitions.
- Specified by:
executeScript in interface com.meterware.httpunit.scripting.ScriptingEngine
getDocumentWriteBuffer
protected java.lang.StringBuffer getDocumentWriteBuffer()
discardDocumentWriteBuffer
protected void discardDocumentWriteBuffer()
performEvent
public boolean performEvent(java.lang.String eventScript)
- Description copied from interface:
com.meterware.httpunit.scripting.ScriptingEngine
- Interprets the specified script and returns a boolean result.
- Specified by:
performEvent in interface com.meterware.httpunit.scripting.ScriptingEngine
evaluateScriptExpression
public java.lang.String evaluateScriptExpression(java.lang.String urlString)
- Evaluates the specified string as JavaScript. Will return null if the script has no return value.
- Specified by:
evaluateScriptExpression in interface com.meterware.httpunit.scripting.ScriptingEngine
initialize
void initialize(JavaScript.JavaScriptEngine parent,
com.meterware.httpunit.scripting.ScriptableDelegate scriptable)
throws org.xml.sax.SAXException,
PropertyException,
JavaScriptException,
NotAFunctionException
getName
java.lang.String getName()
getID
java.lang.String getID()
has
public boolean has(java.lang.String propertyName,
Scriptable scriptable)
get
public java.lang.Object get(java.lang.String propertyName,
Scriptable scriptable)
get
public java.lang.Object get(int i,
Scriptable scriptable)
put
public void put(java.lang.String propertyName,
Scriptable scriptable,
java.lang.Object value)
newScriptingEngine
public com.meterware.httpunit.scripting.ScriptingEngine newScriptingEngine(com.meterware.httpunit.scripting.ScriptableDelegate child)
- Description copied from interface:
com.meterware.httpunit.scripting.ScriptingEngine
- Returns a new scripting engine for the specified delegate.
- Specified by:
newScriptingEngine in interface com.meterware.httpunit.scripting.ScriptingEngine
clearCaches
public void clearCaches()
- Description copied from interface:
com.meterware.httpunit.scripting.ScriptingEngine
- Clears any cached values, permitting them to be recomputed as needed.
- Specified by:
clearCaches in interface com.meterware.httpunit.scripting.ScriptingEngine
toStringIfNotUndefined
protected static java.lang.String toStringIfNotUndefined(java.lang.Object object)
toScriptable
final java.lang.Object toScriptable(com.meterware.httpunit.scripting.ScriptableDelegate delegate)
- Converts a scriptable delegate obtained from a subobject into the appropriate Rhino-compatible Scriptable.
toElementArray
protected JavaScript.ElementArray toElementArray(com.meterware.httpunit.scripting.ScriptableDelegate[] scriptables)