org.apache.catalina.util
Class URLEncoder
java.lang.Object
org.apache.catalina.util.URLEncoder
public class URLEncoder
- extends java.lang.Object
This class is very similar to the java.net.URLEncoder class.
Unfortunately, with java.net.URLEncoder there is no way to specify to the
java.net.URLEncoder which characters should NOT be encoded.
This code was moved from DefaultServlet.java
- Author:
- Craig R. McClanahan, Remy Maucherat
Method Summary |
void |
addSafeCharacter(char c)
|
java.lang.String |
encode(java.lang.String path)
Deprecated. Use encode(String, String) |
java.lang.String |
encode(java.lang.String path,
java.lang.String encoding)
URL encodes the provided path using the given encoding. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
hexadecimal
protected static final char[] hexadecimal
DEFAULT
public static final URLEncoder DEFAULT
safeCharacters
protected java.util.BitSet safeCharacters
URLEncoder
public URLEncoder()
addSafeCharacter
public void addSafeCharacter(char c)
encode
@Deprecated
public java.lang.String encode(java.lang.String path)
- Deprecated. Use
encode(String, String)
- URL encodes the provided path using UTF-8.
- Parameters:
path
- The path to encode
- Returns:
- The encoded path
encode
public java.lang.String encode(java.lang.String path,
java.lang.String encoding)
- URL encodes the provided path using the given encoding.
- Parameters:
path
- The path to encodeencoding
- The encoding to use to convert the path to bytes
- Returns:
- The encoded path
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.