You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2002/02/18 10:40:50 UTC

cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method ReportMethod.java

juergen     02/02/18 01:40:49

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        ReportMethod.java
  Log:
  Fixed header.
  
  Revision  Changes    Path
  1.3       +842 -783  jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java
  
  Index: ReportMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ReportMethod.java	16 Feb 2002 17:11:04 -0000	1.2
  +++ ReportMethod.java	18 Feb 2002 09:40:49 -0000	1.3
  @@ -1,5 +1,64 @@
   /*
  - * Copyright (c) 2002 SOFTWARE AG, All Rights Reserved.
  + * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v 1.3 2002/02/18 09:40:49 juergen Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/02/18 09:40:49 $
  + *
  + * ====================================================================
  + *
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
  + *    Foundation" must not be used to endorse or promote products derived
  + *    from this software without prior written permission. For written
  + *    permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + *
  + * [Additional notices, if required by prior licensing conditions]
  + *
    */
   
   package org.apache.slide.webdav.method;
  @@ -76,795 +135,795 @@
   /**
    * An implementation of the DeltaV <code>REPORT</code> method.
    *
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    *
    * @author <a href="mailto:ralf.stuckert@softwareag.com">Ralf Stuckert</a>
    */
   public class ReportMethod extends WebdavMethod implements DeltavConstants {
  -	
  -	/**
  -	 * String constant for <code>version-tree</code>.
  -	 */
  -	public static final String VERSION_TREE = "version-tree";
  -	
  -	/**
  -	 * String constant for <code>expand-property</code>.
  -	 */
  -	public static final String EXPAND_PROPERTY = "expand-property";
  -	
  -	/**
  -	 * String constant for <code>locate-by-history/code>.
  -	 */
  -	public static final String LOCATE_BY_HISTORY = "locate-by-history";
  -	
  -	/**
  -	 * String constant for <code>text/xml</code>.
  -	 */
  -	public static final String TEXT_XML = "text/xml";
  -	
  -	/**
  -	 * String constant for <code>allprop</code>.
  -	 */
  -	public static final String ALLPROP = "allprop";
  -	
  -	/**
  -	 * String constant for <code>prop</code>.
  -	 */
  -	public static final String PROP = "prop";
  -	
  -	/**
  -	 * String constant for <code>propstat</code>.
  -	 */
  -	public static final String PROPSTAT = "propstat";
  -	
  -	/**
  -	 * String constant for <code>response</code>.
  -	 */
  -	public static final String RESPONSE = "response";
  -	
  -	/**
  -	 * String constant for <code>status</code>.
  -	 */
  -	public static final String STATUS = "status";
  -	
  -	/**
  -	 * String constant for <code>history</code>.
  -	 */
  -	public static final String HISTORY_PATH = "history";
  -	
  -	/**
  -	 * String constant for <code>href</code>.
  -	 */
  -	public static final String HREF = "href";
  -	
  -	/**
  -	 * String constant for <code>D</code>.
  -	 */
  -	public static final String DAV_NS = "D";
  -	
  -	/**
  -	 * String constant for <code>DAV:</code>.
  -	 */
  -	public static final String DAV_NS_INFO = "DAV:";
  -	
  -	/**
  -	 * String constant for <code>multistatus</code>.
  -	 */
  -	public static final String MULTISTATUS = "multistatus";
  -	
  -	/**
  -	 * String constant for <code>UTF-8</code>.
  -	 */
  -	public static final String ENCODING = "UTF-8";
  -	
  -	/**
  -	 * String constant for <code>http://</code>.
  -	 */
  -	public static final String HTTP_PROTOCOL = "http://";
  -	
  -	/**
  -	 * String constant for <code>HTTP/1.1</code>.
  -	 */
  -	public static final String HTTP_VERSION = "HTTP/1.1";
  -	
  -	
  -	
  -	
  -	/**
  -	 * The path of the target resource.
  -	 */
  -	protected String resourcePath = null;
  -	
  -	/**
  -	 * The value of the <code>Depth</code> request header.
  -	 */
  -	protected int depth = 0;
  -	
  -	/**
  -	 * The list of requested properties.
  -	 */
  -	protected RequestedProperties requestedProperties = null;
  -	
  -	/**
  -	 * The request content (XML) Document.
  -	 */
  -	protected Document requestContentDocument = null;
  -	
  -	
  -	
  -	/**
  -	 * Creates a ReportMethod with the given arguments.
  -	 *
  -	 * @param      token          the NamespaceAccessToken.
  -	 * @param      request        the servlet request to process.
  -	 * @param      response       the servlet resonse.
  -	 * @param      servletConfig  the servlet configuration.
  -	 *
  -	 */
  +    
  +    /**
  +     * String constant for <code>version-tree</code>.
  +     */
  +    public static final String VERSION_TREE = "version-tree";
  +    
  +    /**
  +     * String constant for <code>expand-property</code>.
  +     */
  +    public static final String EXPAND_PROPERTY = "expand-property";
  +    
  +    /**
  +     * String constant for <code>locate-by-history/code>.
  +     */
  +    public static final String LOCATE_BY_HISTORY = "locate-by-history";
  +    
  +    /**
  +     * String constant for <code>text/xml</code>.
  +     */
  +    public static final String TEXT_XML = "text/xml";
  +    
  +    /**
  +     * String constant for <code>allprop</code>.
  +     */
  +    public static final String ALLPROP = "allprop";
  +    
  +    /**
  +     * String constant for <code>prop</code>.
  +     */
  +    public static final String PROP = "prop";
  +    
  +    /**
  +     * String constant for <code>propstat</code>.
  +     */
  +    public static final String PROPSTAT = "propstat";
  +    
  +    /**
  +     * String constant for <code>response</code>.
  +     */
  +    public static final String RESPONSE = "response";
  +    
  +    /**
  +     * String constant for <code>status</code>.
  +     */
  +    public static final String STATUS = "status";
  +    
  +    /**
  +     * String constant for <code>history</code>.
  +     */
  +    public static final String HISTORY_PATH = "history";
  +    
  +    /**
  +     * String constant for <code>href</code>.
  +     */
  +    public static final String HREF = "href";
  +    
  +    /**
  +     * String constant for <code>D</code>.
  +     */
  +    public static final String DAV_NS = "D";
  +    
  +    /**
  +     * String constant for <code>DAV:</code>.
  +     */
  +    public static final String DAV_NS_INFO = "DAV:";
  +    
  +    /**
  +     * String constant for <code>multistatus</code>.
  +     */
  +    public static final String MULTISTATUS = "multistatus";
  +    
  +    /**
  +     * String constant for <code>UTF-8</code>.
  +     */
  +    public static final String ENCODING = "UTF-8";
  +    
  +    /**
  +     * String constant for <code>http://</code>.
  +     */
  +    public static final String HTTP_PROTOCOL = "http://";
  +    
  +    /**
  +     * String constant for <code>HTTP/1.1</code>.
  +     */
  +    public static final String HTTP_VERSION = "HTTP/1.1";
  +    
  +    
  +    
  +    
  +    /**
  +     * The path of the target resource.
  +     */
  +    protected String resourcePath = null;
  +    
  +    /**
  +     * The value of the <code>Depth</code> request header.
  +     */
  +    protected int depth = 0;
  +    
  +    /**
  +     * The list of requested properties.
  +     */
  +    protected RequestedProperties requestedProperties = null;
  +    
  +    /**
  +     * The request content (XML) Document.
  +     */
  +    protected Document requestContentDocument = null;
  +    
  +    
  +    
  +    /**
  +     * Creates a ReportMethod with the given arguments.
  +     *
  +     * @param      token          the NamespaceAccessToken.
  +     * @param      request        the servlet request to process.
  +     * @param      response       the servlet resonse.
  +     * @param      servletConfig  the servlet configuration.
  +     *
  +     */
       public ReportMethod(NamespaceAccessToken token, HttpServletRequest request, HttpServletResponse response, WebdavServletConfig servletConfig) {
  -		super(token, request, response, servletConfig);
  +        super(token, request, response, servletConfig);
       }
  -	
  -	
  -	/**
  -	 * Parses the request.
  -	 *
  -	 * @throws     WebdavException  if parsing fails (e.g. if it is a <code>bad
  -	 *                              </code> request).
  -	 */
  +    
  +    
  +    /**
  +     * Parses the request.
  +     *
  +     * @throws     WebdavException  if parsing fails (e.g. if it is a <code>bad
  +     *                              </code> request).
  +     */
       protected void parseRequest() throws WebdavException {
  -		
  -		retrieveResourcePath();
  -		retrieveDepth();
  -		
  -		if ( ! getRequest().getContentType().startsWith(TEXT_XML) ){
  -			return;
  -		}
  -		
  -		try{
  -			retrieveRequestContent();
  -			
  -			Element element = getRequestContent().getRootElement();
  -			if (element == null) {
  -				throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -			}
  -			
  -			if (element.getName().equalsIgnoreCase(VERSION_TREE)){
  -				parseVersionTreeRequest(element);
  -			}
  -			else if (element.getName().equalsIgnoreCase(EXPAND_PROPERTY)){
  -				// TODO
  -				// expand-property report
  -			}
  -			else if (element.getName().equalsIgnoreCase(LOCATE_BY_HISTORY)){
  -				// TODO
  -				// locate-by-history report
  -			}
  -			else{
  -				throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -			}
  -		}
  -		catch (IOException  e){
  -			throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -		}
  -		catch (SAXException  e){
  -			throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -		}
  -		catch (ParserConfigurationException  e){
  -			throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -		}
  -	}
  -	
  -	/**
  -	 * Parses the <code>&lt;version-tree&gt;</code> request.
  -	 *
  -	 * @param      versionTreeElement  the <code>&lt;version-tree&gt;</code>
  -	 *                                 Element.
  -	 *
  -	 * @throws     WebdavException if parsing fails for any reason.
  -	 */
  -	protected void parseVersionTreeRequest(Element versionTreeElement) throws WebdavException {
  -		
  -		List childrenList = versionTreeElement.getChildren();
  -		if (childrenList.size() == 0) {
  -			throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -		}
  -		
  -		Element element = (Element)childrenList.get(0);
  -		
  -		if ( ALLPROP.equals(element.getName()) || PROP.equals(element.getName()) ) {
  -			requestedProperties = new RequestedPropertiesImpl(element);
  -		}
  -		else {
  -			throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -		}
  -	}
  -	
  -	/**
  -	 * Executes the servlet request.
  -	 *
  -	 * @throws     IOException      if any I/O problems occur during execution.
  -	 * @throws     WebdavException  if processing the request fails.
  -	 */
  -	protected void executeRequest() throws IOException, WebdavException {
  -		
  -		// content type must be set BEFORE calling getWriter()
  -		getResponse().setContentType(TEXT_XML + "; charset=" + ENCODING);
  -		
  -		Element multistatusElement = new Element(MULTISTATUS, Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		
  -		getResponse().setStatus(WebdavStatus.SC_MULTI_STATUS);
  -		
  -		try {
  -			
  -			executeVersionTreeReport(requestUri, multistatusElement);
  -			
  -			new XMLOutputter().output(multistatusElement, getResponse().getWriter());
  -		}
  -		catch (Exception e) {
  -			e.printStackTrace();
  -//			writeErrorResponse(generatedXML, e);
  -//			generatedXML.writeElement(DAV_NS, null, MULTISTATUS, XMLPrinter.CLOSING);
  -//			generatedXML.sendData();
  -			
  -			String statusText = getStatusText(e);
  -			if (statusText != null) {
  -				resp.sendError(getErrorCode(e), statusText);
  -			}
  -			else {
  -				resp.sendError(getErrorCode(e));
  -			}
  -		}
  -	}
  -	
  -	/**
  -	 * Executes a requested <code>version-tree</code> report.
  -	 *
  -	 * @param      requestUri     the URI of the requested resource.
  -	 * @param      parentElement  the parent Element to append the
  -	 *                            &lt;response&gt;</code> to.
  -	 *
  -	 * @throws     WebdavException
  -	 * @throws     ObjectLockedException
  -	 * @throws     RevisionDescriptorNotFoundException
  -	 * @throws     ServiceAccessException
  -	 * @throws     LinkedObjectNotFoundException
  -	 * @throws     AccessDeniedException
  -	 * @throws     ObjectNotFoundException
  -	 * @throws     JDOMException
  -	 */
  -	protected void executeVersionTreeReport(String requestUri, Element parentElement) throws WebdavException, ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, JDOMException {
  -		
  -		NodeRevisionDescriptors revisionDescriptors = null;
  -		NodeRevisionDescriptor revisionDescriptor = null;
  -		NodeRevisionNumber revisionNumber = null;
  -		String slideUri = null;
  -		boolean isHistory = false;
  -		
  -		if (isHistoryURI(requestUri)) {
  -			revisionDescriptors = content.retrieve(slideToken, requestUri);
  -			revisionNumber = new NodeRevisionNumber(0, 0);
  -			slideUri = requestUri;
  -			isHistory = true;
  -		}
  -		else if (isRevisionURI(requestUri)) {
  -			String revisionUri = getHistoryURI(requestUri);
  -			revisionDescriptors = content.retrieve(slideToken, revisionUri);
  -			revisionNumber = getRevisionNumber(requestUri);
  -			slideUri = revisionUri;
  -		}
  -		else {
  -			revisionDescriptors = content.retrieve(slideToken, getResourcePath());
  -			revisionNumber = revisionDescriptors.getLatestRevision();
  -			slideUri = getResourcePath();
  -			
  -			// check if this is a VCR
  -			revisionDescriptor = content.retrieve(slideToken,
  -												  revisionDescriptors,
  -												  revisionNumber);
  -			NodeProperty lastCheckedInRevisionProperty = revisionDescriptor.getProperty(P_CHECKED_IN);
  -			if (lastCheckedInRevisionProperty == null) {
  -				lastCheckedInRevisionProperty = revisionDescriptor.getProperty(P_CHECKED_OUT);
  -			}
  -			if (lastCheckedInRevisionProperty != null) {
  -				String revisionUri = getHistoryURI((String)lastCheckedInRevisionProperty.getValue());
  -				revisionDescriptors = content.retrieve(slideToken, revisionUri);
  -				revisionNumber = getRevisionNumber((String)lastCheckedInRevisionProperty.getValue());
  -				slideUri = revisionUri;
  -			}
  -		}
  -		
  -		
  -		revisionDescriptor = content.retrieve(slideToken,
  -											  revisionDescriptors,
  -											  revisionNumber);
  -		NodeProperty supportedReportSetProperty =
  -			revisionDescriptor.getProperty(P_SUPPORTED_REPORT_SET);
  -		if ( (supportedReportSetProperty == null) ||
  -				(supportedReportSetProperty.toString().indexOf(R_VERSION_TREE) < 0) ) {
  -			// TODO:
  -			// version tree report not supported
  -		}
  -		
  -		try {
  -			if (revisionDescriptors.isVersioned()){
  -				writeVersionTreeReport(slideUri, revisionDescriptors, revisionNumber, slideToken, requestUri, parentElement);
  -			}
  -			else {
  -				writeVersionTreeReport(requestUri, parentElement);
  -			}
  -		}
  -		catch (SlideException e) {
  -			throw new WebdavException(getErrorCode(e));
  -		}
  -	}
  -	
  -	
  -	
  -	/**
  -	 * Write the <code>version-tree</code> report of the unversioned resource
  -	 * specified by the <code>revisionDescriptor</code>
  -	 *
  -	 * @param      slideUri
  -	 * @param      revisionDescriptors
  -	 * @param      revisionNumber
  -	 * @param      slideToken
  -	 * @param      requestUri
  -	 * @param      parentElement  the parent Element to append the
  -	 *                            &lt;response&gt;</code> to.
  -	 *
  -	 * @throws     ObjectLockedException
  -	 * @throws     ServiceAccessException
  -	 * @throws     LinkedObjectNotFoundException
  -	 * @throws     AccessDeniedException
  -	 * @throws     ObjectNotFoundException
  -	 * @throws     RevisionDescriptorNotFoundException
  -	 * @throws     LockTokenNotFoundException
  -	 * @throws     JDOMException
  -	 */
  -	private void writeVersionTreeReport(String slideUri, NodeRevisionDescriptors revisionDescriptors, NodeRevisionNumber revisionNumber, SlideToken slideToken, String requestUri, Element parentElement)  throws ObjectLockedException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, RevisionDescriptorNotFoundException, LockTokenNotFoundException, JDOMException  {
  -		
  -		System.out.println("Versioned");
  -		
  -		int statusCode = WebdavStatus.SC_OK;
  -		
  -		Element response = new Element(RESPONSE,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		parentElement.addContent(response);
  -		
  -		Element href = new Element(HREF,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		href.setText(HTTP_PROTOCOL + req.getServerName()+ ":" + req.getServerPort() + req.getContextPath() + requestUri);
  -		response.addContent(href);
  -		
  -		PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
  -		
  -		if (revisionNumber.equals(new NodeRevisionNumber(0, 0))) {
  -			// this is a history
  -			response.addContent(retriever.getPropertiesOfObject(getRequestedProperties(), slideUri, revisionNumber, req.getContextPath(), true));
  -		}
  -		else {
  -			// this is a versioned resource
  -			Enumeration revisionNumberEnum = revisionDescriptors.getSuccessors(revisionDescriptors.getInitialRevision());
  -			while (revisionNumberEnum.hasMoreElements()) {
  -				response.addContent(retriever.getPropertiesOfObject(getRequestedProperties(), slideUri, (NodeRevisionNumber)revisionNumberEnum.nextElement(), req.getContextPath(), true));
  -			}
  -		}
  -	}
  -	
  -	
  -	/**
  -	 * Write the <code>version-tree</code> report of the unversioned resource
  -	 * specified by the <code>revisionDescriptor</code>
  -	 *
  -	 * @param      requestUri    the URI of the requested resource.
  -	 * @param      parentElement  the parent Element to append the
  -	 *                            &lt;response&gt;</code> to.
  -	 *
  -	 * @throws     ObjectLockedException
  -	 * @throws     ServiceAccessException
  -	 * @throws     LinkedObjectNotFoundException
  -	 * @throws     AccessDeniedException
  -	 * @throws     ObjectNotFoundException
  -	 * @throws     RevisionDescriptorNotFoundException
  -	 * @throws     LockTokenNotFoundException
  -	 * @throws     JDOMException
  -	 */
  -	private void writeVersionTreeReport(String requestUri, Element parentElement)  throws ObjectLockedException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, RevisionDescriptorNotFoundException, LockTokenNotFoundException, JDOMException  {
  -		
  -		int statusCode = WebdavStatus.SC_OK;
  -		
  -		Element response = new Element(RESPONSE,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		parentElement.addContent(response);
  -		
  -		Element href = new Element(HREF,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		href.setText(HTTP_PROTOCOL + req.getServerName()+ ":" + req.getServerPort() + req.getContextPath() + requestUri);
  -		response.addContent(href);
  -		
  -		PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
  -		response.addContent(retriever.getPropertiesOfObject(getRequestedProperties(), requestUri, req.getContextPath(), true));
  -	}
  -	
  -	
  -	/**
  -	 * Writes the appropriate <code>&lt;response&gt;</code> due to the given
  -	 * <code>exception</code> to the <code>generatedXML</code>
  -	 *
  -	 * @param      parentElement  the parent Element to append the
  -	 *                            &lt;response&gt;</code> to.
  -	 * @param      exception   the exception that caused the error.
  -	 */
  -	private void writeErrorResponse(Element parentElement, Exception exception) {
  -		
  -		Element response = new Element(RESPONSE,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		parentElement.addContent(response);
  -		
  -		Element href = new Element(HREF,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		href.setText(HTTP_PROTOCOL +
  -						 getRequest().getServerName()+ ":" +
  -						 getRequest().getServerPort() +
  -						 getRequest().getContextPath() +
  -						 requestUri);
  -		response.addContent(href);
  -		
  -		Element propStat = new Element(PROPSTAT,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		response.addContent(propStat);
  -		
  -		Element status = new Element(STATUS,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  -		int iErrorCode = getErrorCode(exception);
  -		status.setText(HTTP_VERSION + " " + iErrorCode  + " " + WebdavStatus.getStatusText(iErrorCode));
  -		propStat.addContent(status);
  -	}
  -	
  -	
  -	/**
  -	 * Returns the list of requested properties.
  -	 *
  -	 * @return     the list of requested properties.
  -	 */
  -	protected RequestedProperties getRequestedProperties() {
  -		if (requestedProperties == null) {
  -			requestedProperties = new RequestedPropertiesImpl();
  -		}
  -		return requestedProperties;
  -	}
  -	
  -	/**
  -	 * Returns the path of the target resource.
  -	 *
  -	 * @return     the path of the target resource.
  -	 */
  -	protected String getResourcePath() {
  -		return resourcePath;
  -	}
  -	
  -	/**
  -	 * Retrieves the path of the target resource.
  -	 */
  -	protected void retrieveResourcePath() {
  -		resourcePath = requestUri;
  -		if (resourcePath == null) {
  -			resourcePath = "/";
  -		}
  -	}
  -	
  -	/**
  -	 * Returns the request content (XML) Document.
  -	 *
  -	 * @return     the request content (XML) Document.
  -	 */
  -	protected Document getRequestContent() {
  -		return requestContentDocument;
  -	}
  -	
  -	/**
  -	 * Retrieves the request content (XML) Document.
  -	 */
  -	protected void retrieveRequestContent() throws ParserConfigurationException, IOException, SAXException{
  -		requestContentDocument = new DOMBuilder().build(parseRequestContent());
  -	}
  -	
  -	/**
  -	 * Returns the value of the <code>Depth</code> request header.
  -	 *
  -	 * @return     the value of the <code>Depth</code> request header.
  -	 */
  -	protected int getDepth() {
  -		return depth;
  -	}
  -	
  -	
  -	/**
  -	 * Retrieves the value of the <code>Depth</code> header.
  -	 */
  -	protected void retrieveDepth() {
  -		
  -		depth = Integer.MAX_VALUE;
  -		try {
  -			depth = req.getIntHeader("Depth");
  -		}
  -		catch (java.lang.NumberFormatException nfEx){
  -		}
  -	}
  -	
  -	/**
  -	 * Returns the servlet request.
  -	 *
  -	 * @return     the servlet request.
  -	 */
  -	public HttpServletRequest getRequest() {
  -		return req;
  -	}
  -	
  -	
  -	/**
  -	 * Returns the servlet response.
  -	 *
  -	 * @return     the servlet response.
  -	 */
  -	public HttpServletResponse getResponse() {
  -		return resp;
  -	}
  -	
  -	
  -	/**
  -	 * Returns the NamespaceAccessToken.
  -	 *
  -	 * @return     the NamespaceAccessToken.
  -	 */
  -	public NamespaceAccessToken getNamespaceAccessToken() {
  -		return token;
  -	}
  -	
  -	
  -//
  -//	/**
  -//	 * Returns the first child node of the given <code>element</code>
  -//	 * that is an Element. If none was found, <code>null</code> is returned.
  -//	 *
  -//	 * @param      element  the Element for which to return the first child
  -//	 *                      Element.
  -//	 *
  -//	 * @return     the first child node of the given <code>element</code>
  -//	 *             that is an Element.
  -//	 */
  -//	public static Element getFirstChildElement(Element element) {
  -//
  -//		Element child = null;
  -//		List childElementList = getChildElementList(element);
  -//		if (childElementList.size() > 0) {
  -//			child = (Element)childElementList.get(0);
  -//		}
  -//		return child;
  -//	}
  -//
  -//	/**
  -//	 * Returns a List containing all child Elements of the given
  -//	 * <code>element</code>.
  -//	 *
  -//	 * @param      element  the Element for which to return the List of child
  -//	 *                      Elements.
  -//	 *
  -//	 * @return     a List containing all child Elements of the given
  -//	 *             <code>element</code>.
  -//	 */
  -//	public static List getChildElementList(Element element) {
  -//
  -//		List childElementList = new ArrayList();
  -//		if (element != null) {
  -//			NodeList nodeList = element.getChildNodes();
  -//			for (int i=0; i<nodeList.getLength(); i++) {
  -//				if (nodeList.item(i).getNodeType() == Node.ELEMENT_NODE) {
  -//					childElementList.add(nodeList.item(i));
  -//				}
  -//			}
  -//		}
  -//		return childElementList;
  -//	}
  -//
  -//
  -//	/**
  -//	 * Returns the first child node of the given <code>element</code>
  -//	 * that is an Element. If none was found, <code>null</code> is returned.
  -//	 *
  -//	 * @param      element  the Element for which to return the first child
  -//	 *                      Element.
  -//	 *
  -//	 * @return     the first child node of the given <code>element</code>
  -//	 *             that is an Element.
  -//	 */
  -//	public static Element getNextSiblingElement(Element element) {
  -//
  -//		Element sibling = null;
  -//		if (element != null) {
  -//			Node nextSibling = element.getNextSibling();
  -//			while ( (sibling == null) && (nextSibling != null) ) {
  -//				if (nextSibling.getNodeType() == Node.ELEMENT_NODE) {
  -//					sibling = (Element)nextSibling;
  -//				}
  -//				nextSibling = nextSibling.getNextSibling();
  -//			}
  -//		}
  -//		return sibling;
  -//	}
  -//
  -//	/**
  -//	 * Returns the <code>node</code>'s name. If a namespace prefix is set this
  -//	 * is the local name, otherwise the full name.
  -//	 *
  -//	 * @param      node  the Node for which to return the name.
  -//	 *
  -//	 * @return     the <code>node</code>'s name.
  -//	 */
  -//	public static String getNodeName(Node node) {
  -//
  -//		String nodeName = null;
  -//		if (node != null) {
  -//			if (node.getLocalName() != null) {
  -//				nodeName = node.getLocalName();
  -//			}
  -//			else {
  -//				nodeName = node.getNodeName();
  -//			}
  -//		}
  -//		return nodeName;
  -//	}
  -//
  -//	/**
  -//	 * Returns a start tag for the given <code>tagName</code>,
  -//	 * e.g. for <code>hello</code> the tag <code>&lt;hello&gt;</code>
  -//	 * will be returned.
  -//	 *
  -//	 * @param      tagName  the name of the tag.
  -//	 *
  -//	 * @return     a start tag for the given <code>tagName</code>.
  -//	 */
  -//	public static String getStartTag(String tagName) {
  -//		return "<" + tagName + ">";
  -//	}
  -//
  -//	/**
  -//	 * Returns an end tag for the given <code>tagName</code>,
  -//	 * e.g. for <code>hello</code> the tag <code>&lt;/hello&gt;</code>
  -//	 * will be returned.
  -//	 *
  -//	 * @param      tagName  the name of the tag.
  -//	 *
  -//	 * @return     an end tag for the given <code>tagName</code>.
  -//	 */
  -//	public static String getEndTag(String tagName) {
  -//		return "</" + tagName + ">";
  -//	}
  -//
  -//	/**
  -//	 * Returns an empty tag for the given <code>tagName</code>,
  -//	 * e.g. for <code>hello</code> the tag <code>&lt;hello/&gt;</code>
  -//	 * will be returned.
  -//	 *
  -//	 * @param      tagName  the name of the tag.
  -//	 *
  -//	 * @return     an empty tag for the given <code>tagName</code>.
  -//	 */
  -//	public static String getEmptyTag(String tagName) {
  -//		return "<" + tagName + "/>";
  -//	}
  -	
  -	/**
  -	 * Indicates if the given <code>uri</code> locates a <code>VHR</code>.
  -	 *
  -	 * @param      requestURI  the URI to check.
  -	 *
  -	 * @return     <code>true</code> if the given <code>uri</code> locates a
  -	 *             <code>VHR</code>.
  -	 */
  -	public static boolean isHistoryURI(String requestURI) {
  -		
  -		boolean isHistory = false;
  -		if (requestURI != null) {
  -			
  -			StringTokenizer tokenizer = new StringTokenizer(requestURI, "/");
  -			try {
  -				String token = tokenizer.nextToken();
  -				if (token.equals(HISTORY_PATH)) {
  -					tokenizer.nextToken();
  -					isHistory = ! tokenizer.hasMoreTokens();
  -				}
  -			}
  -			catch (NoSuchElementException e) {
  -			}
  -		}
  -		
  -		return isHistory;
  -	}
  -	
  -	
  -	/**
  -	 * Indicates if the given <code>uri</code> locates a <code>VR</code>.
  -	 *
  -	 * @param      requestURI  the URI to check.
  -	 *
  -	 * @return     <code>true</code> if the given <code>uri</code> locates a
  -	 *             <code>VR</code>.
  -	 */
  -	public static boolean isRevisionURI(String requestURI) {
  -		
  -		return (getRevisionNumber(requestURI) != null);
  -	}
  -	
  -	
  -	/**
  -	 * If the given <code>uri</code> is the URI of a <code>VHR</code> or a
  -	 * <code>VR</code>, this method returns the URI used to locate the
  -	 * <code>VHR</code>, otherwise <code>null</code>.
  -	 *
  -	 * @param      requestURI  the request URI.
  -	 *
  -	 * @return     the URI used to locate the <code>VHR</code>.
  -	 */
  -	public static String getHistoryURI(String requestURI) {
  -		
  -		String historyURI = null;
  -		
  -		if (requestURI != null) {
  -			StringTokenizer tokenizer = new StringTokenizer(requestURI, "/");
  -			try {
  -				String token = tokenizer.nextToken();
  -				if (token.equals(HISTORY_PATH)) {
  -					historyURI = tokenizer.nextToken();
  -				}
  -			}
  -			catch (NoSuchElementException e) {
  -			}
  -		}
  -		return historyURI;
  -	}
  -	
  -	/**
  -	 * If the given <code>uri</code> is the URI of a <code>VR</code>, this
  -	 * method returns the revision number, otherwise <code>null</code>.
  -	 *
  -	 * @param      requestURI  the request URI.
  -	 *
  -	 * @return     the revision number of the <code>VR</code>.
  -	 */
  -	public static NodeRevisionNumber getRevisionNumber(String requestURI) {
  -		
  -		NodeRevisionNumber revisionNumber = null;
  -		
  -		if (requestURI != null) {
  -			StringTokenizer tokenizer = new StringTokenizer(requestURI, "/");
  -			try {
  -				String token = tokenizer.nextToken();
  -				if (token.equals(HISTORY_PATH)) {
  -					tokenizer.nextToken();
  -					String revisionString = tokenizer.nextToken();
  -					revisionNumber = new NodeRevisionNumber(revisionString);
  -				}
  -			}
  -			catch (NoSuchElementException e) {
  -			}
  -			catch (NumberFormatException e) {
  -			}
  -		}
  -		return revisionNumber;
  -	}
  -	
  -	
  -	/**
  -	 * If the given <code>exception</code> is a WebdavException, the appropriate
  -	 * status text will be returned. otherwise <code>null</code>.
  -	 *
  -	 * @param      exception  the Exception for which to return the status text.
  -	 *
  -	 * @return     the appropriate status text.
  -	 */
  -	protected String getStatusText(Exception exception) {
  -		
  -		String status = null;
  -		if (exception instanceof WebdavException) {
  -			WebdavStatus.getStatusText(((WebdavException)exception).getStatusCode());
  -		}
  -		
  -		return status;
  -	}
  +        
  +        retrieveResourcePath();
  +        retrieveDepth();
  +        
  +        if ( ! getRequest().getContentType().startsWith(TEXT_XML) ){
  +            return;
  +        }
  +        
  +        try{
  +            retrieveRequestContent();
  +            
  +            Element element = getRequestContent().getRootElement();
  +            if (element == null) {
  +                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            }
  +            
  +            if (element.getName().equalsIgnoreCase(VERSION_TREE)){
  +                parseVersionTreeRequest(element);
  +            }
  +            else if (element.getName().equalsIgnoreCase(EXPAND_PROPERTY)){
  +                // TODO
  +                // expand-property report
  +            }
  +            else if (element.getName().equalsIgnoreCase(LOCATE_BY_HISTORY)){
  +                // TODO
  +                // locate-by-history report
  +            }
  +            else{
  +                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            }
  +        }
  +        catch (IOException  e){
  +            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +        }
  +        catch (SAXException  e){
  +            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +        }
  +        catch (ParserConfigurationException  e){
  +            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +        }
  +    }
  +    
  +    /**
  +     * Parses the <code>&lt;version-tree&gt;</code> request.
  +     *
  +     * @param      versionTreeElement  the <code>&lt;version-tree&gt;</code>
  +     *                                 Element.
  +     *
  +     * @throws     WebdavException if parsing fails for any reason.
  +     */
  +    protected void parseVersionTreeRequest(Element versionTreeElement) throws WebdavException {
  +        
  +        List childrenList = versionTreeElement.getChildren();
  +        if (childrenList.size() == 0) {
  +            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +        }
  +        
  +        Element element = (Element)childrenList.get(0);
  +        
  +        if ( ALLPROP.equals(element.getName()) || PROP.equals(element.getName()) ) {
  +            requestedProperties = new RequestedPropertiesImpl(element);
  +        }
  +        else {
  +            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +        }
  +    }
  +    
  +    /**
  +     * Executes the servlet request.
  +     *
  +     * @throws     IOException      if any I/O problems occur during execution.
  +     * @throws     WebdavException  if processing the request fails.
  +     */
  +    protected void executeRequest() throws IOException, WebdavException {
  +        
  +        // content type must be set BEFORE calling getWriter()
  +        getResponse().setContentType(TEXT_XML + "; charset=" + ENCODING);
  +        
  +        Element multistatusElement = new Element(MULTISTATUS, Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        
  +        getResponse().setStatus(WebdavStatus.SC_MULTI_STATUS);
  +        
  +        try {
  +            
  +            executeVersionTreeReport(requestUri, multistatusElement);
  +            
  +            new XMLOutputter().output(multistatusElement, getResponse().getWriter());
  +        }
  +        catch (Exception e) {
  +            e.printStackTrace();
  +//          writeErrorResponse(generatedXML, e);
  +//          generatedXML.writeElement(DAV_NS, null, MULTISTATUS, XMLPrinter.CLOSING);
  +//          generatedXML.sendData();
  +            
  +            String statusText = getStatusText(e);
  +            if (statusText != null) {
  +                resp.sendError(getErrorCode(e), statusText);
  +            }
  +            else {
  +                resp.sendError(getErrorCode(e));
  +            }
  +        }
  +    }
  +    
  +    /**
  +     * Executes a requested <code>version-tree</code> report.
  +     *
  +     * @param      requestUri     the URI of the requested resource.
  +     * @param      parentElement  the parent Element to append the
  +     *                            &lt;response&gt;</code> to.
  +     *
  +     * @throws     WebdavException
  +     * @throws     ObjectLockedException
  +     * @throws     RevisionDescriptorNotFoundException
  +     * @throws     ServiceAccessException
  +     * @throws     LinkedObjectNotFoundException
  +     * @throws     AccessDeniedException
  +     * @throws     ObjectNotFoundException
  +     * @throws     JDOMException
  +     */
  +    protected void executeVersionTreeReport(String requestUri, Element parentElement) throws WebdavException, ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, JDOMException {
  +        
  +        NodeRevisionDescriptors revisionDescriptors = null;
  +        NodeRevisionDescriptor revisionDescriptor = null;
  +        NodeRevisionNumber revisionNumber = null;
  +        String slideUri = null;
  +        boolean isHistory = false;
  +        
  +        if (isHistoryURI(requestUri)) {
  +            revisionDescriptors = content.retrieve(slideToken, requestUri);
  +            revisionNumber = new NodeRevisionNumber(0, 0);
  +            slideUri = requestUri;
  +            isHistory = true;
  +        }
  +        else if (isRevisionURI(requestUri)) {
  +            String revisionUri = getHistoryURI(requestUri);
  +            revisionDescriptors = content.retrieve(slideToken, revisionUri);
  +            revisionNumber = getRevisionNumber(requestUri);
  +            slideUri = revisionUri;
  +        }
  +        else {
  +            revisionDescriptors = content.retrieve(slideToken, getResourcePath());
  +            revisionNumber = revisionDescriptors.getLatestRevision();
  +            slideUri = getResourcePath();
  +            
  +            // check if this is a VCR
  +            revisionDescriptor = content.retrieve(slideToken,
  +                                                  revisionDescriptors,
  +                                                  revisionNumber);
  +            NodeProperty lastCheckedInRevisionProperty = revisionDescriptor.getProperty(P_CHECKED_IN);
  +            if (lastCheckedInRevisionProperty == null) {
  +                lastCheckedInRevisionProperty = revisionDescriptor.getProperty(P_CHECKED_OUT);
  +            }
  +            if (lastCheckedInRevisionProperty != null) {
  +                String revisionUri = getHistoryURI((String)lastCheckedInRevisionProperty.getValue());
  +                revisionDescriptors = content.retrieve(slideToken, revisionUri);
  +                revisionNumber = getRevisionNumber((String)lastCheckedInRevisionProperty.getValue());
  +                slideUri = revisionUri;
  +            }
  +        }
  +        
  +        
  +        revisionDescriptor = content.retrieve(slideToken,
  +                                              revisionDescriptors,
  +                                              revisionNumber);
  +        NodeProperty supportedReportSetProperty =
  +            revisionDescriptor.getProperty(P_SUPPORTED_REPORT_SET);
  +        if ( (supportedReportSetProperty == null) ||
  +                (supportedReportSetProperty.toString().indexOf(R_VERSION_TREE) < 0) ) {
  +            // TODO:
  +            // version tree report not supported
  +        }
  +        
  +        try {
  +            if (revisionDescriptors.isVersioned()){
  +                writeVersionTreeReport(slideUri, revisionDescriptors, revisionNumber, slideToken, requestUri, parentElement);
  +            }
  +            else {
  +                writeVersionTreeReport(requestUri, parentElement);
  +            }
  +        }
  +        catch (SlideException e) {
  +            throw new WebdavException(getErrorCode(e));
  +        }
  +    }
  +    
  +    
  +    
  +    /**
  +     * Write the <code>version-tree</code> report of the unversioned resource
  +     * specified by the <code>revisionDescriptor</code>
  +     *
  +     * @param      slideUri
  +     * @param      revisionDescriptors
  +     * @param      revisionNumber
  +     * @param      slideToken
  +     * @param      requestUri
  +     * @param      parentElement  the parent Element to append the
  +     *                            &lt;response&gt;</code> to.
  +     *
  +     * @throws     ObjectLockedException
  +     * @throws     ServiceAccessException
  +     * @throws     LinkedObjectNotFoundException
  +     * @throws     AccessDeniedException
  +     * @throws     ObjectNotFoundException
  +     * @throws     RevisionDescriptorNotFoundException
  +     * @throws     LockTokenNotFoundException
  +     * @throws     JDOMException
  +     */
  +    private void writeVersionTreeReport(String slideUri, NodeRevisionDescriptors revisionDescriptors, NodeRevisionNumber revisionNumber, SlideToken slideToken, String requestUri, Element parentElement)  throws ObjectLockedException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, RevisionDescriptorNotFoundException, LockTokenNotFoundException, JDOMException  {
  +        
  +        System.out.println("Versioned");
  +        
  +        int statusCode = WebdavStatus.SC_OK;
  +        
  +        Element response = new Element(RESPONSE,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        parentElement.addContent(response);
  +        
  +        Element href = new Element(HREF,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        href.setText(HTTP_PROTOCOL + req.getServerName()+ ":" + req.getServerPort() + req.getContextPath() + requestUri);
  +        response.addContent(href);
  +        
  +        PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
  +        
  +        if (revisionNumber.equals(new NodeRevisionNumber(0, 0))) {
  +            // this is a history
  +            response.addContent(retriever.getPropertiesOfObject(getRequestedProperties(), slideUri, revisionNumber, req.getContextPath(), true));
  +        }
  +        else {
  +            // this is a versioned resource
  +            Enumeration revisionNumberEnum = revisionDescriptors.getSuccessors(revisionDescriptors.getInitialRevision());
  +            while (revisionNumberEnum.hasMoreElements()) {
  +                response.addContent(retriever.getPropertiesOfObject(getRequestedProperties(), slideUri, (NodeRevisionNumber)revisionNumberEnum.nextElement(), req.getContextPath(), true));
  +            }
  +        }
  +    }
  +    
  +    
  +    /**
  +     * Write the <code>version-tree</code> report of the unversioned resource
  +     * specified by the <code>revisionDescriptor</code>
  +     *
  +     * @param      requestUri    the URI of the requested resource.
  +     * @param      parentElement  the parent Element to append the
  +     *                            &lt;response&gt;</code> to.
  +     *
  +     * @throws     ObjectLockedException
  +     * @throws     ServiceAccessException
  +     * @throws     LinkedObjectNotFoundException
  +     * @throws     AccessDeniedException
  +     * @throws     ObjectNotFoundException
  +     * @throws     RevisionDescriptorNotFoundException
  +     * @throws     LockTokenNotFoundException
  +     * @throws     JDOMException
  +     */
  +    private void writeVersionTreeReport(String requestUri, Element parentElement)  throws ObjectLockedException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, RevisionDescriptorNotFoundException, LockTokenNotFoundException, JDOMException  {
  +        
  +        int statusCode = WebdavStatus.SC_OK;
  +        
  +        Element response = new Element(RESPONSE,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        parentElement.addContent(response);
  +        
  +        Element href = new Element(HREF,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        href.setText(HTTP_PROTOCOL + req.getServerName()+ ":" + req.getServerPort() + req.getContextPath() + requestUri);
  +        response.addContent(href);
  +        
  +        PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
  +        response.addContent(retriever.getPropertiesOfObject(getRequestedProperties(), requestUri, req.getContextPath(), true));
  +    }
  +    
  +    
  +    /**
  +     * Writes the appropriate <code>&lt;response&gt;</code> due to the given
  +     * <code>exception</code> to the <code>generatedXML</code>
  +     *
  +     * @param      parentElement  the parent Element to append the
  +     *                            &lt;response&gt;</code> to.
  +     * @param      exception   the exception that caused the error.
  +     */
  +    private void writeErrorResponse(Element parentElement, Exception exception) {
  +        
  +        Element response = new Element(RESPONSE,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        parentElement.addContent(response);
  +        
  +        Element href = new Element(HREF,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        href.setText(HTTP_PROTOCOL +
  +                         getRequest().getServerName()+ ":" +
  +                         getRequest().getServerPort() +
  +                         getRequest().getContextPath() +
  +                         requestUri);
  +        response.addContent(href);
  +        
  +        Element propStat = new Element(PROPSTAT,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        response.addContent(propStat);
  +        
  +        Element status = new Element(STATUS,  Namespace.getNamespace(DAV_NS, DAV_NS_INFO));
  +        int iErrorCode = getErrorCode(exception);
  +        status.setText(HTTP_VERSION + " " + iErrorCode  + " " + WebdavStatus.getStatusText(iErrorCode));
  +        propStat.addContent(status);
  +    }
  +    
  +    
  +    /**
  +     * Returns the list of requested properties.
  +     *
  +     * @return     the list of requested properties.
  +     */
  +    protected RequestedProperties getRequestedProperties() {
  +        if (requestedProperties == null) {
  +            requestedProperties = new RequestedPropertiesImpl();
  +        }
  +        return requestedProperties;
  +    }
  +    
  +    /**
  +     * Returns the path of the target resource.
  +     *
  +     * @return     the path of the target resource.
  +     */
  +    protected String getResourcePath() {
  +        return resourcePath;
  +    }
  +    
  +    /**
  +     * Retrieves the path of the target resource.
  +     */
  +    protected void retrieveResourcePath() {
  +        resourcePath = requestUri;
  +        if (resourcePath == null) {
  +            resourcePath = "/";
  +        }
  +    }
  +    
  +    /**
  +     * Returns the request content (XML) Document.
  +     *
  +     * @return     the request content (XML) Document.
  +     */
  +    protected Document getRequestContent() {
  +        return requestContentDocument;
  +    }
  +    
  +    /**
  +     * Retrieves the request content (XML) Document.
  +     */
  +    protected void retrieveRequestContent() throws ParserConfigurationException, IOException, SAXException{
  +        requestContentDocument = new DOMBuilder().build(parseRequestContent());
  +    }
  +    
  +    /**
  +     * Returns the value of the <code>Depth</code> request header.
  +     *
  +     * @return     the value of the <code>Depth</code> request header.
  +     */
  +    protected int getDepth() {
  +        return depth;
  +    }
  +    
  +    
  +    /**
  +     * Retrieves the value of the <code>Depth</code> header.
  +     */
  +    protected void retrieveDepth() {
  +        
  +        depth = Integer.MAX_VALUE;
  +        try {
  +            depth = req.getIntHeader("Depth");
  +        }
  +        catch (java.lang.NumberFormatException nfEx){
  +        }
  +    }
  +    
  +    /**
  +     * Returns the servlet request.
  +     *
  +     * @return     the servlet request.
  +     */
  +    public HttpServletRequest getRequest() {
  +        return req;
  +    }
  +    
  +    
  +    /**
  +     * Returns the servlet response.
  +     *
  +     * @return     the servlet response.
  +     */
  +    public HttpServletResponse getResponse() {
  +        return resp;
  +    }
  +    
  +    
  +    /**
  +     * Returns the NamespaceAccessToken.
  +     *
  +     * @return     the NamespaceAccessToken.
  +     */
  +    public NamespaceAccessToken getNamespaceAccessToken() {
  +        return token;
  +    }
  +    
  +    
  +//
  +//  /**
  +//   * Returns the first child node of the given <code>element</code>
  +//   * that is an Element. If none was found, <code>null</code> is returned.
  +//   *
  +//   * @param      element  the Element for which to return the first child
  +//   *                      Element.
  +//   *
  +//   * @return     the first child node of the given <code>element</code>
  +//   *             that is an Element.
  +//   */
  +//  public static Element getFirstChildElement(Element element) {
  +//
  +//      Element child = null;
  +//      List childElementList = getChildElementList(element);
  +//      if (childElementList.size() > 0) {
  +//          child = (Element)childElementList.get(0);
  +//      }
  +//      return child;
  +//  }
  +//
  +//  /**
  +//   * Returns a List containing all child Elements of the given
  +//   * <code>element</code>.
  +//   *
  +//   * @param      element  the Element for which to return the List of child
  +//   *                      Elements.
  +//   *
  +//   * @return     a List containing all child Elements of the given
  +//   *             <code>element</code>.
  +//   */
  +//  public static List getChildElementList(Element element) {
  +//
  +//      List childElementList = new ArrayList();
  +//      if (element != null) {
  +//          NodeList nodeList = element.getChildNodes();
  +//          for (int i=0; i<nodeList.getLength(); i++) {
  +//              if (nodeList.item(i).getNodeType() == Node.ELEMENT_NODE) {
  +//                  childElementList.add(nodeList.item(i));
  +//              }
  +//          }
  +//      }
  +//      return childElementList;
  +//  }
  +//
  +//
  +//  /**
  +//   * Returns the first child node of the given <code>element</code>
  +//   * that is an Element. If none was found, <code>null</code> is returned.
  +//   *
  +//   * @param      element  the Element for which to return the first child
  +//   *                      Element.
  +//   *
  +//   * @return     the first child node of the given <code>element</code>
  +//   *             that is an Element.
  +//   */
  +//  public static Element getNextSiblingElement(Element element) {
  +//
  +//      Element sibling = null;
  +//      if (element != null) {
  +//          Node nextSibling = element.getNextSibling();
  +//          while ( (sibling == null) && (nextSibling != null) ) {
  +//              if (nextSibling.getNodeType() == Node.ELEMENT_NODE) {
  +//                  sibling = (Element)nextSibling;
  +//              }
  +//              nextSibling = nextSibling.getNextSibling();
  +//          }
  +//      }
  +//      return sibling;
  +//  }
  +//
  +//  /**
  +//   * Returns the <code>node</code>'s name. If a namespace prefix is set this
  +//   * is the local name, otherwise the full name.
  +//   *
  +//   * @param      node  the Node for which to return the name.
  +//   *
  +//   * @return     the <code>node</code>'s name.
  +//   */
  +//  public static String getNodeName(Node node) {
  +//
  +//      String nodeName = null;
  +//      if (node != null) {
  +//          if (node.getLocalName() != null) {
  +//              nodeName = node.getLocalName();
  +//          }
  +//          else {
  +//              nodeName = node.getNodeName();
  +//          }
  +//      }
  +//      return nodeName;
  +//  }
  +//
  +//  /**
  +//   * Returns a start tag for the given <code>tagName</code>,
  +//   * e.g. for <code>hello</code> the tag <code>&lt;hello&gt;</code>
  +//   * will be returned.
  +//   *
  +//   * @param      tagName  the name of the tag.
  +//   *
  +//   * @return     a start tag for the given <code>tagName</code>.
  +//   */
  +//  public static String getStartTag(String tagName) {
  +//      return "<" + tagName + ">";
  +//  }
  +//
  +//  /**
  +//   * Returns an end tag for the given <code>tagName</code>,
  +//   * e.g. for <code>hello</code> the tag <code>&lt;/hello&gt;</code>
  +//   * will be returned.
  +//   *
  +//   * @param      tagName  the name of the tag.
  +//   *
  +//   * @return     an end tag for the given <code>tagName</code>.
  +//   */
  +//  public static String getEndTag(String tagName) {
  +//      return "</" + tagName + ">";
  +//  }
  +//
  +//  /**
  +//   * Returns an empty tag for the given <code>tagName</code>,
  +//   * e.g. for <code>hello</code> the tag <code>&lt;hello/&gt;</code>
  +//   * will be returned.
  +//   *
  +//   * @param      tagName  the name of the tag.
  +//   *
  +//   * @return     an empty tag for the given <code>tagName</code>.
  +//   */
  +//  public static String getEmptyTag(String tagName) {
  +//      return "<" + tagName + "/>";
  +//  }
  +    
  +    /**
  +     * Indicates if the given <code>uri</code> locates a <code>VHR</code>.
  +     *
  +     * @param      requestURI  the URI to check.
  +     *
  +     * @return     <code>true</code> if the given <code>uri</code> locates a
  +     *             <code>VHR</code>.
  +     */
  +    public static boolean isHistoryURI(String requestURI) {
  +        
  +        boolean isHistory = false;
  +        if (requestURI != null) {
  +            
  +            StringTokenizer tokenizer = new StringTokenizer(requestURI, "/");
  +            try {
  +                String token = tokenizer.nextToken();
  +                if (token.equals(HISTORY_PATH)) {
  +                    tokenizer.nextToken();
  +                    isHistory = ! tokenizer.hasMoreTokens();
  +                }
  +            }
  +            catch (NoSuchElementException e) {
  +            }
  +        }
  +        
  +        return isHistory;
  +    }
  +    
  +    
  +    /**
  +     * Indicates if the given <code>uri</code> locates a <code>VR</code>.
  +     *
  +     * @param      requestURI  the URI to check.
  +     *
  +     * @return     <code>true</code> if the given <code>uri</code> locates a
  +     *             <code>VR</code>.
  +     */
  +    public static boolean isRevisionURI(String requestURI) {
  +        
  +        return (getRevisionNumber(requestURI) != null);
  +    }
  +    
  +    
  +    /**
  +     * If the given <code>uri</code> is the URI of a <code>VHR</code> or a
  +     * <code>VR</code>, this method returns the URI used to locate the
  +     * <code>VHR</code>, otherwise <code>null</code>.
  +     *
  +     * @param      requestURI  the request URI.
  +     *
  +     * @return     the URI used to locate the <code>VHR</code>.
  +     */
  +    public static String getHistoryURI(String requestURI) {
  +        
  +        String historyURI = null;
  +        
  +        if (requestURI != null) {
  +            StringTokenizer tokenizer = new StringTokenizer(requestURI, "/");
  +            try {
  +                String token = tokenizer.nextToken();
  +                if (token.equals(HISTORY_PATH)) {
  +                    historyURI = tokenizer.nextToken();
  +                }
  +            }
  +            catch (NoSuchElementException e) {
  +            }
  +        }
  +        return historyURI;
  +    }
  +    
  +    /**
  +     * If the given <code>uri</code> is the URI of a <code>VR</code>, this
  +     * method returns the revision number, otherwise <code>null</code>.
  +     *
  +     * @param      requestURI  the request URI.
  +     *
  +     * @return     the revision number of the <code>VR</code>.
  +     */
  +    public static NodeRevisionNumber getRevisionNumber(String requestURI) {
  +        
  +        NodeRevisionNumber revisionNumber = null;
  +        
  +        if (requestURI != null) {
  +            StringTokenizer tokenizer = new StringTokenizer(requestURI, "/");
  +            try {
  +                String token = tokenizer.nextToken();
  +                if (token.equals(HISTORY_PATH)) {
  +                    tokenizer.nextToken();
  +                    String revisionString = tokenizer.nextToken();
  +                    revisionNumber = new NodeRevisionNumber(revisionString);
  +                }
  +            }
  +            catch (NoSuchElementException e) {
  +            }
  +            catch (NumberFormatException e) {
  +            }
  +        }
  +        return revisionNumber;
  +    }
  +    
  +    
  +    /**
  +     * If the given <code>exception</code> is a WebdavException, the appropriate
  +     * status text will be returned. otherwise <code>null</code>.
  +     *
  +     * @param      exception  the Exception for which to return the status text.
  +     *
  +     * @return     the appropriate status text.
  +     */
  +    protected String getStatusText(Exception exception) {
  +        
  +        String status = null;
  +        if (exception instanceof WebdavException) {
  +            WebdavStatus.getStatusText(((WebdavException)exception).getStatusCode());
  +        }
  +        
  +        return status;
  +    }
   }
   
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>