java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.URL
- All Implemented Interfaces:
Serializable,Cloneable,org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
A JavaScript object for
URL.- Author:
- Ahmed Ashour, Ronald Brill, cd alexndr, Lai Quang Duong
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction -
Field Summary
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
isSealedFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateObjectURL(Object fileOrBlob) The URL.createObjectURL() static method creates a DOMString containing a URL representing the object given in parameter.getDefaultValue(Class<?> hint) Calls for instance for implicit conversion to string.getHash()getHost()getHref()getPort()voidjsConstructor(String url, Object base) Creates an instance.Returns the text of the URL.static voidrevokeObjectURL(org.htmlunit.corejs.javascript.Scriptable objectURL) voidSets thehashproperty.voidSets thehostproperty.voidsetHostname(String hostname) Sets thehostnameproperty.voidSets thehrefproperty.voidsetPassword(String password) Sets thepasswordproperty.voidsetPathname(String path) Sets thepathproperty.voidSets theportproperty.voidsetProtocol(String protocol) Sets theprotocolproperty.voidSets thesearchproperty.voidsetSearch(List<NameValuePair> nameValuePairs) Sets thesearchproperty based onNameValuePair's.voidsetUsername(String username) Sets theusernameproperty.toJSON()Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowOrWorkerGlobalScope, getWithPreemption, has, hasInstance, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setupPromise, setupRejectedPromiseMethods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, sizeMethods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMapsMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.htmlunit.corejs.javascript.Scriptable
get, getIds, has, hasMethods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable
get, has
-
Constructor Details
-
URL
public URL()
-
-
Method Details
-
jsConstructor
Creates an instance.- Parameters:
url- a string representing an absolute or relative URL. If url is a relative URL, base is required, and will be used as the base URL. If url is an absolute URL, a given base will be ignored.base- a string representing the base URL to use in case url is a relative URL. If not specified, it defaults to ''.
-
createObjectURL
The URL.createObjectURL() static method creates a DOMString containing a URL representing the object given in parameter. The URL lifetime is tied to the document in the window on which it was created. The new object URL represents the specified File object or Blob object.- Parameters:
fileOrBlob- Is a File object or a Blob object to create a object URL for.- Returns:
- the url
-
revokeObjectURL
public static void revokeObjectURL(org.htmlunit.corejs.javascript.Scriptable objectURL) - Parameters:
objectURL- String representing the object URL that was created by calling URL.createObjectURL().
-
getHash
- Returns:
- hash property of the URL containing a '#' followed by the fragment identifier of the URL.
-
setHash
Sets thehashproperty.- Parameters:
fragment- thehashproperty- Throws:
MalformedURLException
-
getHost
- Returns:
- the host, that is the hostname, and then, if the port of the URL is nonempty, a ':', followed by the port of the URL.
-
setHost
Sets thehostproperty.- Parameters:
host- thehostproperty- Throws:
MalformedURLException
-
getHostname
- Returns:
- the host, that is the hostname, and then, if the port of the URL is nonempty, a ':', followed by the port of the URL.
-
setHostname
Sets thehostnameproperty.- Parameters:
hostname- thehostnameproperty- Throws:
MalformedURLException
-
getHref
- Returns:
- whole URL
-
setHref
Sets thehrefproperty.- Parameters:
href- thehrefproperty- Throws:
MalformedURLException
-
getOrigin
- Returns:
- the origin
-
getSearchParams
- Returns:
- a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL.
-
getPassword
- Returns:
- the password specified before the domain name.
-
setPassword
Sets thepasswordproperty.- Parameters:
password- thepasswordproperty- Throws:
MalformedURLException
-
getPathname
- Returns:
- a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL.
-
setPathname
Sets thepathproperty.- Parameters:
path- thepathproperty- Throws:
MalformedURLException
-
getPort
- Returns:
- the port number of the URL. If the URL does not contain an explicit port number, it will be set to ''
-
setPort
Sets theportproperty.- Parameters:
port- theportproperty- Throws:
MalformedURLException
-
getProtocol
- Returns:
- the protocol scheme of the URL, including the final ':'.
-
setProtocol
Sets theprotocolproperty.- Parameters:
protocol- theprotocolproperty- Throws:
MalformedURLException
-
getSearch
- Returns:
- the query string containing a '?' followed by the parameters of the URL
-
setSearch
Sets thesearchproperty.- Parameters:
search- thesearchproperty- Throws:
MalformedURLException
-
setSearch
Sets thesearchproperty based onNameValuePair's.- Parameters:
nameValuePairs- the pairs- Throws:
MalformedURLException- in case of error
-
getUsername
- Returns:
- the username specified before the domain name.
-
setUsername
Sets theusernameproperty.- Parameters:
username- theusernameproperty- Throws:
MalformedURLException
-
getDefaultValue
Calls for instance for implicit conversion to string.- Specified by:
getDefaultValuein interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getDefaultValuein classHtmlUnitScriptable- Parameters:
hint- the type hint- Returns:
- the default value
- See Also:
-
toJSON
- Returns:
- a serialized version of the URL, although in practice it seems to have the same effect as URL.toString().
-
jsToString
Returns the text of the URL.- Returns:
- the text
-