org.apache.hadoop.http.HttpServer.isInstrumentationAccessAllowed()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中org.apache.hadoop.http.HttpServer.isInstrumentationAccessAllowed()方法的一些代码示例,展示了HttpServer.isInstrumentationAccessAllowed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpServer.isInstrumentationAccessAllowed()方法的具体详情如下:
包路径:org.apache.hadoop.http.HttpServer
类名称:HttpServer
方法名:isInstrumentationAccessAllowed

HttpServer.isInstrumentationAccessAllowed介绍

[英]Checks the user has privileges to access to instrumentation servlets.

If hadoop.security.instrumentation.requires.admin is set to FALSE (default value) it always returns TRUE.

If hadoop.security.instrumentation.requires.admin is set to TRUE it will check that if the current user is in the admin ACLS. If the user is in the admin ACLs it returns TRUE, otherwise it returns FALSE.
[中]检查用户是否具有访问检测servlet的权限。
如果hadoop.security.instrumentation.requires.admin设置为FALSE(默认值),则它始终返回TRUE。
如果hadoop.security.instrumentation.requires.admin设置为TRUE,它将检查当前用户是否在管理ACL中。如果用户在管理ACL中,则返回TRUE,否则返回FALSE。

代码示例

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Override
 public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(),
                          request, response)) {
   return;
  }
  response.setContentType("text/plain; charset=UTF-8");
  try (PrintStream out = new PrintStream(
    response.getOutputStream(), false, "UTF-8")) {
   ReflectionUtils.printThreadInfo(out, "");
  }
  ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1);      
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override
 public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(),
                          request, response)) {
   return;
  }
  response.setContentType("text/plain; charset=UTF-8");
  try (PrintStream out = new PrintStream(
    response.getOutputStream(), false, "UTF-8")) {
   ReflectionUtils.printThreadInfo(out, "");
  }
  ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1);      
 }
}

代码示例来源:origin: io.hops/hadoop-common

@Override
 public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(),
                          request, response)) {
   return;
  }
  response.setContentType("text/plain; charset=UTF-8");
  try (PrintStream out = new PrintStream(
    response.getOutputStream(), false, "UTF-8")) {
   ReflectionUtils.printThreadInfo(out, "");
  }
  ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1);      
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Override
 public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(),
                          request, response)) {
   return;
  }
  response.setContentType("text/plain; charset=UTF-8");
  try (PrintStream out = new PrintStream(
    response.getOutputStream(), false, "UTF-8")) {
   ReflectionUtils.printThreadInfo(out, "");
  }
  ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1);      
 }
}

代码示例来源:origin: io.fabric8/fabric-hadoop

@Override
 public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  // Do the authorization
  if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(),
    request, response)) {
   return;
  }
  PrintWriter out = new PrintWriter
         (HtmlQuoting.quoteOutputStream(response.getOutputStream()));
  ReflectionUtils.printThreadInfo(out, "");
  out.close();
  ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1);      
 }
}

相关文章