Esempio n. 1
0
 private boolean deservesNotModified(DavRequest request) {
   return (request.getMethod().equals("GET") || request.getMethod().equals("HEAD"));
 }
Esempio n. 2
0
  /**
   * Hands the request off to a provider method for handling. The provider is created by calling
   * {@link #createProvider(DavResource)}. The specific provider method is chosen by examining the
   * request method.
   */
  protected void process(DavRequest request, DavResponse response, DavResource resource)
      throws IOException, DavException {
    DavProvider provider = createProvider(resource);

    if (request.getMethod().equals("OPTIONS")) options(request, response, resource);
    else if (request.getMethod().equals("GET")) provider.get(request, response, resource);
    else if (request.getMethod().equals("HEAD")) provider.head(request, response, resource);
    else if (request.getMethod().equals("PROPFIND")) provider.propfind(request, response, resource);
    else if (request.getMethod().equals("PROPPATCH"))
      provider.proppatch(request, response, resource);
    else if (request.getMethod().equals("DELETE")) provider.delete(request, response, resource);
    else if (request.getMethod().equals("COPY")) provider.copy(request, response, resource);
    else if (request.getMethod().equals("MOVE")) provider.move(request, response, resource);
    else if (request.getMethod().equals("REPORT")) provider.report(request, response, resource);
    else if (request.getMethod().equals("MKTICKET")) provider.mkticket(request, response, resource);
    else if (request.getMethod().equals("DELTICKET"))
      provider.delticket(request, response, resource);
    else if (request.getMethod().equals("ACL")) provider.acl(request, response, resource);
    else {
      if (resource.isCollection()) {
        if (request.getMethod().equals("MKCOL"))
          provider.mkcol(request, response, (DavCollection) resource);
        else if (request.getMethod().equals("MKCALENDAR"))
          provider.mkcalendar(request, response, (DavCollection) resource);
        else
          throw new MethodNotAllowedException(
              request.getMethod() + " not allowed for a collection");
      } else {
        if (request.getMethod().equals("PUT"))
          provider.put(request, response, (DavContent) resource);
        else
          throw new MethodNotAllowedException(
              request.getMethod() + " not allowed for a non-collection resource");
      }
    }
  }