Class WebAppUtils
java.lang.Object
org.apache.hadoop.yarn.webapp.util.WebAppUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA BiFunction which throws on Exception. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringappendQueryParams(javax.servlet.http.HttpServletRequest request, String targetUri) Add the query params from a HttpServletRequest to the target uri passed.static <T,R> R execOnActiveRM(org.apache.hadoop.conf.Configuration conf, WebAppUtils.ThrowingBiFunction<String, T, R> func, T arg) Runs a certain function against the active RM.static StringgetAggregatedLogURL(String serverHttpAddress, String allocatedNode, String containerId, String entity, String user) static StringgetAHSWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static Stringstatic StringgetGPGWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static StringgetHtmlEscapedURIWithQueryString(javax.servlet.http.HttpServletRequest request) Get a HTML escaped uri with the query parameters of the request.static StringgetHttpSchemePrefix(org.apache.hadoop.conf.Configuration conf) Choose which scheme (HTTP or HTTPS) to use when generating a URL based on the configuration.static StringgetNMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static StringgetProxyHostAndPort(org.apache.hadoop.conf.Configuration conf) getProxyHostsAndPortsForAmFilter(org.apache.hadoop.conf.Configuration conf) static StringgetResolvedAddress(InetSocketAddress address) static StringgetResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static StringgetResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy) static StringgetResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy, String rmId) static StringgetResolvedRemoteRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf) static StringgetResolvedRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static StringgetResolvedRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy) static StringgetResolvedRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf) static StringgetRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static StringgetRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, boolean isHAEnabled, int haIdIndex) static StringgetRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf) static StringgetRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf, int haIdIndex) static StringgetRouterWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static StringgetRouterWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf) static StringgetRunningLogURL(String nodeHttpAddress, String containerId, String user) static StringgetSupportedLogContentType(String format) static StringgetTimelineCollectorWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static StringgetTimelineReaderWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) static List<org.apache.http.NameValuePair>getURLEncodedQueryParam(javax.servlet.http.HttpServletRequest request) Get a query string.static List<org.apache.http.NameValuePair>getURLEncodedQueryParam(javax.ws.rs.container.ContainerRequestContext request) Get a query string.static StringgetURLWithScheme(String schemePrefix, String url) if url has scheme then it will be returned as it is else it will return url with scheme.static StringgetWebAppBindURL(org.apache.hadoop.conf.Configuration conf, String hostProperty, String webAppURLWithoutScheme) Get the URL to use for binding where bind hostname can be specified to override the hostname in the webAppURLWithoutScheme.static org.apache.hadoop.http.HttpServer2.BuilderloadSslConfiguration(org.apache.hadoop.http.HttpServer2.Builder builder) Load the SSL keystore / truststore into the HttpServer builder.static org.apache.hadoop.http.HttpServer2.BuilderloadSslConfiguration(org.apache.hadoop.http.HttpServer2.Builder builder, org.apache.hadoop.conf.Configuration conf) Load the SSL keystore / truststore into the HttpServer builder.static org.apache.hadoop.yarn.api.records.ApplicationIdparseApplicationId(org.apache.hadoop.yarn.factories.RecordFactory recordFactory, String appId) static StringremoveQueryParams(javax.servlet.http.HttpServletRequest httpRequest, String parameterName) Get a query string which removes the passed parameter.static voidsetNMWebAppHostNameAndPort(org.apache.hadoop.conf.Configuration conf, String hostName, int port) static voidsetRMWebAppHostnameAndPort(org.apache.hadoop.conf.Configuration conf, String hostname, int port) static voidsetRMWebAppPort(org.apache.hadoop.conf.Configuration conf, int port)
-
Field Details
-
WEB_APP_TRUSTSTORE_PASSWORD_KEY
- See Also:
-
WEB_APP_KEYSTORE_PASSWORD_KEY
- See Also:
-
WEB_APP_KEY_PASSWORD_KEY
- See Also:
-
HTTPS_PREFIX
- See Also:
-
HTTP_PREFIX
- See Also:
-
-
Constructor Details
-
WebAppUtils
public WebAppUtils()
-
-
Method Details
-
setRMWebAppPort
public static void setRMWebAppPort(org.apache.hadoop.conf.Configuration conf, int port) -
setRMWebAppHostnameAndPort
public static void setRMWebAppHostnameAndPort(org.apache.hadoop.conf.Configuration conf, String hostname, int port) -
setNMWebAppHostNameAndPort
public static void setNMWebAppHostNameAndPort(org.apache.hadoop.conf.Configuration conf, String hostName, int port) -
execOnActiveRM
public static <T,R> R execOnActiveRM(org.apache.hadoop.conf.Configuration conf, WebAppUtils.ThrowingBiFunction<String, T, throws ExceptionR> func, T arg) Runs a certain function against the active RM. The function's first argument is expected to be a string which contains the address of the RM being tried.- Type Parameters:
T- Generic T.R- Generic R.- Parameters:
conf- configuration.func- throwing bi function.arg- T arg.- Returns:
- instance of Generic R.
- Throws:
Exception- exception occurs.
-
getRMWebAppURLWithoutScheme
public static String getRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, boolean isHAEnabled, int haIdIndex) -
getRMWebAppURLWithScheme
public static String getRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf, int haIdIndex) -
getRMWebAppURLWithScheme
-
getRMWebAppURLWithoutScheme
-
getRouterWebAppURLWithScheme
-
getRouterWebAppURLWithoutScheme
-
getGPGWebAppURLWithoutScheme
-
getProxyHostsAndPortsForAmFilter
-
getProxyHostAndPort
-
getResolvedRemoteRMWebAppURLWithScheme
public static String getResolvedRemoteRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf) -
getResolvedRMWebAppURLWithScheme
-
getResolvedRemoteRMWebAppURLWithoutScheme
public static String getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) -
getResolvedRMWebAppURLWithoutScheme
-
getResolvedRMWebAppURLWithoutScheme
public static String getResolvedRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy) -
getResolvedRemoteRMWebAppURLWithoutScheme
public static String getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy) -
getResolvedRemoteRMWebAppURLWithoutScheme
-
getResolvedAddress
-
getWebAppBindURL
public static String getWebAppBindURL(org.apache.hadoop.conf.Configuration conf, String hostProperty, String webAppURLWithoutScheme) Get the URL to use for binding where bind hostname can be specified to override the hostname in the webAppURLWithoutScheme. Port specified in the webAppURLWithoutScheme will be used.- Parameters:
conf- the configurationhostProperty- bind host property namewebAppURLWithoutScheme- web app URL without scheme String- Returns:
- String representing bind URL
-
getNMWebAppURLWithoutScheme
-
getAHSWebAppURLWithoutScheme
-
getTimelineReaderWebAppURLWithoutScheme
public static String getTimelineReaderWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) -
getTimelineCollectorWebAppURLWithoutScheme
public static String getTimelineCollectorWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf) -
getURLWithScheme
if url has scheme then it will be returned as it is else it will return url with scheme.- Parameters:
schemePrefix- eg. http:// or https://url- url.- Returns:
- url with scheme
-
getRunningLogURL
-
getAggregatedLogURL
-
getHttpSchemePrefix
Choose which scheme (HTTP or HTTPS) to use when generating a URL based on the configuration.- Parameters:
conf- configuration.- Returns:
- the scheme (HTTP / HTTPS)
-
loadSslConfiguration
public static org.apache.hadoop.http.HttpServer2.Builder loadSslConfiguration(org.apache.hadoop.http.HttpServer2.Builder builder) Load the SSL keystore / truststore into the HttpServer builder.- Parameters:
builder- the HttpServer2.Builder to populate with ssl config- Returns:
- HttpServer2.Builder instance (passed in as the first parameter) after loading SSL stores
-
loadSslConfiguration
public static org.apache.hadoop.http.HttpServer2.Builder loadSslConfiguration(org.apache.hadoop.http.HttpServer2.Builder builder, org.apache.hadoop.conf.Configuration conf) Load the SSL keystore / truststore into the HttpServer builder.- Parameters:
builder- the HttpServer2.Builder to populate with ssl configconf- the Configuration instance to load custom SSL config from- Returns:
- HttpServer2.Builder instance (passed in as the first parameter) after loading SSL stores
-
parseApplicationId
public static org.apache.hadoop.yarn.api.records.ApplicationId parseApplicationId(org.apache.hadoop.yarn.factories.RecordFactory recordFactory, String appId) -
getSupportedLogContentType
-
getDefaultLogContentType
-
listSupportedLogContentType
-
getURLEncodedQueryParam
public static List<org.apache.http.NameValuePair> getURLEncodedQueryParam(javax.servlet.http.HttpServletRequest request) Get a query string.- Parameters:
request- HttpServletRequest with the request details- Returns:
- the query parameter string
-
getURLEncodedQueryParam
public static List<org.apache.http.NameValuePair> getURLEncodedQueryParam(javax.ws.rs.container.ContainerRequestContext request) Get a query string.- Parameters:
request- ContainerRequestContext with the request details- Returns:
- the query parameter string
-
removeQueryParams
public static String removeQueryParams(javax.servlet.http.HttpServletRequest httpRequest, String parameterName) Get a query string which removes the passed parameter.- Parameters:
httpRequest- HttpServletRequest with the request detailsparameterName- the query parameters must be removed- Returns:
- the query parameter string
-
getHtmlEscapedURIWithQueryString
public static String getHtmlEscapedURIWithQueryString(javax.servlet.http.HttpServletRequest request) Get a HTML escaped uri with the query parameters of the request.- Parameters:
request- HttpServletRequest with the request details- Returns:
- HTML escaped uri with the query paramters
-
appendQueryParams
public static String appendQueryParams(javax.servlet.http.HttpServletRequest request, String targetUri) Add the query params from a HttpServletRequest to the target uri passed.- Parameters:
request- HttpServletRequest with the request detailstargetUri- the uri to which the query params must be added- Returns:
- URL encoded string containing the targetUri + "?" + query string
-