public final class HttpUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
encodePathParam(String pathParam)
Encode path params.
|
static String |
getCharsetFromContentType(String contentType)
Parse the character encoding from the specified content type header.
|
static String |
parseFileNameFromHeaderValue(String headerValue)
only used by SDK to download from serviceComb producer
no need to check rtf6266's "filename*" rule. |
static String |
parseParamFromHeaderValue(String headerValue,
String paramName)
paramName is not case sensitive
|
static String |
uriDecodePath(String path) |
static String |
uriEncodePath(String path)
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| _____________________|__
/ \ / \
urn:example:animal:ferret:nose
|
public static String parseParamFromHeaderValue(String headerValue, String paramName)
headerValue - example: attachment;filename=a.txtpublic static String uriEncodePath(String path)
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| _____________________|__
/ \ / \
urn:example:animal:ferret:nose
the URI syntax components above is referred from RFC3986. This method is used to encode the entire path part(e.g. /over/there in the example).
In order to keep the structure of path, slash '/' will not be encoded. If you want to encode '/' into%2F,
please consider the encodePathParam(String)
path - the entire url pathpublic static String encodePathParam(String pathParam)
/over/there/{pathParam}/tail, this method
should be used to encoded {pathParam}. In order to keep the path structure, the slash '/' will be encoded
into %2F to avoid path matching problem.pathParam - the path param to be encodedUrlEscapers.urlPathSegmentEscaper()public static String parseFileNameFromHeaderValue(String headerValue)
public static String getCharsetFromContentType(String contentType)
null is returned.contentType - a content type headerCopyright © 2017–2022 The Apache Software Foundation. All rights reserved.