juergen 02/05/07 00:33:39
Modified: src/webdav/server/org/apache/slide/webdav/method
PropFindMethod.java
Log:
Fixed implementation of Label header feature:
Apply redriction of URI to all resources (if the Depth header is >0).
(ralf)
Revision Changes Path
1.67 +38 -28
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java
Index: PropFindMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- PropFindMethod.java 2 May 2002 12:35:18 -0000 1.66
+++ PropFindMethod.java 7 May 2002 07:33:39 -0000 1.67
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java,v
1.66 2002/05/02 12:35:18 pnever Exp $
- * $Revision: 1.66 $
- * $Date: 2002/05/02 12:35:18 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java,v
1.67 2002/05/07 07:33:39 juergen Exp $
+ * $Revision: 1.67 $
+ * $Date: 2002/05/07 07:33:39 $
*
* ====================================================================
*
@@ -182,6 +182,11 @@
*/
protected VersioningHelper versioningHelper = null;
+ /**
+ * The value of the <code>Label</code> header.
+ */
+ protected String labelHeader = null;
+
// ----------------------------------------------------------- Constructors
@@ -223,27 +228,7 @@
resourcePath = "/";
}
- // evaluate "Label" header
- if (Configuration.useVersionControl()) {
- try {
- resourcePath = versioningHelper.getLabeledResourceUri(resourcePath,
-
req.getHeader(DeltavConstants.H_LABEL));
- }
- catch (LabeledRevisionNotFoundException e) {
- ViolatedPrecondition violatedPrecondition =
- new
ViolatedPrecondition(DeltavConstants.C_MUST_SELECT_VERSION_IN_HISTORY,
- WebdavStatus.SC_CONFLICT);
- sendPreconditionViolation(new
PreconditionViolationException(violatedPrecondition,
-
resourcePath));
- throw new WebdavException(getErrorCode((Exception)e));
- }
- catch( RevisionDescriptorNotFoundException x ) {
- }
- catch (SlideException e) {
- resp.sendError(getErrorCode((Exception)e));
- throw new WebdavException(getErrorCode((Exception)e));
- }
- }
+ labelHeader = req.getHeader(DeltavConstants.H_LABEL);
retrieveDepth();
@@ -375,7 +360,7 @@
if (resource != null) {
if (depth == 0) {
- multistatusElement.addContent(getPropertiesOfObject(resource));
+
multistatusElement.addContent(getPropertiesOfObject(resource.getUri()));
} else {
// The stack always contains the object of the current level
Stack stack = new Stack();
@@ -387,7 +372,7 @@
while ((!stack.isEmpty()) && (depth >= 0)) {
ObjectNode cur = (ObjectNode) stack.pop();
- multistatusElement.addContent(getPropertiesOfObject(cur));
+
multistatusElement.addContent(getPropertiesOfObject(cur.getUri()));
if (depth > 0) {
@@ -423,14 +408,39 @@
/**
* Return the properties of an object as a <code><response></code>.
*
- * @param object
+ * @param resourceUri the slide URI of the resource.
*
* @return the <code><response></code> Element.
*
* @exception WebdavException
*/
- protected Element getPropertiesOfObject(ObjectNode object)
+ protected Element getPropertiesOfObject(String resourceUri)
throws WebdavException {
+
+ // evaluate "Label" header
+ if (Configuration.useVersionControl()) {
+ try {
+ resourceUri = versioningHelper.getLabeledResourceUri(resourceUri,
labelHeader);
+ }
+ catch (LabeledRevisionNotFoundException e) {
+ return getErrorResponse(resourceUri,
+ WebdavStatus.SC_CONFLICT,
+
DeltavConstants.C_MUST_SELECT_VERSION_IN_HISTORY);
+ }
+ catch( RevisionDescriptorNotFoundException x ) {
+ }
+ catch (SlideException e) {
+ return getErrorResponse(resourceUri, getErrorCode(e), null);
+ }
+ }
+
+ ObjectNode object = null;
+ try {
+ object = structure.retrieve(slideToken, resourceUri);
+ }
+ catch (SlideException e) {
+ return getErrorResponse(resourceUri, getErrorCode(e), null);
+ }
Element responseElement = new Element(E_RESPONSE,
Namespace.getNamespace(DEFAULT_NAMESPACE));
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>