예제 #1
0
  @Override
  public void channelRead0(final ChannelHandlerContext ctx, final HttpRequest req)
      throws Exception {
    Preconditions.checkArgument(req.uri().startsWith(WEBHDFS_PREFIX));
    QueryStringDecoder queryString = new QueryStringDecoder(req.uri());
    params = new ParameterParser(queryString, conf);
    DataNodeUGIProvider ugiProvider = new DataNodeUGIProvider(params);
    ugi = ugiProvider.ugi();
    path = params.path();

    injectToken();
    ugi.doAs(
        new PrivilegedExceptionAction<Void>() {
          @Override
          public Void run() throws Exception {
            handle(ctx, req);
            return null;
          }
        });
  }