public _PrivilegedExceptionAction_98(ImageServlet.GetImageParams parsedParams, FSImage nnImage, NameNodeMetrics metrics, HttpServletResponse response, Configuration conf ) { this.parsedParams = parsedParams; this.nnImage = nnImage; this.metrics = metrics; this.response = response; this.conf = conf; }
/// <exception cref="Javax.Servlet.ServletException"/> /// <exception cref="System.IO.IOException"/> protected override void DoGet(HttpServletRequest request, HttpServletResponse response ) { try { ServletContext context = GetServletContext(); FSImage nnImage = NameNodeHttpServer.GetFsImageFromContext(context); ImageServlet.GetImageParams parsedParams = new ImageServlet.GetImageParams(request , response); Configuration conf = (Configuration)context.GetAttribute(JspHelper.CurrentConf); NameNodeMetrics metrics = NameNode.GetNameNodeMetrics(); ValidateRequest(context, conf, request, response, nnImage, parsedParams.GetStorageInfoString ()); UserGroupInformation.GetCurrentUser().DoAs(new _PrivilegedExceptionAction_98(parsedParams , nnImage, metrics, response, conf)); } catch (Exception t) { // Metrics non-null only when used inside name node // Metrics non-null only when used inside name node // Potential race where the file was deleted while we were in the // process of setting headers! // It's possible the file could be deleted after this point, but // we've already opened the 'fis' stream. // It's also possible length could change, but this would be // detected by the client side as an inaccurate length header. // send file string errMsg = "GetImage failed. " + StringUtils.StringifyException(t); response.SendError(HttpServletResponse.ScGone, errMsg); throw new IOException(errMsg); } finally { response.GetOutputStream().Close(); } }