Class WebAppUtils

java.lang.Object
org.apache.hadoop.yarn.webapp.util.WebAppUtils

@Private @Evolving public class WebAppUtils extends Object
  • Field Details

  • 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,R> func, T arg) throws Exception
      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

      public static String getRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)
    • getRMWebAppURLWithoutScheme

      public static String getRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • getRouterWebAppURLWithScheme

      public static String getRouterWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)
    • getRouterWebAppURLWithoutScheme

      public static String getRouterWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • getGPGWebAppURLWithoutScheme

      public static String getGPGWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • getProxyHostsAndPortsForAmFilter

      public static List<String> getProxyHostsAndPortsForAmFilter(org.apache.hadoop.conf.Configuration conf)
    • getProxyHostAndPort

      public static String getProxyHostAndPort(org.apache.hadoop.conf.Configuration conf)
    • getResolvedRemoteRMWebAppURLWithScheme

      public static String getResolvedRemoteRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)
    • getResolvedRMWebAppURLWithScheme

      public static String getResolvedRMWebAppURLWithScheme(org.apache.hadoop.conf.Configuration conf)
    • getResolvedRemoteRMWebAppURLWithoutScheme

      public static String getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • getResolvedRMWebAppURLWithoutScheme

      public static String getResolvedRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • 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

      public static String getResolvedRemoteRMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.http.HttpConfig.Policy httpPolicy, String rmId)
    • getResolvedAddress

      public static String getResolvedAddress(InetSocketAddress address)
    • 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 configuration
      hostProperty - bind host property name
      webAppURLWithoutScheme - web app URL without scheme String
      Returns:
      String representing bind URL
    • getNMWebAppURLWithoutScheme

      public static String getNMWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • getAHSWebAppURLWithoutScheme

      public static String getAHSWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • getTimelineReaderWebAppURLWithoutScheme

      public static String getTimelineReaderWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • getTimelineCollectorWebAppURLWithoutScheme

      public static String getTimelineCollectorWebAppURLWithoutScheme(org.apache.hadoop.conf.Configuration conf)
    • getURLWithScheme

      public 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.
      Parameters:
      schemePrefix - eg. http:// or https://
      url - url.
      Returns:
      url with scheme
    • getRunningLogURL

      public static String getRunningLogURL(String nodeHttpAddress, String containerId, String user)
    • getAggregatedLogURL

      public static String getAggregatedLogURL(String serverHttpAddress, String allocatedNode, String containerId, String entity, String user)
    • getHttpSchemePrefix

      public 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.
      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 config
      conf - 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

      public static String getSupportedLogContentType(String format)
    • getDefaultLogContentType

      public static String getDefaultLogContentType()
    • listSupportedLogContentType

      public static List<String> 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 details
      parameterName - 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 details
      targetUri - the uri to which the query params must be added
      Returns:
      URL encoded string containing the targetUri + "?" + query string