public class ConversionUtils extends Object
| Constructor and Description |
|---|
ConversionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
buildFullUrlFromRelative(URL lastUrl,
String redirectLocation)
Builds Full url (containing scheme, host,port) from relative URL
as per RFC http://tools.ietf.org/html/rfc3986#section-4.2
|
static String |
escapeIllegalURLCharacters(String url) |
static String |
getEncodingFromContentType(String contentType)
Extract the encoding (charset) from the Content-Type,
e.g.
|
static URL |
makeRelativeURL(URL baseURL,
String location)
Generate a relative URL, allowing for extraneous leading "../" segments.
|
static String |
removeSlashDotDot(String url)
collapses absolute or relative URLs containing '/..' converting
http://host/path1/..
|
static URI |
sanitizeUrl(URL url)
Escapes reserved chars in a non-encoded URL or partially encoded one.
|
public static String getEncodingFromContentType(String contentType)
contentType - IllegalCharsetNameExceptionpublic static URL makeRelativeURL(URL baseURL, String location) throws MalformedURLException
URL.URL(URL, String) constructor does not remove these.baseURL - location - relative location, possibly with extraneous leading "../"MalformedURLExceptionpublic static String escapeIllegalURLCharacters(String url) throws Exception
url - String Url to escapeExceptionpublic static final URI sanitizeUrl(URL url) throws URISyntaxException, UnsupportedEncodingException
url - non-encoded or partially encoded URLURISyntaxExceptionUnsupportedEncodingExceptionpublic static String removeSlashDotDot(String url)
url - public static final String buildFullUrlFromRelative(URL lastUrl, String redirectLocation)
lastUrl - URLredirectLocation - absolute URLCopyright © 1998-2015 Apache Software Foundation. All Rights Reserved.