com.gargoylesoftware.htmlunit.javascript.host
Class Location

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Location
All Implemented Interfaces:
Serializable, Cloneable, Map, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Scriptable

public class Location
extends SimpleScriptable

A JavaScript object for a Location.

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
Location()
          Creates an instance.
 
Method Summary
 Object getDefaultValue(Class<?> hint)
          Returns the JavaScript default value of this object.
 void initialize(Window window)
          Initializes the object.
 void jsxFunction_assign(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(String url)
          Reloads the window using the specified URL via a postponed action.
 String jsxFunction_toString()
          Returns the location URL.
 String jsxGet_hash()
          Returns the hash portion of the location URL (the portion following the '#').
 String jsxGet_host()
          Returns the host portion of the location URL (the '[hostname]:[port]' portion).
 String jsxGet_hostname()
          Returns the hostname portion of the location URL.
 String jsxGet_href()
          Returns the location URL.
 String jsxGet_pathname()
          Returns the pathname portion of the location URL.
 String jsxGet_port()
          Returns the port portion of the location URL.
 String jsxGet_protocol()
          Returns the protocol portion of the location URL, including the trailing ':'.
 String jsxGet_search()
          Returns the search portion of the location URL (the portion following the '?').
 void jsxSet_hash(String hash)
          Sets the hash portion of the location URL (the portion following the '#').
 void jsxSet_host(String host)
          Sets the host portion of the location URL (the '[hostname]:[port]' portion).
 void jsxSet_hostname(String hostname)
          Sets the hostname portion of the location URL.
 void jsxSet_href(String newLocation)
          Sets the location URL to an entirely new value.
 void jsxSet_pathname(String pathname)
          Sets the pathname portion of the location URL.
 void jsxSet_port(String port)
          Sets the port portion of the location URL.
 void jsxSet_protocol(String protocol)
          Sets the protocol portion of the location URL.
 void jsxSet_search(String search)
          Sets the search portion of the location URL (the portion following the '?').
 String toString()
          Returns the string value of the location, which is the full URL string.
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, clear, containsKey, containsValue, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, entrySet, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, keySet, preventExtensions, put, put, put, putAll, putConst, putConstProperty, putProperty, putProperty, redefineProperty, remove, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size, values
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

Location

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

Method Detail

initialize

public void initialize(Window window)
Initializes the object.

Parameters:
window - the window that this location belongs to

getDefaultValue

public Object getDefaultValue(Class<?> hint)
Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java.

Specified by:
getDefaultValue in interface net.sourceforge.htmlunit.corejs.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

toString

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

Overrides:
toString in class Object
Returns:
the full URL string

jsxFunction_assign

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

Parameters:
url - the location of the new HTML document to load
Throws:
IOException - if loading the specified location fails
See Also:
MSDN Documentation

jsxFunction_reload

public void jsxFunction_reload(boolean force)
                        throws 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:
IOException - if there is a problem reloading the page
See Also:
MSDN Documentation

jsxFunction_replace

public void jsxFunction_replace(String url)
                         throws IOException
Reloads the window using the specified URL via a postponed action.

Parameters:
url - the new URL to use to reload the window
Throws:
IOException - if loading the specified location fails
See Also:
MSDN Documentation

jsxFunction_toString

public String jsxFunction_toString()
Returns the location URL.

Returns:
the location URL

jsxGet_href

public String jsxGet_href()
Returns the location URL.

Returns:
the location URL
See Also:
MSDN Documentation

jsxSet_href

public void jsxSet_href(String newLocation)
                 throws IOException
Sets the location URL to an entirely new value.

Parameters:
newLocation - the new location URL
Throws:
IOException - if loading the specified location fails
See Also:
MSDN Documentation

jsxGet_search

public 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_search

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

Parameters:
search - the new search portion of the location URL
Throws:
Exception - if an error occurs
See Also:
MSDN Documentation

jsxGet_hash

public 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

jsxSet_hash

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

Parameters:
hash - the new hash portion of the location URL
See Also:
MSDN Documentation

jsxGet_hostname

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

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

jsxSet_hostname

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

Parameters:
hostname - the new hostname portion of the location URL
Throws:
Exception - if an error occurs
See Also:
MSDN Documentation

jsxGet_host

public 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

jsxSet_host

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

Parameters:
host - the new host portion of the location URL
Throws:
Exception - if an error occurs
See Also:
MSDN Documentation

jsxGet_pathname

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

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

jsxSet_pathname

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

Parameters:
pathname - the new pathname portion of the location URL
Throws:
Exception - if an error occurs
See Also:
MSDN Documentation

jsxGet_port

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

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

jsxSet_port

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

Parameters:
port - the new port portion of the location URL
Throws:
Exception - if an error occurs
See Also:
MSDN Documentation

jsxGet_protocol

public 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

jsxSet_protocol

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

Parameters:
protocol - the new protocol portion of the location URL
Throws:
Exception - if an error occurs
See Also:
MSDN Documentation


Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.