|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jmeter.protocol.http.util.ConversionUtils
public class ConversionUtils
General purpose conversion utilities related to HTTP/HTML
Constructor Summary | |
---|---|
ConversionUtils()
|
Method Summary | |
---|---|
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 an absolute URL from a possibly relative location, 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)
Checks a URL and encodes it if necessary, i.e. if it is not currently correctly encoded. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConversionUtils()
Method Detail |
---|
public static String getEncodingFromContentType(String contentType)
contentType
- string from which the encoding should be extracted
null
, if none was found or
the charset is not supported
IllegalCharsetNameException
- if the found charset is not supportedpublic static URL makeRelativeURL(URL baseURL, String location) throws MalformedURLException
URL.URL(URL, String)
constructor does not remove these.
baseURL
- the base URL which is used to resolve missing protocol/host in the locationlocation
- the location, possibly with extraneous leading "../"
MalformedURLException
- when the given URL
is malformedpublic static String escapeIllegalURLCharacters(String url) throws Exception
url
- String Url to escape
Exception
- when given url
leads to a malformed URL or URIpublic static final URI sanitizeUrl(URL url) throws URISyntaxException
url
- non-encoded URL
URISyntaxException
- if parts of the url form a non valid URIpublic static String removeSlashDotDot(String url)
http://host/path1/../path2
to http://host/path2
or /one/two/../three
to
/one/three
url
- in which the '/..'s should be removed
|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |