Class URLEncoder
java.lang.Object
org.alfresco.officeservices.testclient.util.URLEncoder
This class is similar to the well known
This class has been adopted from org.apache.catalina.util.URLEncoder from Tomcat 6.0.35 under the Apache license.
java.net.URLEncoder, but it does provide
a way to define the set of characters that should NOT be encoded.This class has been adopted from org.apache.catalina.util.URLEncoder from Tomcat 6.0.35 under the Apache license.
- Since:
- 2.8
- Author:
- Stefan Kopf, xaldon Technologies GmbH.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new URLEncoder and add the characters a-z, A-Z and 0-9 to the set of safe characters -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSafeCharacter(char c) Add the given character to the set of safe charactersEncode the given String by replacing all non safe characters by the sequence starting with the percent character followed by the two digit hex representation of that character.
The given path is represented as UTF-8.
-
Field Details
-
safeCharacters
set of safe characters that are not encoded
-
-
Constructor Details
-
URLEncoder
public URLEncoder()Create a new URLEncoder and add the characters a-z, A-Z and 0-9 to the set of safe characters
-
-
Method Details
-
addSafeCharacter
public void addSafeCharacter(char c) Add the given character to the set of safe characters- Parameters:
c- the character to be added to the set of safe characters
-
encode
Encode the given String by replacing all non safe characters by the sequence starting with the percent character followed by the two digit hex representation of that character.
The given path is represented as UTF-8.- Parameters:
path- the path to be encoded- Returns:
- the encoded path
-