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 2001/07/20 15:00:30 UTC
cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method UnlockMethod.java PutMethod.java PropPatchMethod.java GetMethod.java AclMethod.java
juergen 01/07/20 06:00:30
Modified: src/webdav/server/org/apache/slide/webdav/method
UnlockMethod.java PutMethod.java
PropPatchMethod.java GetMethod.java AclMethod.java
Log:
removed the cause println. the cause is printed in a warning. The ACL method possibly needs to be merged.
Revision Changes Path
1.10 +3 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java
Index: UnlockMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- UnlockMethod.java 2001/07/19 11:10:59 1.9
+++ UnlockMethod.java 2001/07/20 13:00:30 1.10
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java,v 1.9 2001/07/19 11:10:59 juergen Exp $
- * $Revision: 1.9 $
- * $Date: 2001/07/19 11:10:59 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java,v 1.10 2001/07/20 13:00:30 juergen Exp $
+ * $Revision: 1.10 $
+ * $Date: 2001/07/20 13:00:30 $
*
* ====================================================================
*
@@ -217,7 +217,6 @@
throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
} catch (ServiceAccessException e) {
// 500 - Internal server error
- System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
} catch (SlideException e) {
1.13 +3 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java
Index: PutMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- PutMethod.java 2001/07/19 11:10:59 1.12
+++ PutMethod.java 2001/07/20 13:00:30 1.13
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v 1.12 2001/07/19 11:10:59 juergen Exp $
- * $Revision: 1.12 $
- * $Date: 2001/07/19 11:10:59 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v 1.13 2001/07/20 13:00:30 juergen Exp $
+ * $Revision: 1.13 $
+ * $Date: 2001/07/20 13:00:30 $
*
* ====================================================================
*
@@ -435,7 +435,6 @@
throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
} catch (ServiceAccessException e) {
// 500 - Internal server error
- System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
} catch (IOException e) {
1.14 +3 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java
Index: PropPatchMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- PropPatchMethod.java 2001/07/19 11:10:59 1.13
+++ PropPatchMethod.java 2001/07/20 13:00:30 1.14
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v 1.13 2001/07/19 11:10:59 juergen Exp $
- * $Revision: 1.13 $
- * $Date: 2001/07/19 11:10:59 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v 1.14 2001/07/20 13:00:30 juergen Exp $
+ * $Revision: 1.14 $
+ * $Date: 2001/07/20 13:00:30 $
*
* ====================================================================
*
@@ -348,7 +348,6 @@
throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
} catch (ServiceAccessException e) {
// 500 - Internal server error
- System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
} catch (RuntimeException e) {
1.12 +177 -178 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java
Index: GetMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- GetMethod.java 2001/07/12 12:13:21 1.11
+++ GetMethod.java 2001/07/20 13:00:30 1.12
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java,v 1.11 2001/07/12 12:13:21 juergen Exp $
- * $Revision: 1.11 $
- * $Date: 2001/07/12 12:13:21 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java,v 1.12 2001/07/20 13:00:30 juergen Exp $
+ * $Revision: 1.12 $
+ * $Date: 2001/07/20 13:00:30 $
*
* ====================================================================
*
@@ -99,8 +99,8 @@
*/
protected static final SimpleDateFormat formats[] = {
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
- new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
- new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
+ new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
+ new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
};
@@ -224,7 +224,7 @@
revisionDescriptor.getCreationDate().toString());
if ( ((ranges == null) || (ranges.isEmpty()))
- && (req.getHeader("Range") == null) ) {
+ && (req.getHeader("Range") == null) ) {
resp.setContentType
(revisionDescriptor.getContentType());
@@ -251,9 +251,9 @@
Range range = (Range) ranges.elementAt(0);
resp.addHeader("Content-Range", "bytes "
- + range.start
- + "-" + range.end + "/"
- + range.length);
+ + range.start
+ + "-" + range.end + "/"
+ + range.length);
resp.setContentLength((int) range.length);
resp.setContentType
(revisionDescriptor.getContentType());
@@ -267,7 +267,7 @@
resp.setContentType
("multipart/byteranges; boundary="
- + mimeSeparation);
+ + mimeSeparation);
if (printContent) {
resp.setBufferSize(output);
@@ -295,44 +295,43 @@
// 404 - Not found
System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_NOT_FOUND);
- } catch (RevisionContentNotFoundException e) {
+ } catch (RevisionContentNotFoundException e) {
// 404 - Not found
System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_NOT_FOUND);
- } catch (ObjectLockedException e) {
+ } catch (ObjectLockedException e) {
// Locked
System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_LOCKED);
- } catch (RevisionDescriptorNotFoundException e) {
+ } catch (RevisionDescriptorNotFoundException e) {
// 404 - Not found
System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_NOT_FOUND);
- } catch (ObjectNotFoundException e) {
+ } catch (ObjectNotFoundException e) {
// 404 - Not found
resp.setStatus(WebdavStatus.SC_NOT_FOUND);
- } catch (LinkedObjectNotFoundException e) {
+ } catch (LinkedObjectNotFoundException e) {
// 404 - Not found
System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_NOT_FOUND);
- } catch (AccessDeniedException e) {
+ } catch (AccessDeniedException e) {
// 403 - Forbidden
System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_FORBIDDEN);
- } catch (ServiceAccessException e) {
- // 500 - Internal server error
- System.out.println(e.getMessage());
+ } catch (ServiceAccessException e) {
+ // 500 - Internal server error
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
- throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
- } catch (IOException e) {
+ throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
+ } catch (IOException e) {
e.printStackTrace();
// Unable to write to output stream.
- // 500 - Internal server error
+ // 500 - Internal server error
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
} catch (RuntimeException e) {
e.printStackTrace();
- // 500 - Internal server error
+ // 500 - Internal server error
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
- }
+ }
}
@@ -365,17 +364,17 @@
writer.print("<title>");
writer.print
(Messages.format
- ("org.apache.slide.webdav.GetMethod.directorylistingfor", name));
+ ("org.apache.slide.webdav.GetMethod.directorylistingfor", name));
writer.print("</title>\r\n</head>\r\n");
writer.print("<body bgcolor=\"white\">\r\n");
writer.print("<table width=\"90%\" cellspacing=\"0\"" +
- " cellpadding=\"5\" align=\"center\">\r\n");
+ " cellpadding=\"5\" align=\"center\">\r\n");
// Render the in-page title
writer.print("<tr><td colspan=\"3\"><font size=\"+2\">\r\n<strong>");
writer.print
(Messages.format
- ("org.apache.slide.webdav.GetMethod.directorylistingfor", name));
+ ("org.apache.slide.webdav.GetMethod.directorylistingfor", name));
writer.print("</strong>\r\n</font></td></tr>\r\n");
// Render the link to our parent (if required)
@@ -395,7 +394,7 @@
writer.print(parent);
writer.print("\">");
writer.print(Messages.format
- ("org.apache.slide.webdav.GetMethod.parent", parent));
+ ("org.apache.slide.webdav.GetMethod.parent", parent));
writer.print("</a>\r\n");
writer.print("</td></tr>\r\n");
}
@@ -433,15 +432,15 @@
writer.print("<td align=\"left\" colspan=\"3\">");
writer.print("<font size=\"+1\"><strong>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.filename"));
+ ("org.apache.slide.webdav.GetMethod.filename"));
writer.print("</strong></font></td>\r\n");
writer.print("<td align=\"center\"><font size=\"+1\"><strong>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.size"));
+ ("org.apache.slide.webdav.GetMethod.size"));
writer.print("</strong></font></td>\r\n");
writer.print("<td align=\"right\"><font size=\"+1\"><strong>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.lastModified"));
+ ("org.apache.slide.webdav.GetMethod.lastModified"));
writer.print("</strong></font></td>\r\n");
writer.print("</tr>\r\n");
@@ -545,7 +544,7 @@
writer.print("<tr><td colspan=\"3\" bgcolor=\"#cccccc\">");
writer.print("<font size=\"-1\">");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.version"));
+ ("org.apache.slide.webdav.GetMethod.version"));
writer.print("</font></td>\r\n");
writer.print("<td colspan=\"2\" align=\"right\" bgcolor=\"#cccccc\">");
writer.print("<font size=\"-1\">");
@@ -584,7 +583,7 @@
writer.print(">\r\n");
writer.print("<td align=\"left\" colspan=\"5\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.aclinfo"));
+ ("org.apache.slide.webdav.GetMethod.aclinfo"));
writer.print("</b></tt></td>\r\n");
writer.print("</tr>\r\n");
@@ -598,37 +597,37 @@
writer.print("<td align=\"left\" colspan=\"2\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.subject"));
+ ("org.apache.slide.webdav.GetMethod.subject"));
writer.print("</b></tt></td>\r\n");
writer.print("<td align=\"left\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.action"));
+ ("org.apache.slide.webdav.GetMethod.action"));
writer.print("</b></tt></td>\r\n");
writer.print("<td align=\"right\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.inheritable"));
+ ("org.apache.slide.webdav.GetMethod.inheritable"));
writer.print("</b></tt></td>\r\n");
writer.print("<td align=\"right\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.deny"));
+ ("org.apache.slide.webdav.GetMethod.deny"));
writer.print("</b></tt></td>\r\n");
-/*
- writer.print("<td align=\"right\"><tt><b>");
- writer.print("<a href=\"");
- if (req.getContextPath() != null) {
- writer.print(req.getContextPath());
- }
- writer.print(managerServletPath + token.getName()
- + "?command=addacl\">");
- writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.add"));
- writer.print("</a>");
- writer.print("</b></tt></td>\r\n");
-*/
+ /*
+ writer.print("<td align=\"right\"><tt><b>");
+ writer.print("<a href=\"");
+ if (req.getContextPath() != null) {
+ writer.print(req.getContextPath());
+ }
+ writer.print(managerServletPath + token.getName()
+ + "?command=addacl\">");
+ writer.print(Messages.message
+ ("org.apache.slide.webdav.GetMethod.add"));
+ writer.print("</a>");
+ writer.print("</b></tt></td>\r\n");
+ */
writer.print("</tr>\r\n");
@@ -661,26 +660,26 @@
writer.print(currentPermission.isNegative());
writer.print("</tt></td>\r\n");
-/*
- writer.print("<td align=\"right\"><tt><b>");
- writer.print("<a href=\"");
- if (req.getContextPath() != null) {
- writer.print(req.getContextPath());
- }
- writer.print(managerServletPath + token.getName()
- + "?command=removeacl"
- + "&object=" + currentPermission.getObjectUri()
- + "&subject=" + currentPermission.getSubjectUri()
- + "&action=" + currentPermission.getActionUri()
- + "\">");
- writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.remove"));
- writer.print("</a>");
- writer.print("</b></tt></td>\r\n");
-*/
+ /*
+ writer.print("<td align=\"right\"><tt><b>");
+ writer.print("<a href=\"");
+ if (req.getContextPath() != null) {
+ writer.print(req.getContextPath());
+ }
+ writer.print(managerServletPath + token.getName()
+ + "?command=removeacl"
+ + "&object=" + currentPermission.getObjectUri()
+ + "&subject=" + currentPermission.getSubjectUri()
+ + "&action=" + currentPermission.getActionUri()
+ + "\">");
+ writer.print(Messages.message
+ ("org.apache.slide.webdav.GetMethod.remove"));
+ writer.print("</a>");
+ writer.print("</b></tt></td>\r\n");
+ */
writer.print("</tr>\r\n");
-
+
}
}
@@ -710,7 +709,7 @@
writer.print(">\r\n");
writer.print("<td align=\"left\" colspan=\"5\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.locksinfo"));
+ ("org.apache.slide.webdav.GetMethod.locksinfo"));
writer.print("</b></tt></td>\r\n");
writer.print("</tr>\r\n");
@@ -724,27 +723,27 @@
writer.print("<td align=\"left\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.subject"));
+ ("org.apache.slide.webdav.GetMethod.subject"));
writer.print("</b></tt></td>\r\n");
writer.print("<td align=\"left\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.type"));
+ ("org.apache.slide.webdav.GetMethod.type"));
writer.print("</b></tt></td>\r\n");
writer.print("<td align=\"right\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.expiration"));
+ ("org.apache.slide.webdav.GetMethod.expiration"));
writer.print("</b></tt></td>\r\n");
writer.print("<td align=\"right\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.inheritable"));
+ ("org.apache.slide.webdav.GetMethod.inheritable"));
writer.print("</b></tt></td>\r\n");
writer.print("<td align=\"right\"><tt><b>");
writer.print(Messages.message
- ("org.apache.slide.webdav.GetMethod.exclusive"));
+ ("org.apache.slide.webdav.GetMethod.exclusive"));
writer.print("</b></tt></td>\r\n");
writer.print("</tr>\r\n");
@@ -821,8 +820,8 @@
* request processing is stopped
*/
private boolean checkIfHeaders(HttpServletRequest request,
- HttpServletResponse response,
- ResourceInfo resourceInfo)
+ HttpServletResponse response,
+ ResourceInfo resourceInfo)
throws IOException {
String eTag = getETag(resourceInfo, true);
@@ -911,7 +910,7 @@
// For every other method, 412 Precondition Failed is sent
// back.
if ( ("GET".equals(request.getMethod()))
- || ("HEAD".equals(request.getMethod())) ) {
+ || ("HEAD".equals(request.getMethod())) ) {
response.sendError
(HttpServletResponse.SC_NOT_MODIFIED);
return false;
@@ -956,8 +955,8 @@
return true;
}
-
-
+
+
/**
* Get the ETag value associated with a file.
*
@@ -970,8 +969,8 @@
// of the file contents
return resourceInfo.length + "-" + resourceInfo.date;
}
-
-
+
+
/**
* Get the ETag associated with a file.
*
@@ -985,8 +984,8 @@
else
return "W/\"" + getETagValue(resourceInfo, strong) + "\"";
}
-
-
+
+
/**
* Copy the contents of the specified input stream to the specified
* output stream, and ensure that both streams are closed before returning
@@ -1000,10 +999,10 @@
private void copy(ResourceInfo resourceInfo,
InputStream resourceInputStream,
ServletOutputStream ostream)
- throws IOException {
-
+ throws IOException {
+
IOException exception = null;
-
+
InputStream istream = new BufferedInputStream
(resourceInputStream, input);
@@ -1017,24 +1016,24 @@
;
}
- try {
- ostream.flush();
- } catch (Throwable t) {
- ;
- }
- try {
- ostream.close();
- } catch (Throwable t) {
- ;
- }
-
- // Rethrow any exception that has occurred
- if (exception != null)
- throw exception;
-
+ try {
+ ostream.flush();
+ } catch (Throwable t) {
+ ;
+ }
+ try {
+ ostream.close();
+ } catch (Throwable t) {
+ ;
+ }
+
+ // Rethrow any exception that has occurred
+ if (exception != null)
+ throw exception;
+
}
-
-
+
+
/**
* Copy the contents of the specified input stream to the specified
* output stream, and ensure that both streams are closed before returning
@@ -1049,7 +1048,7 @@
InputStream resourceInputStream,
ServletOutputStream ostream,
Range range)
- throws IOException {
+ throws IOException {
IOException exception = null;
@@ -1057,30 +1056,30 @@
new BufferedInputStream(resourceInputStream, input);
exception = copyRange(istream, ostream, range.start, range.end);
- // Clean up the input and output streams
- try {
- istream.close();
- } catch (Throwable t) {
- ;
- }
- try {
- ostream.flush();
- } catch (Throwable t) {
- ;
- }
- try {
- ostream.close();
- } catch (Throwable t) {
- ;
- }
-
- // Rethrow any exception that has occurred
- if (exception != null)
- throw exception;
+ // Clean up the input and output streams
+ try {
+ istream.close();
+ } catch (Throwable t) {
+ ;
+ }
+ try {
+ ostream.flush();
+ } catch (Throwable t) {
+ ;
+ }
+ try {
+ ostream.close();
+ } catch (Throwable t) {
+ ;
+ }
+ // Rethrow any exception that has occurred
+ if (exception != null)
+ throw exception;
+
}
-
-
+
+
/**
* Copy the contents of the specified input stream to the specified
* output stream, and ensure that both streams are closed before returning
@@ -1096,7 +1095,7 @@
InputStream resourceInputStream,
ServletOutputStream ostream,
Enumeration ranges, String contentType)
- throws IOException {
+ throws IOException {
IOException exception = null;
@@ -1104,7 +1103,7 @@
InputStream istream =
new BufferedInputStream(resourceInputStream, input);
-
+
Range currentRange = (Range) ranges.nextElement();
// Writing MIME header.
@@ -1112,8 +1111,8 @@
if (contentType != null)
ostream.println("Content-Type: " + contentType);
ostream.println("Content-Range: bytes " + currentRange.start
- + "-" + currentRange.end + "/"
- + currentRange.length);
+ + "-" + currentRange.end + "/"
+ + currentRange.length);
ostream.println();
// Printing content
@@ -1130,25 +1129,25 @@
ostream.print("--" + mimeSeparation + "--");
- // Clean up the output streams
- try {
- ostream.flush();
- } catch (Throwable t) {
- ;
- }
- try {
- ostream.close();
- } catch (Throwable t) {
- ;
- }
-
- // Rethrow any exception that has occurred
- if (exception != null)
- throw exception;
+ // Clean up the output streams
+ try {
+ ostream.flush();
+ } catch (Throwable t) {
+ ;
+ }
+ try {
+ ostream.close();
+ } catch (Throwable t) {
+ ;
+ }
+
+ // Rethrow any exception that has occurred
+ if (exception != null)
+ throw exception;
}
-
-
+
+
/**
* Copy the contents of the specified input stream to the specified
* output stream, and ensure that both streams are closed before returning
@@ -1161,27 +1160,27 @@
private IOException copyRange(InputStream istream,
ServletOutputStream ostream) {
- // Copy the input stream to the output stream
- IOException exception = null;
- byte buffer[] = new byte[input];
- int len = buffer.length;
- while (true) {
- try {
+ // Copy the input stream to the output stream
+ IOException exception = null;
+ byte buffer[] = new byte[input];
+ int len = buffer.length;
+ while (true) {
+ try {
len = istream.read(buffer);
if (len == -1)
break;
ostream.write(buffer, 0, len);
- } catch (IOException e) {
- exception = e;
- len = -1;
+ } catch (IOException e) {
+ exception = e;
+ len = -1;
break;
+ }
}
- }
return exception;
}
-
-
+
+
/**
* Copy the contents of the specified input stream to the specified
* output stream, and ensure that both streams are closed before returning
@@ -1203,13 +1202,13 @@
return e;
}
- IOException exception = null;
+ IOException exception = null;
long bytesToRead = end - start + 1;
- byte buffer[] = new byte[input];
- int len = buffer.length;
- while ( (bytesToRead > 0) && (len >= buffer.length)) {
- try {
+ byte buffer[] = new byte[input];
+ int len = buffer.length;
+ while ( (bytesToRead > 0) && (len >= buffer.length)) {
+ try {
len = istream.read(buffer);
if (bytesToRead >= len) {
ostream.write(buffer, 0, len);
@@ -1218,19 +1217,19 @@
ostream.write(buffer, 0, (int) bytesToRead);
bytesToRead = 0;
}
- } catch (IOException e) {
- exception = e;
- len = -1;
+ } catch (IOException e) {
+ exception = e;
+ len = -1;
+ }
+ if (len < buffer.length)
+ break;
}
- if (len < buffer.length)
- break;
- }
return exception;
}
-
-
+
+
/**
* Parse the range header.
*
@@ -1329,7 +1328,7 @@
} catch (NumberFormatException e) {
response.sendError
(HttpServletResponse
- .SC_REQUESTED_RANGE_NOT_SATISFIABLE);
+ .SC_REQUESTED_RANGE_NOT_SATISFIABLE);
return null;
}
@@ -1341,13 +1340,13 @@
if (dashPos < rangeDefinition.length() - 1)
currentRange.end = Long.parseLong
(rangeDefinition.substring
- (dashPos + 1, rangeDefinition.length()));
+ (dashPos + 1, rangeDefinition.length()));
else
currentRange.end = fileLength - 1;
} catch (NumberFormatException e) {
response.sendError
(HttpServletResponse
- .SC_REQUESTED_RANGE_NOT_SATISFIABLE);
+ .SC_REQUESTED_RANGE_NOT_SATISFIABLE);
return null;
}
@@ -1364,8 +1363,8 @@
return result;
}
-
-
+
+
// ------------------------------------------------------ Range Inner Class
@@ -1380,7 +1379,7 @@
*/
public boolean validate() {
return ( (start >= 0) && (end >= 0) && (length > 0)
- && (start <= end) && (end < length) );
+ && (start <= end) && (end < length) );
}
}
1.7 +71 -72 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java
Index: AclMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AclMethod.java 2001/07/18 10:37:37 1.6
+++ AclMethod.java 2001/07/20 13:00:30 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java,v 1.6 2001/07/18 10:37:37 dirkv Exp $
- * $Revision: 1.6 $
- * $Date: 2001/07/18 10:37:37 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java,v 1.7 2001/07/20 13:00:30 juergen Exp $
+ * $Revision: 1.7 $
+ * $Date: 2001/07/20 13:00:30 $
*
* ====================================================================
*
@@ -115,7 +115,7 @@
protected static final int PRIVILEGE_READ_ACL = 16;
protected static final int PRIVILEGE_WRITE_ACL = 17;
protected static final int PRIVILEGE_GRANT_PERMISSION = 18;
- protected static final int PRIVILEGE_REVOKE_PERMISSION = 19;
+ protected static final int PRIVILEGE_REVOKE_PERMISSION = 19;
// ----------------------------------------------------- Instance Variables
@@ -246,125 +246,125 @@
(NodeProperty.DEFAULT_NAMESPACE, "privilege");
}
- boolean inheritable = true;
+ boolean inheritable = true;
// FIXME : Use the very unofficial Advanced ACL spec here.
for (int j = 0; j < privilegeList.getLength(); j++) {
- Element privilegeElement =
+ Element privilegeElement =
(Element) privilegeList.item(j);
int privilege = parsePrivilege(privilegeElement);
switch (privilege) {
case PRIVILEGE_ALL:
- addPermission(principal, "/",
+ addPermission(principal, "/",
negative, inheritable);
break;
case PRIVILEGE_READ:
addPermission
- (principal,
- config.getReadObjectAction().getUri(),
+ (principal,
+ config.getReadObjectAction().getUri(),
negative, inheritable);
addPermission
- (principal,
+ (principal,
config.getReadRevisionMetadataAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
addPermission
- (principal,
+ (principal,
config.getReadRevisionContentAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
addPermission
- (principal,
- config.getReadLocksAction().getUri(),
+ (principal,
+ config.getReadLocksAction().getUri(),
negative, inheritable);
break;
case PRIVILEGE_READ_OBJECT:
addPermission
- (principal,
- config.getReadObjectAction().getUri(),
+ (principal,
+ config.getReadObjectAction().getUri(),
negative, inheritable);
break;
case PRIVILEGE_READ_REVISION_METADATA:
addPermission
- (principal,
+ (principal,
config.getReadRevisionMetadataAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
break;
case PRIVILEGE_READ_REVISION_CONTENT:
addPermission
- (principal,
+ (principal,
config.getReadRevisionContentAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
break;
case PRIVILEGE_WRITE:
addPermission
- (principal,
- config.getCreateObjectAction().getUri(),
+ (principal,
+ config.getCreateObjectAction().getUri(),
negative, inheritable);
addPermission
- (principal,
- config.getRemoveObjectAction().getUri(),
+ (principal,
+ config.getRemoveObjectAction().getUri(),
negative, inheritable);
addPermission
- (principal,
- config.getLockObjectAction().getUri(),
+ (principal,
+ config.getLockObjectAction().getUri(),
negative, inheritable);
addPermission
- (principal,
+ (principal,
config.getCreateRevisionMetadataAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
addPermission
- (principal,
+ (principal,
config.getModifyRevisionMetadataAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
addPermission
- (principal,
+ (principal,
config.getRemoveRevisionMetadataAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
addPermission
- (principal,
+ (principal,
config.getCreateRevisionContentAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
addPermission
- (principal,
+ (principal,
config.getModifyRevisionContentAction()
- .getUri(),
+ .getUri(),
negative, inheritable);
break;
case PRIVILEGE_READ_ACL:
addPermission
- (principal,
- config.getReadPermissionsAction().getUri(),
+ (principal,
+ config.getReadPermissionsAction().getUri(),
negative, inheritable);
break;
case PRIVILEGE_WRITE_ACL:
addPermission
- (principal,
- config.getGrantPermissionAction().getUri(),
+ (principal,
+ config.getGrantPermissionAction().getUri(),
negative, inheritable);
addPermission
- (principal,
- config.getRevokePermissionAction().getUri(),
+ (principal,
+ config.getRevokePermissionAction().getUri(),
negative, inheritable);
break;
case PRIVILEGE_GRANT_PERMISSION:
addPermission
- (principal,
- config.getGrantPermissionAction().getUri(),
+ (principal,
+ config.getGrantPermissionAction().getUri(),
negative, inheritable);
break;
case PRIVILEGE_REVOKE_PERMISSION:
addPermission
- (principal,
- config.getRevokePermissionAction().getUri(),
+ (principal,
+ config.getRevokePermissionAction().getUri(),
negative, inheritable);
break;
default:
@@ -385,7 +385,7 @@
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
} catch (SAXException e) {
- System.err.println("Error parsing requestBody:");
+ System.err.println("Error parsing requestBody:");
System.err.println(requestBody);
e.printStackTrace();
resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
@@ -418,7 +418,7 @@
try {
- security.setPermissions(slideToken, resourcePath,
+ security.setPermissions(slideToken, resourcePath,
permissions.elements());
} catch (ObjectNotFoundException e) {
@@ -431,7 +431,6 @@
resp.setStatus(WebdavStatus.SC_FORBIDDEN);
} catch (ServiceAccessException e) {
// 500 - Internal server error
- System.out.println(e.getMessage());
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
} catch (RuntimeException e) {
@@ -454,13 +453,13 @@
/**
* Parse principal.
- *
+ *
* @return the URI of the principal
*/
protected String parsePrincipal(Element principal) throws WebdavException {
- // FIXME: make constants and make sure they are used in
- // AclMethod:parsePrincipal and PropFindMethod:writePrincipal
+ // FIXME: make constants and make sure they are used in
+ // AclMethod:parsePrincipal and PropFindMethod:writePrincipal
NodeList hrefList = principal.getElementsByTagNameNS(NodeProperty.DEFAULT_NAMESPACE, "href");
if (hrefList.getLength() == 1) {
Element href = (Element) hrefList.item(0);
@@ -469,7 +468,7 @@
} else if (hasChild(principal, NodeProperty.DEFAULT_NAMESPACE, "all")) {
return "nobody";
} else if (hasChild(principal, NodeProperty.DEFAULT_NAMESPACE, "unauthenticated")) {
- return token.getNamespaceConfig().getUsersPath() + "/" +
+ return token.getNamespaceConfig().getUsersPath() + "/" +
token.getNamespaceConfig().getGuestPath();
}
throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
@@ -478,7 +477,7 @@
/**
* Parse privilege.
- *
+ *
* @return privilege
*/
protected int parsePrivilege(Element privilege)
@@ -486,24 +485,24 @@
if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE, "all")) {
return PRIVILEGE_ALL;
- } else if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE,
+ } else if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE,
"read")) {
return PRIVILEGE_READ;
- } else if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE,
+ } else if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE,
"write")) {
return PRIVILEGE_WRITE;
- } else if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE,
+ } else if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE,
"read-acl")) {
return PRIVILEGE_READ_ACL;
- } else if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE,
+ } else if (hasChild(privilege, NodeProperty.DEFAULT_NAMESPACE,
"write-acl")) {
return PRIVILEGE_WRITE_ACL;
} else if (hasChild(privilege, SLIDE_NAMESPACE, "read-object")) {
return PRIVILEGE_READ_OBJECT;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"read-revision-metadata")) {
return PRIVILEGE_READ_REVISION_METADATA;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"read-revision-content")) {
return PRIVILEGE_READ_REVISION_CONTENT;
} else if (hasChild(privilege, SLIDE_NAMESPACE, "create-object")) {
@@ -514,28 +513,28 @@
return PRIVILEGE_LOCK_OBJECT;
} else if (hasChild(privilege, SLIDE_NAMESPACE, "read-locks")) {
return PRIVILEGE_READ_LOCKS;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"create-revision-metadata")) {
return PRIVILEGE_CREATE_REVISION_METADATA;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"modify-revision-metadata")) {
return PRIVILEGE_MODIFY_REVISION_METADATA;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"remove-revision-metadata")) {
return PRIVILEGE_REMOVE_REVISION_METADATA;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"create-revision-content")) {
return PRIVILEGE_CREATE_REVISION_CONTENT;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"modify-revision-content")) {
return PRIVILEGE_MODIFY_REVISION_CONTENT;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"remove-revision-content")) {
return PRIVILEGE_REMOVE_REVISION_CONTENT;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"grant-permission")) {
return PRIVILEGE_GRANT_PERMISSION;
- } else if (hasChild(privilege, SLIDE_NAMESPACE,
+ } else if (hasChild(privilege, SLIDE_NAMESPACE,
"revoke-permission")) {
return PRIVILEGE_REVOKE_PERMISSION;
} else {
@@ -549,9 +548,9 @@
/**
* Has specified child element ?
*/
- protected boolean hasChild(Element element, String namespace,
+ protected boolean hasChild(Element element, String namespace,
String name) {
- return
+ return
(element.getElementsByTagNameNS(namespace, name).getLength() == 1);
}
@@ -560,7 +559,7 @@
/**
* Add permission to the list of permissions to set.
*/
- protected void addPermission(String principal, String action,
+ protected void addPermission(String principal, String action,
boolean negative, boolean inheritable) {
NodePermission permission = new NodePermission
(resourcePath, principal, action, inheritable, negative);