@InterfaceAudience.Private @InterfaceStability.Evolving public class WebAppUtils extends Object
| Modifier and Type | Class and Description | 
|---|---|
static interface  | 
WebAppUtils.ThrowingBiFunction<T,U,R>
A BiFunction which throws on Exception. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
static String | 
HTTP_PREFIX  | 
static String | 
HTTPS_PREFIX  | 
static String | 
WEB_APP_KEY_PASSWORD_KEY  | 
static String | 
WEB_APP_KEYSTORE_PASSWORD_KEY  | 
static String | 
WEB_APP_TRUSTSTORE_PASSWORD_KEY  | 
| Constructor and Description | 
|---|
WebAppUtils()  | 
| Modifier and Type | Method and Description | 
|---|---|
static String | 
appendQueryParams(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 String | 
getAggregatedLogURL(String serverHttpAddress,
                   String allocatedNode,
                   String containerId,
                   String entity,
                   String user)  | 
static String | 
getAHSWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getDefaultLogContentType()  | 
static String | 
getHtmlEscapedURIWithQueryString(javax.servlet.http.HttpServletRequest request)
Get a HTML escaped uri with the query parameters of the request. 
 | 
static String | 
getHttpSchemePrefix(org.apache.hadoop.conf.Configuration conf)
Choose which scheme (HTTP or HTTPS) to use when generating a URL based on
 the configuration. 
 | 
static String | 
getNMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getProxyHostAndPort(org.apache.hadoop.conf.Configuration conf)  | 
static List<String> | 
getProxyHostsAndPortsForAmFilter(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getResolvedAddress(InetSocketAddress address)  | 
static String | 
getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf,
                                         org.apache.hadoop.http.HttpConfig.Policy httpPolicy)  | 
static String | 
getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf,
                                         org.apache.hadoop.http.HttpConfig.Policy httpPolicy,
                                         String rmId)  | 
static String | 
getResolvedRemoteRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getResolvedRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getResolvedRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf,
                                   org.apache.hadoop.http.HttpConfig.Policy httpPolicy)  | 
static String | 
getResolvedRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf,
                           boolean isHAEnabled,
                           int haIdIndex)  | 
static String | 
getRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf,
                        int haIdIndex)  | 
static String | 
getRouterWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getRouterWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getRunningLogURL(String nodeHttpAddress,
                String containerId,
                String user)  | 
static String | 
getSupportedLogContentType(String format)  | 
static String | 
getTimelineCollectorWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)  | 
static String | 
getTimelineReaderWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)  | 
static List<org.apache.http.NameValuePair> | 
getURLEncodedQueryParam(javax.servlet.http.HttpServletRequest request)
Get a query string. 
 | 
static String | 
getURLWithScheme(String schemePrefix,
                String url)
if url has scheme then it will be returned as it is else it will return
 url with scheme. 
 | 
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. 
 | 
static List<String> | 
listSupportedLogContentType()  | 
static org.apache.hadoop.http.HttpServer2.Builder | 
loadSslConfiguration(org.apache.hadoop.http.HttpServer2.Builder builder)
Load the SSL keystore / truststore into the HttpServer builder. 
 | 
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. 
 | 
static org.apache.hadoop.yarn.api.records.ApplicationId | 
parseApplicationId(org.apache.hadoop.yarn.factories.RecordFactory recordFactory,
                  String appId)  | 
static String | 
removeQueryParams(javax.servlet.http.HttpServletRequest httpRequest,
                 String parameterName)
Get a query string which removes the passed parameter. 
 | 
static void | 
setNMWebAppHostNameAndPort(org.apache.hadoop.conf.Configuration conf,
                          String hostName,
                          int port)  | 
static void | 
setRMWebAppHostnameAndPort(org.apache.hadoop.conf.Configuration conf,
                          String hostname,
                          int port)  | 
static void | 
setRMWebAppPort(org.apache.hadoop.conf.Configuration conf,
               int port)  | 
public static final String WEB_APP_TRUSTSTORE_PASSWORD_KEY
public static final String WEB_APP_KEYSTORE_PASSWORD_KEY
public static final String WEB_APP_KEY_PASSWORD_KEY
public static final String HTTPS_PREFIX
public static final String HTTP_PREFIX
public static void setRMWebAppPort(org.apache.hadoop.conf.Configuration conf,
                                   int port)
public static void setRMWebAppHostnameAndPort(org.apache.hadoop.conf.Configuration conf,
                                              String hostname,
                                              int port)
public static void setNMWebAppHostNameAndPort(org.apache.hadoop.conf.Configuration conf,
                                              String hostName,
                                              int port)
public static <T,R> R execOnActiveRM(org.apache.hadoop.conf.Configuration conf,
                                     WebAppUtils.ThrowingBiFunction<String,T,R> func,
                                     T arg)
                              throws Exception
Exceptionpublic static String getRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, boolean isHAEnabled, int haIdIndex)
public static String getRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf, int haIdIndex)
public static String getRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)
public static String getRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
public static String getRouterWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)
public static String getRouterWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
public static List<String> getProxyHostsAndPortsForAmFilter(org.apache.hadoop.conf.Configuration conf)
public static String getProxyHostAndPort(org.apache.hadoop.conf.Configuration conf)
public static String getResolvedRemoteRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)
public static String getResolvedRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)
public static String getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
public static String getResolvedRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
public static String getResolvedRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy)
public static String getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy)
public static String getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy, String rmId)
public static String getResolvedAddress(InetSocketAddress address)
public static String getWebAppBindURL(org.apache.hadoop.conf.Configuration conf, String hostProperty, String webAppURLWithoutScheme)
conf - the configurationhostProperty - bind host property namewebAppURLWithoutScheme - web app URL without scheme Stringpublic static String getNMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
public static String getAHSWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
public static String getTimelineReaderWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
public static String getTimelineCollectorWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
public static String getURLWithScheme(String schemePrefix, String url)
schemePrefix - eg. http:// or https://url - public static String getRunningLogURL(String nodeHttpAddress, String containerId, String user)
public static String getAggregatedLogURL(String serverHttpAddress, String allocatedNode, String containerId, String entity, String user)
public static String getHttpSchemePrefix(org.apache.hadoop.conf.Configuration conf)
public static org.apache.hadoop.http.HttpServer2.Builder loadSslConfiguration(org.apache.hadoop.http.HttpServer2.Builder builder)
builder - the HttpServer2.Builder to populate with ssl configpublic static org.apache.hadoop.http.HttpServer2.Builder loadSslConfiguration(org.apache.hadoop.http.HttpServer2.Builder builder,
                                                                              org.apache.hadoop.conf.Configuration conf)
builder - the HttpServer2.Builder to populate with ssl configconf - the Configuration instance to load custom SSL config frompublic static org.apache.hadoop.yarn.api.records.ApplicationId parseApplicationId(org.apache.hadoop.yarn.factories.RecordFactory recordFactory,
                                                                                  String appId)
public static String getDefaultLogContentType()
public static List<org.apache.http.NameValuePair> getURLEncodedQueryParam(javax.servlet.http.HttpServletRequest request)
request - HttpServletRequest with the request detailspublic static String removeQueryParams(javax.servlet.http.HttpServletRequest httpRequest, String parameterName)
httpRequest - HttpServletRequest with the request detailsparameterName - the query parameters must be removedpublic static String getHtmlEscapedURIWithQueryString(javax.servlet.http.HttpServletRequest request)
request - HttpServletRequest with the request detailspublic static String appendQueryParams(javax.servlet.http.HttpServletRequest request, String targetUri)
request - HttpServletRequest with the request detailstargetUri - the uri to which the query params must be addedCopyright © 2008–2022 Apache Software Foundation. All rights reserved.