Search in sources :

Example 1 with BindableResource

use of org.apache.jackrabbit.webdav.bind.BindableResource in project jackrabbit by apache.

the class AbstractWebdavServlet method doRebind.

/**
 * The REBIND method
 *
 * @param request
 * @param response
 * @param resource the collection resource to which a new member will be added
 * @throws IOException
 * @throws DavException
 */
protected void doRebind(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException {
    if (!resource.exists()) {
        response.sendError(DavServletResponse.SC_NOT_FOUND);
    }
    RebindInfo rebindInfo = request.getRebindInfo();
    DavResource oldBinding = getResourceFactory().createResource(request.getHrefLocator(rebindInfo.getHref()), request, response);
    if (!(oldBinding instanceof BindableResource)) {
        response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
        return;
    }
    DavResource newBinding = getResourceFactory().createResource(request.getMemberLocator(rebindInfo.getSegment()), request, response);
    int status = validateDestination(newBinding, request, false);
    if (status > DavServletResponse.SC_NO_CONTENT) {
        response.sendError(status);
        return;
    }
    ((BindableResource) oldBinding).rebind(resource, newBinding);
    response.setStatus(status);
}
Also used : DavResource(org.apache.jackrabbit.webdav.DavResource) BindableResource(org.apache.jackrabbit.webdav.bind.BindableResource) RebindInfo(org.apache.jackrabbit.webdav.bind.RebindInfo)

Example 2 with BindableResource

use of org.apache.jackrabbit.webdav.bind.BindableResource in project jackrabbit by apache.

the class AbstractWebdavServlet method doBind.

/**
 * The BIND method
 *
 * @param request
 * @param response
 * @param resource the collection resource to which a new member will be added
 * @throws IOException
 * @throws DavException
 */
protected void doBind(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException {
    if (!resource.exists()) {
        response.sendError(DavServletResponse.SC_NOT_FOUND);
    }
    BindInfo bindInfo = request.getBindInfo();
    DavResource oldBinding = getResourceFactory().createResource(request.getHrefLocator(bindInfo.getHref()), request, response);
    if (!(oldBinding instanceof BindableResource)) {
        response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
        return;
    }
    DavResource newBinding = getResourceFactory().createResource(request.getMemberLocator(bindInfo.getSegment()), request, response);
    int status = validateDestination(newBinding, request, false);
    if (status > DavServletResponse.SC_NO_CONTENT) {
        response.sendError(status);
        return;
    }
    ((BindableResource) oldBinding).bind(resource, newBinding);
    response.setStatus(status);
}
Also used : DavResource(org.apache.jackrabbit.webdav.DavResource) BindableResource(org.apache.jackrabbit.webdav.bind.BindableResource) BindInfo(org.apache.jackrabbit.webdav.bind.BindInfo)

Aggregations

DavResource (org.apache.jackrabbit.webdav.DavResource)2 BindableResource (org.apache.jackrabbit.webdav.bind.BindableResource)2 BindInfo (org.apache.jackrabbit.webdav.bind.BindInfo)1 RebindInfo (org.apache.jackrabbit.webdav.bind.RebindInfo)1