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/08/13 09:24:44 UTC
cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method OptionsMethod.java
juergen 2002/08/13 00:24:44
Modified: src/webdav/server/org/apache/slide/webdav/method
OptionsMethod.java
Log:
Create "Allow:.." header depending on the resource kind.
(ralf)
Revision Changes Path
1.31 +16 -19 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/OptionsMethod.java
Index: OptionsMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/OptionsMethod.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- OptionsMethod.java 12 Aug 2002 12:55:02 -0000 1.30
+++ OptionsMethod.java 13 Aug 2002 07:24:44 -0000 1.31
@@ -85,6 +85,8 @@
import org.apache.slide.webdav.util.WebdavUtils;
import org.apache.slide.webdav.util.DeltavConstants;
import org.apache.slide.webdav.util.AclConstants;
+import org.apache.slide.webdav.util.resourcekind.ResourceKind;
+import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind;
import org.jdom.Element;
import org.jdom.Document;
@@ -216,11 +218,13 @@
SearchLanguage[] languages =
token.getSearchHelper().getSupportedLanguages ();
+ ResourceKind resourceKind = null;
try {
NodeRevisionDescriptors revisionDescriptors =
content.retrieve(slideToken, resourceUri);
NodeRevisionDescriptor revisionDescriptor =
content.retrieve(slideToken, revisionDescriptors);
+ resourceKind = AbstractResourceKind.determineResourceKind(token, revisionDescriptors, revisionDescriptor);
resourceExists = true;
if( WebdavUtils.isCollection(revisionDescriptor) )
resourceIsCollection = true;
@@ -235,22 +239,15 @@
// build allow-header
StringBuffer methodsAllowed = new StringBuffer();
- if( resourceExists ) {
- methodsAllowed.append( "OPTIONS, GET, HEAD, POST, DELETE, TRACE" );
- if( !resourceIsCollection )
- methodsAllowed.append( ", PUT" );
- methodsAllowed.append( ", PROPFIND, PROPPATCH, COPY, MOVE" );
- if( Configuration.useIntegratedLocking() )
- methodsAllowed.append( ", LOCK, UNLOCK" );
- if( Configuration.useIntegratedSecurity() || Configuration.useVersionControl() )
- methodsAllowed.append( ", REPORT" );
- if( Configuration.useIntegratedSecurity() )
- methodsAllowed.append( ", ACL" );
- if( Configuration.useVersionControl() )
- methodsAllowed.append( ", VERSION-CONTROL, MKWORKSPACE, CHECKOUT, CHECKIN, UNCHECKOUT, LABEL, UPDATE" );
- if (Configuration.useSearch () && languages != null)
- methodsAllowed.append( ", SEARCH" );
-
+ if( resourceKind != null ) {
+ Iterator methodIterator = resourceKind.getSupportedMethods().iterator();
+ while (methodIterator.hasNext()) {
+ methodsAllowed.append((String)methodIterator.next());
+ methodsAllowed.append(", ");
+ }
+ if (methodsAllowed.length() > 1) {
+ methodsAllowed.setLength(methodsAllowed.length()-2);
+ }
}
else {
methodsAllowed.append( "OPTIONS, MKCOL, PUT" );
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>