com.gargoylesoftware.htmlunit.javascript.host
Class Location

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Location
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class Location
extends SimpleScriptable

A JavaScript object for a Location.

Version:
$Revision: 1.3 $
Author:
Mike Bowler, Michael Ottati, Marc Guillemot, Chris Erskine, Daniel Gredler, David K. Taylor, Ahmed Ashour
See Also:
MSDN Documentation, Serialized Form

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
Location()
 Creates an instance.
 
Method Summary
 java.lang.Object getDefaultValue(java.lang.Class hint)
 Return the javascript default value of this object.
 void initialize(Window window)
 Initializes the object.
 void jsxFunction_assign(java.lang.String url)
 Loads the new HTML document corresponding to the specified URL.
 void jsxFunction_reload(boolean force)
 Reloads the current page, possibly forcing retrieval from the server even if the browser cache contains the latest version of the document.
 void jsxFunction_replace(java.lang.String url)
 Reloads the window using the specified URL.
 java.lang.String jsxFunction_toString()
 Returns the location URL.
 java.lang.String jsxGet_hash()
 Returns the hash portion of the location URL (the portion following the '#').
 java.lang.String jsxGet_host()
 Returns the host portion of the location URL (the '[hostname]:[port]' portion).
 java.lang.String jsxGet_hostname()
 Returns the hostname portion of the location URL.
 java.lang.String jsxGet_href()
 Returns the location URL.
 java.lang.String jsxGet_pathname()
 Returns the pathname portion of the location URL.
 java.lang.String jsxGet_port()
 Returns the port portion of the location URL.
 java.lang.String jsxGet_protocol()
 Returns the protocol portion of the location URL, including the trailing ':'.
 java.lang.String jsxGet_search()
 Returns the search portion of the location URL (the portion following the '?').
 void jsxSet_hash(java.lang.String hash)
 Sets the hash portion of the location URL (the portion following the '#').
 void jsxSet_host(java.lang.String host)
 Sets the host portion of the location URL (the '[hostname]:[port]' portion).
 void jsxSet_hostname(java.lang.String hostname)
 Sets the hostname portion of the location URL.
 void jsxSet_href(java.lang.String newLocation)
 Set the location URL to an entirely new value.
 void jsxSet_pathname(java.lang.String pathname)
 Sets the pathname portion of the location URL.
 void jsxSet_port(java.lang.String port)
 Sets the port portion of the location URL.
 void jsxSet_protocol(java.lang.String protocol)
 Sets the protocol portion of the location URL.
 void jsxSet_search(java.lang.String search)
 Sets the search portion of the location URL (the portion following the '?').
 java.lang.String toString()
 Returns the string value of the location, which is the full URL string.
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
get, getBooleanArg, getClassName, getDomNodeOrDie, getDomNodeOrNull, getHtmlElementOrDie, getHtmlElementOrNull, getIntArg, getObjectArg, getStringArg, makeScriptableFor, setDomNode, setHtmlElement
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Location

public Location()
Creates an instance. JavaScript objects must have a default constructor.

Method Detail

getDefaultValue

public java.lang.Object getDefaultValue(java.lang.Class hint)
Return the javascript default value of this object. This is the javascript equivalent of a toString() in java.

Specified by:
getDefaultValue in interface org.mozilla.javascript.Scriptable
Overrides:
getDefaultValue in class SimpleScriptable
Parameters:
hint - A hint as to the format of the default value. Ignored in this case.
Returns:
The default value.

initialize

public void initialize(Window window)
Initializes the object.

Parameters:
window - The window that this location belongs to.

jsxFunction_assign

public void jsxFunction_assign(java.lang.String url)
                        throws java.io.IOException
Loads the new HTML document corresponding to the specified URL.

Parameters:
url - The location of the new HTML document to load.
Throws:
java.io.IOException - If loading the specified location fails.
See Also:
MSDN Documentation

jsxFunction_reload

public void jsxFunction_reload(boolean force)
                        throws java.io.IOException
Reloads the current page, possibly forcing retrieval from the server even if the browser cache contains the latest version of the document.

Parameters:
force - If true, force reload from server; otherwise, may reload from cache.
Throws:
java.io.IOException - When there is a problem reloading the page.
See Also:
MSDN Documentation

jsxFunction_replace

public void jsxFunction_replace(java.lang.String url)
                         throws java.io.IOException
Reloads the window using the specified URL.

Parameters:
url - The new URL to use to reload the window.
Throws:
java.io.IOException - When there is a problem loading the new page.
See Also:
MSDN Documentation

jsxFunction_toString

public java.lang.String jsxFunction_toString()
Returns the location URL.

Returns:
the location URL.

jsxGet_hash

public java.lang.String jsxGet_hash()
Returns the hash portion of the location URL (the portion following the '#').

Returns:
The hash portion of the location URL.
See Also:
MSDN Documentation

jsxGet_host

public java.lang.String jsxGet_host()
Returns the host portion of the location URL (the '[hostname]:[port]' portion).

Returns:
The host portion of the location URL.
See Also:
MSDN Documentation

jsxGet_hostname

public java.lang.String jsxGet_hostname()
Returns the hostname portion of the location URL.

Returns:
The hostname portion of the location URL.
See Also:
MSDN Documentation

jsxGet_href

public java.lang.String jsxGet_href()
Returns the location URL.

Returns:
The location URL.
See Also:
MSDN Documentation

jsxGet_pathname

public java.lang.String jsxGet_pathname()
Returns the pathname portion of the location URL.

Returns:
The pathname portion of the location URL.
See Also:
MSDN Documentation

jsxGet_port

public java.lang.String jsxGet_port()
Returns the port portion of the location URL.

Returns:
The port portion of the location URL.
See Also:
MSDN Documentation

jsxGet_protocol

public java.lang.String jsxGet_protocol()
Returns the protocol portion of the location URL, including the trailing ':'.

Returns:
The protocol portion of the location URL, including the trailing ':'.
See Also:
MSDN Documentation

jsxGet_search

public java.lang.String jsxGet_search()
Returns the search portion of the location URL (the portion following the '?').

Returns:
The search portion of the location URL.
See Also:
MSDN Documentation

jsxSet_hash

public void jsxSet_hash(java.lang.String hash)
                 throws java.lang.Exception
Sets the hash portion of the location URL (the portion following the '#').

Parameters:
hash - The new hash portion of the location URL.
Throws:
java.lang.Exception - If an error occurs.
See Also:
MSDN Documentation

jsxSet_host

public void jsxSet_host(java.lang.String host)
                 throws java.lang.Exception
Sets the host portion of the location URL (the '[hostname]:[port]' portion).

Parameters:
host - The new host portion of the location URL.
Throws:
java.lang.Exception - If an error occurs.
See Also:
MSDN Documentation

jsxSet_hostname

public void jsxSet_hostname(java.lang.String hostname)
                     throws java.lang.Exception
Sets the hostname portion of the location URL.

Parameters:
hostname - The new hostname portion of the location URL.
Throws:
java.lang.Exception - If an error occurs.
See Also:
MSDN Documentation

jsxSet_href

public void jsxSet_href(java.lang.String newLocation)
                 throws java.io.IOException
Set the location URL to an entirely new value.

Parameters:
newLocation - The new location URL.
Throws:
java.io.IOException - If loading the specified location fails.
See Also:
MSDN Documentation

jsxSet_pathname

public void jsxSet_pathname(java.lang.String pathname)
                     throws java.lang.Exception
Sets the pathname portion of the location URL.

Parameters:
pathname - The new pathname portion of the location URL.
Throws:
java.lang.Exception - If an error occurs.
See Also:
MSDN Documentation

jsxSet_port

public void jsxSet_port(java.lang.String port)
                 throws java.lang.Exception
Sets the port portion of the location URL.

Parameters:
port - The new port portion of the location URL.
Throws:
java.lang.Exception - If an error occurs.
See Also:
MSDN Documentation

jsxSet_protocol

public void jsxSet_protocol(java.lang.String protocol)
                     throws java.lang.Exception
Sets the protocol portion of the location URL.

Parameters:
protocol - The new protocol portion of the location URL.
Throws:
java.lang.Exception - If an error occurs.
See Also:
MSDN Documentation

jsxSet_search

public void jsxSet_search(java.lang.String search)
                   throws java.lang.Exception
Sets the search portion of the location URL (the portion following the '?').

Parameters:
search - The new search portion of the location URL.
Throws:
java.lang.Exception - If an error occurs.
See Also:
MSDN Documentation

toString

public java.lang.String toString()
Returns the string value of the location, which is the full URL string.

Overrides:
toString in class java.lang.Object
Returns:
The full URL string.


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.