Package org.apache.catalina.util
Class URLEncoder
java.lang.Object
org.apache.catalina.util.URLEncoder
- All Implemented Interfaces:
Cloneable
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
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSafeCharacter
(char c) clone()
Deprecated.Deprecated.This will be removed in Tomcat 9.0.xURL encodes the provided path using the given character set.void
removeSafeCharacter
(char c) void
setEncodeSpaceAsPlus
(boolean encodeSpaceAsPlus)
-
Field Details
-
DEFAULT
-
QUERY
-
-
Constructor Details
-
URLEncoder
public URLEncoder()
-
-
Method Details
-
addSafeCharacter
public void addSafeCharacter(char c) -
removeSafeCharacter
public void removeSafeCharacter(char c) -
setEncodeSpaceAsPlus
public void setEncodeSpaceAsPlus(boolean encodeSpaceAsPlus) -
encode
Deprecated.URL encodes the provided path using UTF-8.- Parameters:
path
- The path to encode- Returns:
- The encoded path
-
encode
Deprecated.This will be removed in Tomcat 9.0.xURL 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
-
encode
URL encodes the provided path using the given character set.- Parameters:
path
- The path to encodecharset
- The character set to use to convert the path to bytes- Returns:
- The encoded path
-
clone
-
encode(String, String)