All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.util.html.URLEncoder

java.lang.Object
   |
   +----com.ibm.as400.util.html.URLEncoder

public class URLEncoder
extends Object
The URLEncoder class encodes a string's delimiters for use in an HTML URL string. Information on encoding standards for Universal Resource Identifiers in WWW can be found at http://www.ietf.org/rfc/rfc1630.txt.

For example, the following HTML URL string is not valid and would need to be encoded:

  http://mySystem.myCompany.com/servlet/myServlet?parm1="/library/test1#partA"&parm2="/library/test2#partB"
  

The following example uses the URLEncoder class to encode two URL string parameter values:

  HTMLForm form = new HTMLForm();
  String action = "http://mySystem.myCompany.com/servlet/myServlet";
  String parm1 = "parm1=" + URLEncoder.encode("\"/library/test1#partA\"");
  String parm2 = "parm2=" + URLEncoder.encode("\"/library/test2#partB\"");
  form.setURL(action + "?" + parm1 + "&" + parm2);
  

The delimiters that are encoded include:


Constructor Index

 o URLEncoder()

Method Index

 o encode(String)
Encodes the URL.

Constructors

 o URLEncoder
 public URLEncoder()

Methods

 o encode
 public static String encode(String url)
Encodes the URL.

Parameters:
url - The URL to be encoded.
Returns:
The encoded string.

All Packages  Class Hierarchy  This Package  Previous  Next  Index