Examples of MultiStatusResponse


Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

            response.sendError(DavServletResponse.SC_BAD_REQUEST);
            return;
        }

        MultiStatus ms = new MultiStatus();
        MultiStatusResponse msr = resource.alterProperties(changeList);
        ms.addResponse(msr);
        response.sendMultiStatus(ms);
    }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

        // TODO: missing undo of successful set/remove if subsequent operation fails
        // NOTE, that this is relevant with transactions only.

        // success: save all changes together if no error occurred
        complete();
        return new MultiStatusResponse(getHref(), DavServletResponse.SC_OK);
    }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

        } else {
            // change list contains more than the jcr:namespaces property
            // TODO: build multistatus instead
            throw new DavException(DavServletResponse.SC_CONFLICT);
        }
        return new MultiStatusResponse(getHref(), DavServletResponse.SC_OK);
    }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

            MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
            if (responses.length < 1) {
                throw new ItemNotFoundException("Unable to retrieve the node with id " + saveGetIdString(nodeId, sessionInfo));
            }

            MultiStatusResponse nodeResponse = null;
            List<MultiStatusResponse> childResponses = new ArrayList<MultiStatusResponse>();
            for (MultiStatusResponse response : responses) {
                if (isSameResource(uri, response)) {
                    nodeResponse = response;
                } else {
                    childResponses.add(response);
                }
            }

            if (nodeResponse == null) {
                throw new ItemNotFoundException("Unable to retrieve the node " + saveGetIdString(nodeId, sessionInfo));
            }

            DavPropertySet propSet = nodeResponse.getProperties(DavServletResponse.SC_OK);
            Object type = propSet.get(DavPropertyName.RESOURCETYPE).getValue();
            if (type == null) {
                // the given id points to a Property instead of a Node
                throw new ItemNotFoundException("No node for id " + saveGetIdString(nodeId, sessionInfo));
            }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

            MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
            if (responses.length != 1) {
                throw new ItemNotFoundException("Unable to retrieve the PropertyInfo. No such property " + uri);
            }

            MultiStatusResponse response = responses[0];
            DavPropertySet props = response.getProperties(DavServletResponse.SC_OK);
            int propertyType = PropertyType.valueFromName(props.get(JCR_TYPE).getValue().toString());

            if (propertyType == PropertyType.BINARY) {
                DavProperty<?> lengthsProp = props.get(JCR_LENGTHS);
                if (lengthsProp != null) {
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

            throw new DavException(DavServletResponse.SC_LOCKED);
        }
        if (!exists()) {
            throw new DavException(DavServletResponse.SC_NOT_FOUND);
        }
        MultiStatusResponse msr = new MultiStatusResponse(getHref(), null);
        try {
            Map<? extends PropEntry, ?> failures = config.getPropertyManager().alterProperties(getPropertyImportContext(changeList), isCollection());
            if (failures.isEmpty()) {
                // save all changes together (reverted in case this fails)
                node.save();
            } else {
                // set/remove of at least a single prop failed: undo modifications.
                node.refresh(false);
            }
            /* loop over list of properties/names that were successfully altered
               and them to the multistatus response respecting the result of the
               complete action. in case of failure set the status to 'failed-dependency'
               in order to indicate, that altering those names/properties would
               have succeeded, if no other error occured.*/
            for (PropEntry propEntry : changeList) {
                int statusCode;
                if (failures.containsKey(propEntry)) {
                    Object error = failures.get(propEntry);
                    statusCode = (error instanceof RepositoryException)
                            ? new JcrDavException((RepositoryException) error).getErrorCode()
                            : DavServletResponse.SC_INTERNAL_SERVER_ERROR;
                } else {
                    statusCode = (failures.isEmpty()) ? DavServletResponse.SC_OK : DavServletResponse.SC_FAILED_DEPENDENCY;
                }
                if (propEntry instanceof DavProperty) {
                    msr.add(((DavProperty<?>) propEntry).getName(), statusCode);
                } else {
                    msr.add((DavPropertyName) propEntry, statusCode);
                }
            }
            return msr;
        } catch (RepositoryException e) {
            // revert any changes made so far an throw exception
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

             */
            final String itemPath = row.getPath(sn.get(0));
            // create a new ms-response for this row of the result set
            DavResourceLocator loc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), itemPath, false);
            String href = loc.getHref(true);
            MultiStatusResponse resp = new MultiStatusResponse(href, null);
            // build the s-r-property
            SearchResultProperty srp = new SearchResultProperty(colNames,
                    selectorNames, values.toArray(new Value[values.size()]));
            resp.add(srp);
            ms.addResponse(resp);
        }
        return ms;
    }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

            method = new PropFindMethod( url, nameSet, DavConstants.DEPTH_0 );
            execute( method );
            if ( method.succeeded() )
            {
                MultiStatus multiStatus = method.getResponseBodyAsMultiStatus();
                MultiStatusResponse response = multiStatus.getResponses()[0];
                DavPropertySet propertySet = response.getProperties( HttpStatus.SC_OK );
                DavProperty property = propertySet.get( DavConstants.PROPERTY_RESOURCETYPE );
                if ( property != null )
                {
                    Node node = (Node) property.getValue();
                    return node.getLocalName().equals( DavConstants.XML_COLLECTION );
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

                    MultiStatus multiStatus = method.getResponseBodyAsMultiStatus();

                    for ( int i = 0; i < multiStatus.getResponses().length; i++ )
                    {

                        MultiStatusResponse response = multiStatus.getResponses()[i];

                        String entryUrl = response.getHref();
                        String fileName = PathUtils.filename( URLDecoder.decode( entryUrl ) );
                        if ( entryUrl.endsWith( "/" ) )
                        {
                            if ( i == 0 )
                            {
View Full Code Here

Examples of org.apache.jackrabbit.webdav.MultiStatusResponse

                    MultiStatusResponse[] responses =
                            method.getResponseBodyAsMultiStatus().getResponses();

                    for (int i = 0; i < responses.length; ++i)
                    {
                        MultiStatusResponse response = responses[i];
                        if (isCurrentFile(response.getHref(), name))
                        {
                            continue;
                        }
                        String resourceName = resourceName(response.getHref());
                        if (resourceName != null && resourceName.length() > 0)
                        {
                            WebdavFileObject fo = (WebdavFileObject) FileObjectUtils.
                                    getAbstractFileObject(getFileSystem().resolveFile(
                                            getFileSystem().getFileSystemManager().
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.