Backported import and declaration cleanup

This commit is contained in:
Juergen Hoeller
2015-12-18 00:18:09 +01:00
parent d59a97c101
commit 6f2f3595e9
13 changed files with 4 additions and 45 deletions

View File

@@ -18,7 +18,6 @@ package org.springframework.web.util;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.util.regex.Pattern;
import org.springframework.util.Assert;
@@ -26,11 +25,11 @@ import org.springframework.util.Assert;
* Utility class for URI encoding and decoding based on RFC 3986.
* Offers encoding methods for the various URI components.
*
* <p>All {@code encode*(String, String} methods in this class operate in a similar way:
* <p>All {@code encode*(String, String)} methods in this class operate in a similar way:
* <ul>
* <li>Valid characters for the specific URI component as defined in RFC 3986 stay the same.</li>
* <li>All other characters are converted into one or more bytes in the given encoding scheme.
* Each of the resulting bytes is written as a hexadecimal string in the "{@code %<i>xy</i>}"
* Each of the resulting bytes is written as a hexadecimal string in the "<code>%<i>xy</i></code>"
* format.</li>
* </ul>
*
@@ -40,32 +39,6 @@ import org.springframework.util.Assert;
*/
public abstract class UriUtils {
private static final String SCHEME_PATTERN = "([^:/?#]+):";
private static final String HTTP_PATTERN = "(http|https):";
private static final String USERINFO_PATTERN = "([^@/]*)";
private static final String HOST_PATTERN = "([^/?#:]*)";
private static final String PORT_PATTERN = "(\\d*)";
private static final String PATH_PATTERN = "([^?#]*)";
private static final String QUERY_PATTERN = "([^#]*)";
private static final String LAST_PATTERN = "(.*)";
// Regex patterns that matches URIs. See RFC 3986, appendix B
private static final Pattern URI_PATTERN = Pattern.compile(
"^(" + SCHEME_PATTERN + ")?" + "(//(" + USERINFO_PATTERN + "@)?" + HOST_PATTERN + "(:" + PORT_PATTERN +
")?" + ")?" + PATH_PATTERN + "(\\?" + QUERY_PATTERN + ")?" + "(#" + LAST_PATTERN + ")?");
private static final Pattern HTTP_URL_PATTERN = Pattern.compile(
"^" + HTTP_PATTERN + "(//(" + USERINFO_PATTERN + "@)?" + HOST_PATTERN + "(:" + PORT_PATTERN + ")?" + ")?" +
PATH_PATTERN + "(\\?" + LAST_PATTERN + ")?");
/**
* Encodes the given URI scheme with the given encoding.
* @param scheme the scheme to be encoded