[prev in list] [next in list] [prev in thread] [next in thread]
List: slide-dev
Subject: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method AbstractMultistatusRespon
From: juergen () apache ! org
Date: 2001-08-31 12:31:16
[Download RAW message or body]
juergen 01/08/31 05:31:16
Modified: src/webdav/server/org/apache/slide/webdav/method
AbstractMultistatusResponseMethod.java
Log:
in case of a ServiceAccessException a 207 was created. Now the 207 decision depends \
on the nested exception, if available.
Revision Changes Path
1.10 +78 -18 \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java
Index: AbstractMultistatusResponseMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AbstractMultistatusResponseMethod.java 2001/08/17 14:39:12 1.9
+++ AbstractMultistatusResponseMethod.java 2001/08/31 12:31:16 1.10
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java,v \
1.9 2001/08/17 14:39:12 cmlenz Exp $
- * $Revision: 1.9 $
- * $Date: 2001/08/17 14:39:12 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java,v \
1.10 2001/08/31 12:31:16 juergen Exp $ + * $Revision: 1.10 $
+ * $Date: 2001/08/31 12:31:16 $
*
* ====================================================================
*
@@ -225,7 +225,7 @@
XMLPrinter errorMessage = new XMLPrinter();
errorMessage.writeXMLHeader();
- errorMessage.writeElement("d", NodeProperty.DEFAULT_NAMESPACE,
+ errorMessage.writeElement("d", NodeProperty.DEFAULT_NAMESPACE,
"multistatus", XMLPrinter.OPENING);
Enumeration nestedExceptionsList =
@@ -275,11 +275,44 @@
return true;
}
+
+
+ /**
+ * Checks if a 207 should be generated. A 207 is generated when the request \
URI is a + * collection and exactely one nested exception is present and the \
request URI and + * the nested exception URI are identical.
+ *
+ * @return boolean return true, if a 207 response code should be generated
+ */
+
+ protected boolean generate207Response(boolean isCollection, \
NestedSlideException causeException, String resourceURI) { + SlideException \
unpackedException = causeException.unpackSingleException(); + \
if(!(isCollection && unpackedException != null)) return false; + return \
!getURI(unpackedException).equals(resourceURI); + }
+ // -------------------------------------------------------- Private Methods
+
+ // -------------------------------------------------------- Private Methods
+
+
/**
+ * Get return status based on exception type.
+ */
+ protected String getErrorMessage(Exception ex) {
+ if ( !(ex instanceof SlideException) ) {
+ return "";
+ } else {
+ return getErrorMessage((SlideException)ex);
+ }
+ }
+
+
+
+ /**
* Get the return status message info on exception type.
*/
- protected String getErrorMessage(SlideException ex) {
+ private String getErrorMessage(SlideException ex) {
try {
throw ex;
} catch(ObjectNotFoundException e) {
@@ -293,7 +326,7 @@
} catch(ObjectAlreadyExistsException e) {
return e.getObjectUri();
} catch(ServiceAccessException e) {
- return e.getMessage();
+ return getErrorMessage((ServiceAccessException)e);
} catch(LinkedObjectNotFoundException e) {
return e.getTargetUri();
} catch(RevisionNotFoundException e) {
@@ -305,22 +338,32 @@
}
}
-
+
+
/**
- * Checks if a 207 should be generated. A 207 is generated when the request \
URI is a
- * collection and exactely one nested exception is present and the request URI \
and
- * the nested exception URI are identical.
- *
- * @return boolean return true, if a 207 response code should be generated
+ * Get return status based on exception type.
*/
-
- protected boolean generate207Response(boolean isCollection, \
NestedSlideException causeException, String resourceURI) {
- SlideException unpackedException = causeException.unpackSingleException();
- if(!(isCollection && unpackedException != null)) return false;
- return !getURI(unpackedException).equals(resourceURI);
+ private String getErrorMessage(ServiceAccessException ex) {
+ Exception cause = ex.getCauseException();
+ if (cause == null || !(cause instanceof SlideException) ) {
+ return ""; // this is the default}
+ } else {
+ return getErrorMessage((SlideException)cause);
+ }
}
+
+ /**
+ * Get return status based on exception type.
+ */
+ private String getURI(Exception ex) {
+ if ( !(ex instanceof SlideException) ) {
+ return "";
+ } else {
+ return getURI((SlideException)ex);
+ }
+ }
/**
@@ -340,7 +383,7 @@
} catch(ObjectAlreadyExistsException e) {
return e.getObjectUri();
} catch(ServiceAccessException e) {
- return "";
+ return getURI((ServiceAccessException)ex);
} catch(LinkedObjectNotFoundException e) {
return e.getTargetUri();
} catch(RevisionNotFoundException e) {
@@ -351,6 +394,23 @@
return "";
}
}
+
+
+
+ /**
+ * Get return status based on exception type.
+ */
+ private String getURI(ServiceAccessException ex) {
+ Exception cause = ex.getCauseException();
+ if (cause == null || !(cause instanceof SlideException) ) {
+ return ""; // this is the default}
+ } else {
+ return getURI((SlideException)cause);
+ }
+ }
+
+
+
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic