gpt4 book ai didi

org.apache.jackrabbit.webdav.WebdavResponse.setStatus()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 11:53:05 27 4
gpt4 key购买 nike

本文整理了Java中org.apache.jackrabbit.webdav.WebdavResponse.setStatus()方法的一些代码示例,展示了WebdavResponse.setStatus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebdavResponse.setStatus()方法的具体详情如下:
包路径:org.apache.jackrabbit.webdav.WebdavResponse
类名称:WebdavResponse
方法名:setStatus

WebdavResponse.setStatus介绍

暂无

代码示例

代码示例来源:origin: org.apache.sling/org.apache.sling.jcr.webdav

/** Overridden as the base class uses sendError that we don't want (SLING-2443) */
  @Override
  protected void sendUnauthorized(WebdavRequest request, WebdavResponse response, DavException error) throws IOException {
    response.setHeader("WWW-Authenticate", getAuthenticateHeaderValue());
    response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    if (error != null) {
      response.getWriter().write(error.getStatusPhrase());
      response.getWriter().write("\n");
    }
    response.getWriter().flush();
  }
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The DELETE method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doDelete(WebdavRequest request, WebdavResponse response,
            DavResource resource) throws IOException, DavException {
  DavResource parent = resource.getCollection();
  if (parent != null) {
    parent.removeMember(resource);
    response.setStatus(DavServletResponse.SC_NO_CONTENT);
  } else {
    response.sendError(DavServletResponse.SC_FORBIDDEN, "Cannot remove the root resource.");
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * The UNSUBSCRIBE method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doUnsubscribe(WebdavRequest request,
               WebdavResponse response,
               DavResource resource)
    throws IOException, DavException {
  if (!(resource instanceof ObservationResource)) {
    response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
    return;
  }
  ((ObservationResource) resource).unsubscribe(request.getSubscriptionId());
  response.setStatus(DavServletResponse.SC_NO_CONTENT);
}

代码示例来源:origin: apache/jackrabbit

/**
 * The DELETE method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doDelete(WebdavRequest request, WebdavResponse response,
            DavResource resource) throws IOException, DavException {
  DavResource parent = resource.getCollection();
  if (parent != null) {
    parent.removeMember(resource);
    response.setStatus(DavServletResponse.SC_NO_CONTENT);
  } else {
    response.sendError(DavServletResponse.SC_FORBIDDEN, "Cannot remove the root resource.");
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * The CHECKIN method
 *
 * @param request
 * @param response
 * @param resource
 * @throws DavException
 * @throws IOException
 */
protected void doCheckin(WebdavRequest request, WebdavResponse response,
             DavResource resource)
    throws DavException, IOException {
  if (!(resource instanceof VersionControlledResource)) {
    response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
    return;
  }
  String versionHref = ((VersionControlledResource) resource).checkin();
  response.setHeader(DeltaVConstants.HEADER_LOCATION, versionHref);
  response.setStatus(DavServletResponse.SC_CREATED);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The CHECKIN method
 *
 * @param request
 * @param response
 * @param resource
 * @throws DavException
 * @throws IOException
 */
protected void doCheckin(WebdavRequest request, WebdavResponse response,
             DavResource resource)
    throws DavException, IOException {
  if (!(resource instanceof VersionControlledResource)) {
    response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
    return;
  }
  String versionHref = ((VersionControlledResource) resource).checkin();
  response.setHeader(DeltaVConstants.HEADER_LOCATION, versionHref);
  response.setStatus(DavServletResponse.SC_CREATED);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The UNSUBSCRIBE method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doUnsubscribe(WebdavRequest request,
               WebdavResponse response,
               DavResource resource)
    throws IOException, DavException {
  if (!(resource instanceof ObservationResource)) {
    response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
    return;
  }
  ((ObservationResource) resource).unsubscribe(request.getSubscriptionId());
  response.setStatus(DavServletResponse.SC_NO_CONTENT);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The UNLOCK method
 *
 * @param request
 * @param response
 * @param resource
 * @throws DavException
 */
protected void doUnlock(WebdavRequest request, WebdavResponse response,
            DavResource resource) throws DavException {
  // get lock token from header
  String lockToken = request.getLockToken();
  TransactionInfo tInfo = request.getTransactionInfo();
  if (tInfo != null) {
    ((TransactionResource) resource).unlock(lockToken, tInfo);
  } else {
    resource.unlock(lockToken);
  }
  response.setStatus(DavServletResponse.SC_NO_CONTENT);
}

代码示例来源:origin: apache/jackrabbit

/**
 * The UNLOCK method
 *
 * @param request
 * @param response
 * @param resource
 * @throws DavException
 */
protected void doUnlock(WebdavRequest request, WebdavResponse response,
            DavResource resource) throws DavException {
  // get lock token from header
  String lockToken = request.getLockToken();
  TransactionInfo tInfo = request.getTransactionInfo();
  if (tInfo != null) {
    ((TransactionResource) resource).unlock(lockToken, tInfo);
  } else {
    resource.unlock(lockToken);
  }
  response.setStatus(DavServletResponse.SC_NO_CONTENT);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The ORDERPATCH method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doOrderPatch(WebdavRequest request,
              WebdavResponse response,
              DavResource resource)
    throws IOException, DavException {
  if (!(resource instanceof OrderingResource)) {
    response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
    return;
  }
  OrderPatch op = request.getOrderPatch();
  if (op == null) {
    response.sendError(DavServletResponse.SC_BAD_REQUEST);
    return;
  }
  // perform reordering of internal members
  ((OrderingResource) resource).orderMembers(op);
  response.setStatus(DavServletResponse.SC_OK);
}

代码示例来源:origin: apache/jackrabbit

/**
 * The ORDERPATCH method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doOrderPatch(WebdavRequest request,
              WebdavResponse response,
              DavResource resource)
    throws IOException, DavException {
  if (!(resource instanceof OrderingResource)) {
    response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
    return;
  }
  OrderPatch op = request.getOrderPatch();
  if (op == null) {
    response.sendError(DavServletResponse.SC_BAD_REQUEST);
    return;
  }
  // perform reordering of internal members
  ((OrderingResource) resource).orderMembers(op);
  response.setStatus(DavServletResponse.SC_OK);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The MOVE method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doMove(WebdavRequest request, WebdavResponse response,
           DavResource resource) throws IOException, DavException {
  DavResource destResource = getResourceFactory().createResource(request.getDestinationLocator(), request, response);
  int status = validateDestination(destResource, request, true);
  if (status > DavServletResponse.SC_NO_CONTENT) {
    response.sendError(status);
    return;
  }
  resource.move(destResource);
  response.setStatus(status);
}

代码示例来源:origin: apache/jackrabbit

/**
 * The MOVE method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doMove(WebdavRequest request, WebdavResponse response,
           DavResource resource) throws IOException, DavException {
  DavResource destResource = getResourceFactory().createResource(request.getDestinationLocator(), request, response);
  int status = validateDestination(destResource, request, true);
  if (status > DavServletResponse.SC_NO_CONTENT) {
    response.sendError(status);
    return;
  }
  resource.move(destResource);
  response.setStatus(status);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The MKWORKSPACE method
 *
 * @param request
 * @param response
 * @param resource
 * @throws DavException
 * @throws IOException
 */
protected void doMkWorkspace(WebdavRequest request, WebdavResponse response,
               DavResource resource) throws DavException, IOException {
  if (resource.exists()) {
    AbstractWebdavServlet.log.warn("Cannot create a new workspace. Resource already exists.");
    response.sendError(DavServletResponse.SC_FORBIDDEN);
    return;
  }
  DavResource parentResource = resource.getCollection();
  if (parentResource == null || !parentResource.exists() || !parentResource.isCollection()) {
    // parent does not exist or is not a collection
    response.sendError(DavServletResponse.SC_CONFLICT);
    return;
  }
  if (!(parentResource instanceof DeltaVResource)) {
    response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
    return;
  }
  ((DeltaVResource) parentResource).addWorkspace(resource);
  response.setStatus(DavServletResponse.SC_CREATED);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The PUT method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doPut(WebdavRequest request, WebdavResponse response,
           DavResource resource) throws IOException, DavException {
  DavResource parentResource = resource.getCollection();
  if (parentResource == null || !parentResource.exists()) {
    // parent does not exist
    response.sendError(DavServletResponse.SC_CONFLICT);
    return;
  }
  int status;
  // test if resource already exists
  if (resource.exists()) {
    status = DavServletResponse.SC_NO_CONTENT;
  } else {
    status = DavServletResponse.SC_CREATED;
  }
  parentResource.addMember(resource, getInputContext(request, request.getInputStream()));
  response.setStatus(status);
}

代码示例来源:origin: apache/jackrabbit

/**
 * The PUT method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doPut(WebdavRequest request, WebdavResponse response,
           DavResource resource) throws IOException, DavException {
  DavResource parentResource = resource.getCollection();
  if (parentResource == null || !parentResource.exists()) {
    // parent does not exist
    response.sendError(DavServletResponse.SC_CONFLICT);
    return;
  }
  int status;
  // test if resource already exists
  if (resource.exists()) {
    status = DavServletResponse.SC_NO_CONTENT;
  } else {
    status = DavServletResponse.SC_CREATED;
  }
  parentResource.addMember(resource, getInputContext(request, request.getInputStream()));
  response.setStatus(status);
}

代码示例来源:origin: apache/jackrabbit

/**
 * The COPY method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doCopy(WebdavRequest request, WebdavResponse response,
           DavResource resource) throws IOException, DavException {
  // only depth 0 and infinity is allowed
  int depth = request.getDepth(DEPTH_INFINITY);
  if (!(depth == DEPTH_0 || depth == DEPTH_INFINITY)) {
    response.sendError(DavServletResponse.SC_BAD_REQUEST);
    return;
  }
  DavResource destResource = getResourceFactory().createResource(request.getDestinationLocator(), request, response);
  int status = validateDestination(destResource, request, true);
  if (status > DavServletResponse.SC_NO_CONTENT) {
    response.sendError(status);
    return;
  }
  resource.copy(destResource, depth == DEPTH_0);
  response.setStatus(status);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * The COPY method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doCopy(WebdavRequest request, WebdavResponse response,
           DavResource resource) throws IOException, DavException {
  // only depth 0 and infinity is allowed
  int depth = request.getDepth(DEPTH_INFINITY);
  if (!(depth == DEPTH_0 || depth == DEPTH_INFINITY)) {
    response.sendError(DavServletResponse.SC_BAD_REQUEST);
    return;
  }
  DavResource destResource = getResourceFactory().createResource(request.getDestinationLocator(), request, response);
  int status = validateDestination(destResource, request, true);
  if (status > DavServletResponse.SC_NO_CONTENT) {
    response.sendError(status);
    return;
  }
  resource.copy(destResource, depth == DEPTH_0);
  response.setStatus(status);
}

代码示例来源:origin: apache/jackrabbit

/**
 * The MKCOL method
 *
 * @param request
 * @param response
 * @param resource
 * @throws IOException
 * @throws DavException
 */
protected void doMkCol(WebdavRequest request, WebdavResponse response,
            DavResource resource) throws IOException, DavException {
  DavResource parentResource = resource.getCollection();
  if (parentResource == null || !parentResource.exists() || !parentResource.isCollection()) {
    // parent does not exist or is not a collection
    response.sendError(DavServletResponse.SC_CONFLICT);
    return;
  }
  // shortcut: mkcol is only allowed on deleted/non-existing resources
  if (resource.exists()) {
    response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
    return;
  }
  if (request.getContentLength() > 0 || request.getHeader("Transfer-Encoding") != null) {
    parentResource.addMember(resource, getInputContext(request, request.getInputStream()));
  } else {
    parentResource.addMember(resource, getInputContext(request, null));
  }
  response.setStatus(DavServletResponse.SC_CREATED);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webdav

/**
 * 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);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com