示例#1
0
 public virtual string get(string key)
 {
     return((string)MDC.get(key));
 }
示例#2
0
 public virtual void remove(string key)
 {
     MDC.remove(key);
 }
示例#3
0
文件: MDC.cs 项目: NecroSharper/WCell
        /// <summary>
        /// Renders the specified MDC item and appends it to the specified <see cref="StringBuilder" />.
        /// </summary>
        /// <param name="builder">The <see cref="StringBuilder"/> to append the rendered data to.</param>
        /// <param name="logEvent">Logging event.</param>
        protected internal override void Append(StringBuilder builder, LogEventInfo logEvent)
        {
            string msg = MDC.Get(Item);

            builder.Append(ApplyPadding(msg));
        }
示例#4
0
 protected void Application_BeginRequest(object sender, EventArgs e)
 {
     MDC.Set("addr", Request.UserHostAddress);
 }
        public void MDCTest2()
        {
            List <Exception> exceptions = new List <Exception>();
            ManualResetEvent mre        = new ManualResetEvent(false);
            int counter   = 100;
            int remaining = counter;

            for (int i = 0; i < counter; ++i)
            {
                ThreadPool.QueueUserWorkItem(
                    s =>
                {
                    try
                    {
                        MDC.Clear();
                        Assert.False(MDC.Contains("foo"));
                        Assert.Equal(string.Empty, MDC.Get("foo"));
                        Assert.False(MDC.Contains("foo2"));
                        Assert.Equal(string.Empty, MDC.Get("foo2"));

                        MDC.Set("foo", "bar");
                        MDC.Set("foo2", "bar2");

                        Assert.True(MDC.Contains("foo"));
                        Assert.Equal("bar", MDC.Get("foo"));

                        MDC.Remove("foo");
                        Assert.False(MDC.Contains("foo"));
                        Assert.Equal(string.Empty, MDC.Get("foo"));

                        Assert.True(MDC.Contains("foo2"));
                        Assert.Equal("bar2", MDC.Get("foo2"));
                    }
                    catch (Exception ex)
                    {
                        lock (exceptions)
                        {
                            exceptions.Add(ex);
                        }
                    }
                    finally
                    {
                        if (Interlocked.Decrement(ref remaining) == 0)
                        {
                            mre.Set();
                        }
                    }
                });
            }

            mre.WaitOne();
            StringBuilder exceptionsMessage = new StringBuilder();

            foreach (var ex in exceptions)
            {
                if (exceptionsMessage.Length > 0)
                {
                    exceptionsMessage.Append("\r\n");
                }

                exceptionsMessage.Append(ex.ToString());
            }

            Assert.True(exceptions.Count == 0, exceptionsMessage.ToString());
        }
示例#6
0
文件: MDC.cs 项目: NecroSharper/WCell
 /// <summary>
 /// Returns the estimated number of characters that are needed to
 /// hold the rendered value for the specified logging event.
 /// </summary>
 /// <param name="logEvent">Logging event information.</param>
 /// <returns>The number of characters.</returns>
 /// <remarks>
 /// If the exact number is not known or
 /// expensive to calculate this function should return a rough estimate
 /// that's big enough in most cases, but not too big, in order to conserve memory.
 /// </remarks>
 protected internal override int GetEstimatedBufferSize(LogEventInfo logEvent)
 {
     return(MDC.Get(Item).Length);
 }
示例#7
0
        /// <summary>
        /// Deletes the IssueAttachment.
        /// </summary>
        /// <param name="issueAttachmentId">The issue attachment id.</param>
        /// <returns></returns>
        public static bool Delete(int issueAttachmentId)
        {
            var att     = GetById(issueAttachmentId);
            var issue   = IssueManager.GetById(att.IssueId);
            var project = ProjectManager.GetById(issue.ProjectId);

            if (DataProviderManager.Provider.DeleteIssueAttachment(issueAttachmentId))
            {
                try
                {
                    var history = new IssueHistory
                    {
                        IssueId                 = att.IssueId,
                        CreatedUserName         = Security.GetUserName(),
                        DateChanged             = DateTime.Now,
                        FieldChanged            = ResourceStrings.GetGlobalResource(GlobalResources.SharedResources, "Attachment", "Attachment"),
                        OldValue                = att.FileName,
                        NewValue                = ResourceStrings.GetGlobalResource(GlobalResources.SharedResources, "Deleted", "Deleted"),
                        TriggerLastUpdateChange = true
                    };

                    IssueHistoryManager.SaveOrUpdate(history);

                    var changes = new List <IssueHistory> {
                        history
                    };

                    IssueNotificationManager.SendIssueNotifications(att.IssueId, changes);
                }
                catch (Exception ex)
                {
                    if (Log.IsErrorEnabled)
                    {
                        Log.Error(ex);
                    }
                }

                if (project.AttachmentStorageType == IssueAttachmentStorageTypes.FileSystem)
                {
                    //delete IssueAttachment from file system.
                    try
                    {
                        var filePath = HttpContext.Current.Server.MapPath(String.Format("~{2}{0}\\{1}", project.UploadPath, att.FileName, Globals.UPLOAD_FOLDER));

                        if (File.Exists(filePath))
                        {
                            File.Delete(filePath);
                        }
                        else
                        {
                            Log.Info(String.Format("Failed to locate file {0} to delete, it may have been moved or manually deleted", filePath));
                        }
                    }
                    catch (Exception ex)
                    {
                        //set user to log4net context, so we can use %X{user} in the appenders
                        if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
                        {
                            MDC.Set("user", HttpContext.Current.User.Identity.Name);
                        }

                        if (Log.IsErrorEnabled)
                        {
                            Log.Error(String.Format("Error Deleting IssueAttachment - {0}", String.Format("{0}\\{1}", project.UploadPath, att.FileName)), ex);
                        }

                        throw new ApplicationException(LoggingManager.GetErrorMessageResource("AttachmentDeleteError"), ex);
                    }
                }
            }
            return(true);
        }
示例#8
0
        /// <summary>
        /// Renders the XML logging event and appends it to the specified <see cref="StringBuilder" />.
        /// </summary>
        /// <param name="builder">The <see cref="StringBuilder"/> to append the rendered data to.</param>
        /// <param name="logEvent">Logging event.</param>
        protected internal override void Append(StringBuilder builder, LogEventInfo logEvent)
        {
            StringWriter  sw  = new StringWriter(builder);
            XmlTextWriter xtw = new XmlTextWriter(sw);

            if (IndentXml)
            {
                xtw.Formatting = Formatting.Indented;
            }

            xtw.WriteStartElement("log4j:event");
            xtw.WriteAttributeString("logger", logEvent.LoggerName);
            xtw.WriteAttributeString("level", logEvent.Level.Name.ToUpper());
            xtw.WriteAttributeString("timestamp", Convert.ToString((long)(logEvent.TimeStamp.ToUniversalTime() - _log4jDateBase).TotalMilliseconds));
#if !NETCF
            xtw.WriteAttributeString("thread", NLog.Internal.ThreadIDHelper.Instance.CurrentThreadID.ToString());
#else
            xtw.WriteElementString("thread", "");
#endif

            xtw.WriteElementString("log4j:message", logEvent.FormattedMessage);
            if (IncludeNDC)
            {
                xtw.WriteElementString("log4j:NDC", NDC.GetAllMessages(" "));
            }
#if !NETCF
            if (IncludeCallSite || IncludeSourceInfo)
            {
                System.Diagnostics.StackFrame frame = logEvent.UserStackFrame;
                MethodBase methodBase = frame.GetMethod();
                Type       type       = methodBase.DeclaringType;

                xtw.WriteStartElement("log4j:locationinfo");
                xtw.WriteAttributeString("class", type.FullName);
                xtw.WriteAttributeString("method", methodBase.ToString());
                if (IncludeSourceInfo)
                {
                    xtw.WriteAttributeString("file", frame.GetFileName());
                    xtw.WriteAttributeString("line", frame.GetFileLineNumber().ToString());
                }
                xtw.WriteEndElement();

                if (IncludeNLogData)
                {
                    xtw.WriteElementString("nlog:eventSequenceNumber", logEvent.SequenceID.ToString());
                    xtw.WriteStartElement("nlog:locationinfo");
                    xtw.WriteAttributeString("assembly", type.Assembly.FullName);
                    xtw.WriteEndElement();
                }
            }
#endif
            xtw.WriteStartElement("log4j:properties");
            if (IncludeMDC)
            {
                foreach (KeyValuePair <string, string> entry in MDC.GetThreadDictionary())
                {
                    xtw.WriteStartElement("log4j:data");
                    xtw.WriteAttributeString("name", entry.Key);
                    xtw.WriteAttributeString("value", entry.Value);
                    xtw.WriteEndElement();
                }
            }

            foreach (NLogViewerParameterInfo parameter in Parameters)
            {
                xtw.WriteStartElement("log4j:data");
                xtw.WriteAttributeString("name", parameter.Name);
                xtw.WriteAttributeString("value", parameter.CompiledLayout.GetFormattedMessage(logEvent));
                xtw.WriteEndElement();
            }

            xtw.WriteStartElement("log4j:data");
            xtw.WriteAttributeString("name", "log4japp");
            xtw.WriteAttributeString("value", AppInfo);
            xtw.WriteEndElement();

            xtw.WriteStartElement("log4j:data");
            xtw.WriteAttributeString("name", "log4jmachinename");
#if NETCF
            xtw.WriteAttributeString("value", "netcf");
#else
            xtw.WriteAttributeString("value", NLog.LayoutRenderers.MachineNameLayoutRenderer.MachineName);
#endif
            xtw.WriteEndElement();
            xtw.WriteEndElement();

            xtw.WriteEndElement();
            xtw.Flush();
        }
示例#9
0
        public virtual Response Put(InputStream @is, UriInfo uriInfo, string path, HttpFSParametersProvider.OperationParam
                                    op, Parameters @params, HttpServletRequest request)
        {
            UserGroupInformation user = HttpUserGroupInformation.Get();
            Response             response;

            path = MakeAbsolute(path);
            MDC.Put(HttpFSFileSystem.OpParam, op.Value().ToString());
            MDC.Put("hostname", request.GetRemoteAddr());
            switch (op.Value())
            {
            case HttpFSFileSystem.Operation.Create:
            {
                bool hasData = @params.Get <HttpFSParametersProvider.DataParam>(HttpFSParametersProvider.DataParam
                                                                                .Name);
                if (!hasData)
                {
                    response = Response.TemporaryRedirect(CreateUploadRedirectionURL(uriInfo, HttpFSFileSystem.Operation
                                                                                     .Create)).Build();
                }
                else
                {
                    short permission = @params.Get <HttpFSParametersProvider.PermissionParam>(HttpFSParametersProvider.PermissionParam
                                                                                              .Name);
                    bool @override = @params.Get <HttpFSParametersProvider.OverwriteParam>(HttpFSParametersProvider.OverwriteParam
                                                                                           .Name);
                    short replication = @params.Get <HttpFSParametersProvider.ReplicationParam>(HttpFSParametersProvider.ReplicationParam
                                                                                                .Name);
                    long blockSize = @params.Get <HttpFSParametersProvider.BlockSizeParam>(HttpFSParametersProvider.BlockSizeParam
                                                                                           .Name);
                    FSOperations.FSCreate command = new FSOperations.FSCreate(@is, path, permission,
                                                                              @override, replication, blockSize);
                    FsExecute(user, command);
                    AuditLog.Info("[{}] permission [{}] override [{}] replication [{}] blockSize [{}]"
                                  , new object[] { path, permission, @override, replication, blockSize });
                    response = Response.Status(Response.Status.Created).Build();
                }
                break;
            }

            case HttpFSFileSystem.Operation.Setxattr:
            {
                string xattrName = @params.Get <HttpFSParametersProvider.XAttrNameParam>(HttpFSParametersProvider.XAttrNameParam
                                                                                         .Name);
                string xattrValue = @params.Get <HttpFSParametersProvider.XAttrValueParam>(HttpFSParametersProvider.XAttrValueParam
                                                                                           .Name);
                EnumSet <XAttrSetFlag> flag = @params.Get <HttpFSParametersProvider.XAttrSetFlagParam
                                                           >(HttpFSParametersProvider.XAttrSetFlagParam.Name);
                FSOperations.FSSetXAttr command = new FSOperations.FSSetXAttr(path, xattrName, xattrValue
                                                                              , flag);
                FsExecute(user, command);
                AuditLog.Info("[{}] to xAttr [{}]", path, xattrName);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Removexattr:
            {
                string xattrName = @params.Get <HttpFSParametersProvider.XAttrNameParam>(HttpFSParametersProvider.XAttrNameParam
                                                                                         .Name);
                FSOperations.FSRemoveXAttr command = new FSOperations.FSRemoveXAttr(path, xattrName
                                                                                    );
                FsExecute(user, command);
                AuditLog.Info("[{}] removed xAttr [{}]", path, xattrName);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Mkdirs:
            {
                short permission = @params.Get <HttpFSParametersProvider.PermissionParam>(HttpFSParametersProvider.PermissionParam
                                                                                          .Name);
                FSOperations.FSMkdirs command = new FSOperations.FSMkdirs(path, permission);
                JSONObject            json    = FsExecute(user, command);
                AuditLog.Info("[{}] permission [{}]", path, permission);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Rename:
            {
                string toPath = @params.Get <HttpFSParametersProvider.DestinationParam>(HttpFSParametersProvider.DestinationParam
                                                                                        .Name);
                FSOperations.FSRename command = new FSOperations.FSRename(path, toPath);
                JSONObject            json    = FsExecute(user, command);
                AuditLog.Info("[{}] to [{}]", path, toPath);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Setowner:
            {
                string owner = @params.Get <HttpFSParametersProvider.OwnerParam>(HttpFSParametersProvider.OwnerParam
                                                                                 .Name);
                string group = @params.Get <HttpFSParametersProvider.GroupParam>(HttpFSParametersProvider.GroupParam
                                                                                 .Name);
                FSOperations.FSSetOwner command = new FSOperations.FSSetOwner(path, owner, group);
                FsExecute(user, command);
                AuditLog.Info("[{}] to (O/G)[{}]", path, owner + ":" + group);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Setpermission:
            {
                short permission = @params.Get <HttpFSParametersProvider.PermissionParam>(HttpFSParametersProvider.PermissionParam
                                                                                          .Name);
                FSOperations.FSSetPermission command = new FSOperations.FSSetPermission(path, permission
                                                                                        );
                FsExecute(user, command);
                AuditLog.Info("[{}] to [{}]", path, permission);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Setreplication:
            {
                short replication = @params.Get <HttpFSParametersProvider.ReplicationParam>(HttpFSParametersProvider.ReplicationParam
                                                                                            .Name);
                FSOperations.FSSetReplication command = new FSOperations.FSSetReplication(path, replication
                                                                                          );
                JSONObject json = FsExecute(user, command);
                AuditLog.Info("[{}] to [{}]", path, replication);
                response = Response.Ok(json).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Settimes:
            {
                long modifiedTime = @params.Get <HttpFSParametersProvider.ModifiedTimeParam>(HttpFSParametersProvider.ModifiedTimeParam
                                                                                             .Name);
                long accessTime = @params.Get <HttpFSParametersProvider.AccessTimeParam>(HttpFSParametersProvider.AccessTimeParam
                                                                                         .Name);
                FSOperations.FSSetTimes command = new FSOperations.FSSetTimes(path, modifiedTime,
                                                                              accessTime);
                FsExecute(user, command);
                AuditLog.Info("[{}] to (M/A)[{}]", path, modifiedTime + ":" + accessTime);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Setacl:
            {
                string aclSpec = @params.Get <HttpFSParametersProvider.AclPermissionParam>(HttpFSParametersProvider.AclPermissionParam
                                                                                           .Name);
                FSOperations.FSSetAcl command = new FSOperations.FSSetAcl(path, aclSpec);
                FsExecute(user, command);
                AuditLog.Info("[{}] to acl [{}]", path, aclSpec);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Removeacl:
            {
                FSOperations.FSRemoveAcl command = new FSOperations.FSRemoveAcl(path);
                FsExecute(user, command);
                AuditLog.Info("[{}] removed acl", path);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Modifyaclentries:
            {
                string aclSpec = @params.Get <HttpFSParametersProvider.AclPermissionParam>(HttpFSParametersProvider.AclPermissionParam
                                                                                           .Name);
                FSOperations.FSModifyAclEntries command = new FSOperations.FSModifyAclEntries(path
                                                                                              , aclSpec);
                FsExecute(user, command);
                AuditLog.Info("[{}] modify acl entry with [{}]", path, aclSpec);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Removeaclentries:
            {
                string aclSpec = @params.Get <HttpFSParametersProvider.AclPermissionParam>(HttpFSParametersProvider.AclPermissionParam
                                                                                           .Name);
                FSOperations.FSRemoveAclEntries command = new FSOperations.FSRemoveAclEntries(path
                                                                                              , aclSpec);
                FsExecute(user, command);
                AuditLog.Info("[{}] remove acl entry [{}]", path, aclSpec);
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Removedefaultacl:
            {
                FSOperations.FSRemoveDefaultAcl command = new FSOperations.FSRemoveDefaultAcl(path
                                                                                              );
                FsExecute(user, command);
                AuditLog.Info("[{}] remove default acl", path);
                response = Response.Ok().Build();
                break;
            }

            default:
            {
                throw new IOException(MessageFormat.Format("Invalid HTTP PUT operation [{0}]", op
                                                           .Value()));
            }
            }
            return(response);
        }
示例#10
0
        public virtual Response Post(InputStream @is, UriInfo uriInfo, string path, HttpFSParametersProvider.OperationParam
                                     op, Parameters @params, HttpServletRequest request)
        {
            UserGroupInformation user = HttpUserGroupInformation.Get();
            Response             response;

            path = MakeAbsolute(path);
            MDC.Put(HttpFSFileSystem.OpParam, op.Value().ToString());
            MDC.Put("hostname", request.GetRemoteAddr());
            switch (op.Value())
            {
            case HttpFSFileSystem.Operation.Append:
            {
                bool hasData = @params.Get <HttpFSParametersProvider.DataParam>(HttpFSParametersProvider.DataParam
                                                                                .Name);
                if (!hasData)
                {
                    response = Response.TemporaryRedirect(CreateUploadRedirectionURL(uriInfo, HttpFSFileSystem.Operation
                                                                                     .Append)).Build();
                }
                else
                {
                    FSOperations.FSAppend command = new FSOperations.FSAppend(@is, path);
                    FsExecute(user, command);
                    AuditLog.Info("[{}]", path);
                    response = Response.Ok().Type(MediaType.ApplicationJson).Build();
                }
                break;
            }

            case HttpFSFileSystem.Operation.Concat:
            {
                System.Console.Out.WriteLine("HTTPFS SERVER CONCAT");
                string sources = @params.Get <HttpFSParametersProvider.SourcesParam>(HttpFSParametersProvider.SourcesParam
                                                                                     .Name);
                FSOperations.FSConcat command = new FSOperations.FSConcat(path, sources.Split(","
                                                                                              ));
                FsExecute(user, command);
                AuditLog.Info("[{}]", path);
                System.Console.Out.WriteLine("SENT RESPONSE");
                response = Response.Ok().Build();
                break;
            }

            case HttpFSFileSystem.Operation.Truncate:
            {
                long newLength = @params.Get <HttpFSParametersProvider.NewLengthParam>(HttpFSParametersProvider.NewLengthParam
                                                                                       .Name);
                FSOperations.FSTruncate command = new FSOperations.FSTruncate(path, newLength);
                JSONObject json = FsExecute(user, command);
                AuditLog.Info("Truncate [{}] to length [{}]", path, newLength);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            default:
            {
                throw new IOException(MessageFormat.Format("Invalid HTTP POST operation [{0}]", op
                                                           .Value()));
            }
            }
            return(response);
        }
示例#11
0
        public virtual Response Get(string path, HttpFSParametersProvider.OperationParam
                                    op, Parameters @params, HttpServletRequest request)
        {
            UserGroupInformation user = HttpUserGroupInformation.Get();
            Response             response;

            path = MakeAbsolute(path);
            MDC.Put(HttpFSFileSystem.OpParam, op.Value().ToString());
            MDC.Put("hostname", request.GetRemoteAddr());
            switch (op.Value())
            {
            case HttpFSFileSystem.Operation.Open:
            {
                //Invoking the command directly using an unmanaged FileSystem that is
                // released by the FileSystemReleaseFilter
                FSOperations.FSOpen command = new FSOperations.FSOpen(path);
                FileSystem          fs      = CreateFileSystem(user);
                InputStream         @is     = command.Execute(fs);
                long offset = @params.Get <HttpFSParametersProvider.OffsetParam>(HttpFSParametersProvider.OffsetParam
                                                                                 .Name);
                long len = @params.Get <HttpFSParametersProvider.LenParam>(HttpFSParametersProvider.LenParam
                                                                           .Name);
                AuditLog.Info("[{}] offset [{}] len [{}]", new object[] { path, offset, len });
                InputStreamEntity entity = new InputStreamEntity(@is, offset, len);
                response = Response.Ok(entity).Type(MediaType.ApplicationOctetStream).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Getfilestatus:
            {
                FSOperations.FSFileStatus command = new FSOperations.FSFileStatus(path);
                IDictionary json = FsExecute(user, command);
                AuditLog.Info("[{}]", path);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Liststatus:
            {
                string filter = @params.Get <HttpFSParametersProvider.FilterParam>(HttpFSParametersProvider.FilterParam
                                                                                   .Name);
                FSOperations.FSListStatus command = new FSOperations.FSListStatus(path, filter);
                IDictionary json = FsExecute(user, command);
                AuditLog.Info("[{}] filter [{}]", path, (filter != null) ? filter : "-");
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Gethomedirectory:
            {
                EnforceRootPath(op.Value(), path);
                FSOperations.FSHomeDir command = new FSOperations.FSHomeDir();
                JSONObject             json    = FsExecute(user, command);
                AuditLog.Info(string.Empty);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Instrumentation:
            {
                EnforceRootPath(op.Value(), path);
                Groups         groups     = HttpFSServerWebApp.Get().Get <Groups>();
                IList <string> userGroups = groups.GetGroups(user.GetShortUserName());
                if (!userGroups.Contains(HttpFSServerWebApp.Get().GetAdminGroup()))
                {
                    throw new AccessControlException("User not in HttpFSServer admin group");
                }
                Instrumentation instrumentation = HttpFSServerWebApp.Get().Get <Instrumentation>();
                IDictionary     snapshot        = instrumentation.GetSnapshot();
                response = Response.Ok(snapshot).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Getcontentsummary:
            {
                FSOperations.FSContentSummary command = new FSOperations.FSContentSummary(path);
                IDictionary json = FsExecute(user, command);
                AuditLog.Info("[{}]", path);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Getfilechecksum:
            {
                FSOperations.FSFileChecksum command = new FSOperations.FSFileChecksum(path);
                IDictionary json = FsExecute(user, command);
                AuditLog.Info("[{}]", path);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Getfileblocklocations:
            {
                response = Response.Status(Response.Status.BadRequest).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Getaclstatus:
            {
                FSOperations.FSAclStatus command = new FSOperations.FSAclStatus(path);
                IDictionary json = FsExecute(user, command);
                AuditLog.Info("ACL status for [{}]", path);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Getxattrs:
            {
                IList <string> xattrNames = @params.GetValues <HttpFSParametersProvider.XAttrNameParam
                                                               >(HttpFSParametersProvider.XAttrNameParam.Name);
                XAttrCodec encoding = @params.Get <HttpFSParametersProvider.XAttrEncodingParam>(HttpFSParametersProvider.XAttrEncodingParam
                                                                                                .Name);
                FSOperations.FSGetXAttrs command = new FSOperations.FSGetXAttrs(path, xattrNames,
                                                                                encoding);
                IDictionary json = FsExecute(user, command);
                AuditLog.Info("XAttrs for [{}]", path);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            case HttpFSFileSystem.Operation.Listxattrs:
            {
                FSOperations.FSListXAttrs command = new FSOperations.FSListXAttrs(path);
                IDictionary json = FsExecute(user, command);
                AuditLog.Info("XAttr names for [{}]", path);
                response = Response.Ok(json).Type(MediaType.ApplicationJson).Build();
                break;
            }

            default:
            {
                throw new IOException(MessageFormat.Format("Invalid HTTP GET operation [{0}]", op
                                                           .Value()));
            }
            }
            return(response);
        }