Package org.apache.slide.webdav

Examples of org.apache.slide.webdav.WebdavException


                }
            }
        } catch (Exception e) {
            int statusCode = getErrorCode( (Exception)e );
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
    }
View Full Code Here


            }
            resp.setStatus(WebdavStatus.SC_OK);
        } catch (Exception e) {
            int statusCode = getErrorCode( (Exception)e );
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
    }
View Full Code Here

    lockId = requestHeaders.getLockToken().trim(); // XXX trim is needed for Netdrive which sends trailing spaces
    if (lockId == null) {
      sendError(WebdavStatus.SC_PRECONDITION_FAILED,
          LOCK_TOKEN_HEADER_MISSING);
      throw new WebdavException(WebdavStatus.SC_PRECONDITION_FAILED);
    }
    try {
      Document requestContent = parseRequestContent();
      if (requestContent != null) {
        Element transactioninfo = requestContent.getRootElement();
        if (E_TRANSACTIONINFO.equals(transactioninfo.getName())) {
                    slideToken.setExternalTx();
          Element transactionstatus = transactioninfo
              .getChild(E_TRANSACTIONSTATUS, Namespace.getNamespace(S_DAV));
          if (transactionstatus != null) {
            Element action = (Element) transactionstatus
                .getChildren().get(0);
            if (action != null) {
              if (E_COMMIT.equals(action.getName())) {
                command = COMMIT_TRANSACTION;
              } else if (E_ABORT.equals(action.getName())) {
                command = ABORT_TRANSACTION;
              } else {
                        sendError(WebdavStatus.SC_BAD_REQUEST,
                                "transactionstatus must be one of commit or abort");
                        throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
                     }
            } else {
                sendError(WebdavStatus.SC_BAD_REQUEST,
                          "transactionstatus must contain one of commit or abort");
                      throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
                  }
          }
        }
      }
    }
      catch (WebdavException e) {
          throw e;
      }
      catch (Exception exception) {
       sendError(WebdavStatus.SC_BAD_REQUEST, exception);
      throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
    }
  }
View Full Code Here

        try {
          sendPreconditionViolation(e);
          throw e;
        } catch (IOException x) {
        }
        throw new WebdavException(e.getStatusCode());
      } catch (Exception e) {
        int statusCode = getErrorCode(e);
        sendError(statusCode, e);
        throw new WebdavException(statusCode);
      }
    }
  }
View Full Code Here

                reportWorker.init(resourcePath, reportElm);
            }
            else {
                int statusCode = WebdavStatus.SC_BAD_REQUEST;
                sendError( statusCode, new Exception("Unknown report "+reportName) );
                throw new WebdavException( statusCode );
            }
        }
        catch (IOException e) {  // TODO: merge exception handling into jdom access methods
            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
        catch (JDOMException e) {  // TODO: merge exception handling into jdom access methods
            int statusCode = WebdavStatus.SC_BAD_REQUEST;
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
        catch (PreconditionViolationException e) {  // TODO: merge exception handling into jdom access methods
            try {
                sendPreconditionViolation(e);
                throw e;
            } catch (IOException x) {}
            throw new WebdavException(e.getStatusCode());
        }
    }
View Full Code Here

                        (AbstractReport)cls.getConstructor(parmtypes).newInstance(initargs);
                }
                catch( Exception e ) {
                    int statusCode = WebdavStatus.SC_BAD_REQUEST;
                sendError( statusCode, new Exception("Cannot create "+reportName+" report worker "+clsName+" ["+e+"]") );
                    throw new WebdavException( statusCode );
                }
            }
        return result;
    }
View Full Code Here

        // check lock-null resources
        try {
            if (isLockNull(resourcePath)) {
                int statusCode = WebdavStatus.SC_NOT_FOUND;
                sendError( statusCode, "lock-null resource", new Object[]{resourcePath} );
                throw new WebdavException( statusCode );
            }
        }
        catch (ServiceAccessException e) {
            int statusCode = getErrorCode( e );
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
       
        try {
            if ( WebdavEvent.REPORT.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(WebdavEvent.REPORT, new WebdavEvent(this));

            reportWorker.checkPreconditions(resourcePath, getDepth());
            Element rootElm;
            if (reportWorker instanceof PrincipalSearchPropertySetReport) {
                rootElm = new Element(E_PRINCIPAL_SEARCH_PROPERTY_SET, DNSP);
                reportWorker.execute(resourcePath, rootElm, getDepth());
                resp.setStatus(WebdavStatus.SC_OK);
            }
            else {
                rootElm = new Element(E_MULTISTATUS, DNSP);
                reportWorker.execute(resourcePath, rootElm, getDepth());
                resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
            }
            org.jdom.output.Format format = org.jdom.output.Format.getPrettyFormat();
            format.setIndent(XML_RESPONSE_INDENT);
            new XMLOutputter(format).
                output(new Document(rootElm), resp.getWriter());
        }
        catch (PreconditionViolationException e) {
            sendPreconditionViolation(e);
            throw e;
        }
        catch (Exception e) {
            int statusCode = getErrorCode( e );
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
    }
View Full Code Here

        // check lock-null resources
        try {
            if (isLockNull(resourcePath)) {
                int statusCode = WebdavStatus.SC_NOT_FOUND;
                sendError( statusCode, "lock-null resource", new Object[]{resourcePath} );
                throw new WebdavException( statusCode );
            }
        }
        catch (ServiceAccessException e) {
            int statusCode = getErrorCode((Exception)e);
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }

        try {
            VersioningHelper vh = VersioningHelper.getVersioningHelper(
                slideToken, token, req, resp, getConfig() );
            vh.mkworkspace( resourcePath );
        }
        catch (PreconditionViolationException e) {
            sendPreconditionViolation(e);
            throw e;
        }
        catch (Exception e) {
            int statusCode = getErrorCode( e );
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
        finally {
            resp.setHeader(H_CACHE_CONTROL, NO_CACHE);
        }
    }
View Full Code Here

        }
        else {
            Domain.warn(
                "Do not know how to checkout a '"+rRk+"' resource" );
            resp.setStatus(WebdavStatus.SC_CONFLICT);
            throw new WebdavException( WebdavStatus.SC_CONFLICT );
        }
    }
View Full Code Here

        }
        else {
            Domain.warn(
                "Do not know how to checkout a '"+rRk+"' resource" );
            resp.setStatus(WebdavStatus.SC_CONFLICT);
            throw new WebdavException( WebdavStatus.SC_CONFLICT );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.webdav.WebdavException

Copyright © 2018 www.massapicom. 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.