public class URL extends Object implements Serializable, URLUtils
| Constructor and Description |
|---|
URL()
Makes a new URL, initially empty.
|
URL(String url)
Parses a URL from a string.
|
URL(String url,
String base)
http://www.w3.org/TR/url/#dom-url
Not implemented.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(String key,
String value)
Adds a parameter.
|
URL |
clone()
Deep clone of the URL.
|
static String |
domainToASCII(String domain)
Not implemented
|
static String |
domainToUnicode(String domain)
Not implemented
|
boolean |
endsWith(String suffix)
Does the path end with this suffix?
|
boolean |
equals(Object o)
Equality as URL:
if there is no port, uses default port for the scheme
ignores parameter order
|
String |
extension() |
URL |
extension(String e) |
String |
fragment() |
URL |
fragment(String f) |
String |
getExtension()
Gets the extension, without leading "." or null if there is none.
|
String |
getFragment() |
String |
getHash()
Gets the fragment, with initial "#", or empty string.
|
String |
getHost()
If non-standard port, returns server and post.
|
String |
getHostname() |
String |
getHref() |
String |
getMimeType()
Guesses the MIME type, or null
|
String |
getOrigin()
http://www.w3.org/TR/url/#concept-url-origin
|
String |
getParameter(String key)
Gets the first parameter value for this key, or null.
|
URLParameters |
getParameters()
May return empty parameters, but never null.
|
List<String> |
getParameters(String key)
Gets all parameter values for this key, or null.
|
String |
getPassword() |
String |
getPath() |
String |
getPathname() |
String |
getPort()
Gets the string representing the port that was put explicitly in the URL, or "".
|
String |
getProtocol()
Like "http:", with ":" at the end.
|
String |
getScheme() |
String |
getSearch()
Gets the query string, with initial "?", or null.
|
URLSearchParams |
getSearchParams() |
String |
getServer() |
String |
getUsername() |
String |
hash() |
URL |
hash(String h) |
String |
host() |
URL |
host(String h) |
String |
hostname() |
URL |
hostname(String n) |
String |
mimeType() |
String |
origin() |
String |
parameter(String key) |
URL |
parameter(String key,
String value) |
URLParameters |
parameters() |
List<String> |
parameters(String key) |
URL |
parameters(URLParameters ps)
Sets all parameters.
|
String |
password() |
URL |
password(String p) |
String |
path() |
URL |
path(String p) |
URL |
pop()
To pop a url’s path, if url’s scheme is not "file" or url’s path does
not contain a single string that is a normalized Windows drive letter,
remove url’s path’s last string, if any.
|
int |
port()
Gets the port, as int.
|
URL |
port(int p) |
String |
protocol() |
URL |
protocol(String p) |
URL |
removeFragment() |
URL |
removeParameter(String key) |
URL |
removeParameters() |
String |
scheme() |
URL |
scheme(String s) |
String |
server() |
URL |
server(String s) |
void |
setExtension(String extension) |
void |
setFragment(String f) |
void |
setHash(String h)
Sets the fragment.
|
void |
setHost(String h)
Sets server and maybe also port.
|
void |
setHostname(String n) |
void |
setHref(String input)
Sets the URL to the URL parsed from input.
|
void |
setParameter(String key,
String value)
Sets a parameter.
|
void |
setParameters(URLParameters ps)
Sets all parameters.
|
void |
setPassword(String p) |
void |
setPath(String p)
Sets the path.
|
void |
setPathname(String p) |
void |
setPort(int p) |
void |
setPort(String s) |
void |
setProtocol(String p) |
void |
setScheme(String s) |
void |
setSearch(String s) |
void |
setSearchParams(URLSearchParams ps) |
void |
setServer(String s) |
void |
setUsername(String u) |
String |
toString()
The complete URL as String.
|
String |
username() |
URL |
username(String u) |
public URL()
public URL(String url)
public String getScheme()
public void setScheme(String s)
public String scheme()
public void setProtocol(String p)
setProtocol in interface URLUtilspublic String getProtocol()
getProtocol in interface URLUtilspublic String protocol()
public void setUsername(String u)
setUsername in interface URLUtilspublic String getUsername()
getUsername in interface URLUtilspublic String username()
public void setPassword(String p)
setPassword in interface URLUtilspublic String getPassword()
getPassword in interface URLUtilspublic String password()
public String getServer()
public void setServer(String s)
public String server()
public void setHostname(String n)
setHostname in interface URLUtilspublic String getHostname()
getHostname in interface URLUtilspublic String hostname()
public String getPort()
public int port()
public URL port(int p)
public void setHost(String h)
public String getHost()
public String host()
public String getOrigin()
public String origin()
public void setPath(String p)
public String getPath()
public String path()
public void setPathname(String p)
setPathname in interface URLUtilspublic String getPathname()
getPathname in interface URLUtilspublic URL pop()
public String getExtension()
public String extension()
public void setExtension(String extension)
extension - Like "html", without leading "."
If the extension is null, removes the exception.public String getParameter(String key)
public List<String> getParameters(String key)
public void addParameter(String key, String value)
public void setParameter(String key, String value)
public URLParameters getParameters()
public URLParameters parameters()
public void setParameters(URLParameters ps)
public URL parameters(URLParameters ps)
public URL removeParameters()
public void setSearchParams(URLSearchParams ps)
setSearchParams in interface URLUtilspublic URLSearchParams getSearchParams()
getSearchParams in interface URLUtilspublic String getSearch()
public boolean endsWith(String suffix)
public String fragment()
public String getFragment()
public void setFragment(String f)
public URL removeFragment()
public void setHash(String h)
public String getHash()
public String hash()
public String toString()
public void setHref(String input)
public String getMimeType()
public String mimeType()
public boolean equals(Object o)
Copyright © 2016. All rights reserved.