public class WebUtilities extends Object
Modifier and Type | Method and Description |
---|---|
static String |
getCurrentPageName()
Retrieve the name of the current ZHTML file being shown by a CloudSpace
web application, such as "index.zhtml" or "lab02.zhtml".
|
static String |
getCurrentPagePath()
Retrieve the relative path name of the current ZHTML file being shown
by a CloudSpace web application, such as "/Fall09/mypid/index.zhtml"
or "/Fall09/mypid/lab02/lab02.zhtml".
|
static String |
getPageParameter(String name)
Get a parameter passed to this web page in the query part of the URL.
|
static void |
showWebPage(String url)
Cause a CloudSpace web application to show a different web page in
the user's web browser.
|
static String |
urlDecode(String content)
Decodes a string extracted from a URL parameter.
|
static String |
urlEncode(String content)
Encodes a string for use in a URL.
|
static URL |
urlFor(String url)
Creates a URL object from a string, without throwing declared
exceptions.
|
public static String urlEncode(String content)
URLEncoder.encode(String,String)
, using a UTF-8 encoding and
turning any exceptions into RuntimeExceptions.content
- The string to encodepublic static String urlDecode(String content)
URLDecoder.decode(String,String)
, using a UTF-8 encoding and
turning any exceptions into RuntimeExceptions.content
- The string to decodepublic static URL urlFor(String url)
url
- The url as a stringpublic static void showWebPage(String url)
url
- The URL of the new web page to show in the user's browser.public static String getCurrentPageName()
public static String getCurrentPagePath()
public static String getPageParameter(String name)
name
- The name of the parameter to retrieve.