public class URL extends Object
| Constructor and Description |
|---|
URL() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object object) |
String |
getHost()
Gets the host such as "www.google.com" if the URL is "http://www.google.com"
|
String |
getPassword()
Gets the password such as "test" if the URL is "http://root:test@www.google.com/"
or "t@st" if the URL is "http://root:t%40st@www.google.com/".
|
String |
getPath()
Gets the path such as "/" if the URL is "http://www.google.com/" or
"/My Documents/index.html" if the URL is "http://www.google.com/My+Documents/index.html".
|
Integer |
getPort()
Gets the port such as 80 if the URL specifically included a port such as
"http://www.google.com:80/".
|
String |
getProtocol()
Gets the protocol such as "http" if the URL is "http://www.google.com"
|
String |
getQuery()
Gets the query such as "id=1&pk=3" if the URL was "http://www.google.com/index.html?id=1&pk=3".
|
Properties |
getQueryProperties() |
String |
getQueryProperty(String name) |
String |
getUsername()
Gets the username such as "root" if the URL is "http://root@www.google.com/"
or "ro@t" if the URL is "http://ro%40t@www.google.com/".
|
int |
hashCode() |
static void |
parseQueryProperties(String q,
Properties props)
Tool function: queries a query string and adds the key/value pairs to the specified
properties map
|
void |
setHost(String host)
Sets the host such as "www.google.com" if the URL is "http://www.google.com"
|
void |
setPassword(String password)
Sets the password such as "test" if the URL is "http://root:test@www.google.com/"
or "t@st" if the URL is "http://root:t%40st@www.google.com/".
|
void |
setPath(String path)
Sets the path such as "/" if the URL is "http://www.google.com/" or
"/My Documents/index.html" if the URL is "http://www.google.com/My+Documents/index.html".
|
void |
setPort(Integer port)
Sets the port such as 80 if the URL should specifically include a port such as
"http://www.google.com:80/".
|
void |
setProtocol(String protocol)
Sets the protocol such as "http" if the URL is "http://www.google.com"
|
void |
setQuery(String value) |
void |
setUsername(String username)
Sets the username such as "root" if the URL is "http://root@www.google.com/"
or "ro@t" if the URL is "http://ro%40t@www.google.com/".
|
String |
toString()
Builds and returns a properly encoded URL in its full string form such as
"http://www.google.com/".
|
public String toString()
public void setProtocol(String protocol)
protocol - The protocol or null if not setpublic String getProtocol()
public void setUsername(String username)
username - The username in URL-decoded form or null if not setpublic String getUsername()
public void setPassword(String password)
username - The password in URL-decoded form or null if not setpublic String getPassword()
public void setHost(String host)
public String getHost()
public void setPort(Integer port)
public Integer getPort()
public void setPath(String path)
public String getPath()
public String getQuery()
public void setQuery(String value) throws MalformedURLException
MalformedURLExceptionpublic Properties getQueryProperties()
public static void parseQueryProperties(String q, Properties props) throws MalformedURLException
q - StringtoAddTo - PropertiesMalformedURLExceptionCopyright © 2012-2015 Cloudhopper by Twitter. All Rights Reserved.