Ejemplo n.º 1
0
        public void HandleMethod()
        {
            var node = Node.LoadNode(_handler.GlobalPath);
            var binaryPropertyName = "Binary";

            if (node == null)
            {
                var parentPath  = RepositoryPath.GetParentPath(_handler.GlobalPath);
                var currentName = RepositoryPath.GetFileName(_handler.GlobalPath);

                node = Node.LoadNode(parentPath);

                var foundNode = WebDavHandler.GetNodeByBinaryName(node, currentName, out binaryPropertyName);

                if (foundNode != null)
                {
                    node = foundNode;
                }
                else
                {
                    binaryPropertyName = "Binary";

                    // check if parent is contenttype
                    // (contenttypes are listed under their own folder, so the node exists only virtually)
                    var parentIsContentType = (node != null && node is ContentType);

                    if (!parentIsContentType)
                    {
                        _handler.Context.Response.StatusCode = 404;
                        _handler.Context.Response.Flush();
                    }

                    // parent is contenttype, continue operation on parent (foldernode's name is valid CTD name)
                }
            }

            // load specific version
            if (node != null && !string.IsNullOrEmpty(PortalContext.Current.VersionRequest))
            {
                VersionNumber version;
                if (VersionNumber.TryParse(PortalContext.Current.VersionRequest, out version))
                {
                    var nodeVersion = Node.LoadNode(node.Id, version);
                    if (nodeVersion != null && nodeVersion.SavingState == ContentSavingState.Finalized)
                    {
                        node = nodeVersion;
                    }
                }
            }

            ConverterPattern.DoTransform(node, _handler, binaryPropertyName);
            _handler.Context.Response.Flush();

            return;
        }
Ejemplo n.º 2
0
        public void HandleMethod()
        {
            var node = Node.LoadNode(_handler.GlobalPath);
            var binaryPropertyName = "Binary";

            if (node == null)
            {
                var parentPath  = RepositoryPath.GetParentPath(_handler.GlobalPath);
                var currentName = RepositoryPath.GetFileName(_handler.GlobalPath);

                node = Node.LoadNode(parentPath);

                var foundNode = WebDavHandler.GetNodeByBinaryName(node, currentName, out binaryPropertyName);

                if (foundNode != null)
                {
                    node = foundNode;
                }
                else
                {
                    binaryPropertyName = "Binary";

                    // check if parent is contenttype
                    //(contenttypes are listed under their own folder, so the node exists only virtually)
                    var parentIsContentType = (node != null && node is ContentType);

                    if (!parentIsContentType)
                    {
                        _handler.Context.Response.StatusCode = 404;
                        _handler.Context.Response.Flush();
                    }

                    // parent is contenttype, continue operation on parent (foldernode's name is valid CTD name)
                }
            }

            ConverterPattern.DoTransform(node, _handler, binaryPropertyName);
            _handler.Context.Response.Flush();

            return;
        }