java.lang.Object
org.elasticsearch.rest.RestUtils
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Pattern
checkCorsSettingForRegex
(String corsSetting) Determine if CORS setting is a regexstatic String[]
corsSettingAsArray
(String corsSetting) Return the CORS setting as an array of origins.static String
Decodes a bit of an URL encoded by a browser.static void
decodeQueryString
(String s, int fromIndex, Map<String, String> params) extractTraceId
(String traceparent) Extract the trace id from the specified traceparent string.
-
Field Details
-
REST_DECODER
-
-
Constructor Details
-
RestUtils
public RestUtils()
-
-
Method Details
-
decodeQueryString
-
decodeComponent
Decodes a bit of an URL encoded by a browser.This is equivalent to calling
decodeComponent(String, Charset, boolean)
with the UTF-8 charset (recommended to comply with RFC 3986, Section 2).- Parameters:
s
- The string to decode (can be empty).- Returns:
- The decoded string, or
s
if there's nothing to decode. If the string to decode isnull
, returns an empty string. - Throws:
IllegalArgumentException
- if the string contains a malformed escape sequence.
-
checkCorsSettingForRegex
Determine if CORS setting is a regex- Returns:
- a corresponding
Pattern
if so and o.w. null.
-
corsSettingAsArray
Return the CORS setting as an array of origins.- Parameters:
corsSetting
- the CORS allow origin setting as configured by the user; should never pass null, but we check for it anyway.- Returns:
- an array of origins if set, otherwise
null
.
-
extractTraceId
Extract the trace id from the specified traceparent string.- Parameters:
traceparent
- The value from thetraceparent
HTTP header- Returns:
- The trace id from the traceparent string, or
Optional.empty()
if it is not present. - See Also:
-