remm 01/05/10 22:33:42
Modified: src/webdav/client/src/org/apache/webdav/lib/methods
SearchMethod.java
Log:
- Remove a lot of properties and constants which are unneeded for the
SEARCH method.
Patch submitted by Shawn C. Dodd <sdodd at agea.com>
Revision Changes Path
1.3 +5 -154
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/SearchMethod.java
Index: SearchMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/SearchMethod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SearchMethod.java 2001/05/01 21:28:01 1.2
+++ SearchMethod.java 2001/05/11 05:33:41 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/SearchMethod.java,v
1.2 2001/05/01 21:28:01 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2001/05/01 21:28:01 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/SearchMethod.java,v
1.3 2001/05/11 05:33:41 remm Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/05/11 05:33:41 $
*
* ====================================================================
*
@@ -139,31 +139,12 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Shawn C. Dodd</a>
*/
-public class SearchMethod extends XMLResponseMethodBase
- implements DepthSupport {
+public class SearchMethod extends XMLResponseMethodBase {
// -------------------------------------------------------------- Constants
- /**
- * Request of named properties.
- */
- public static final int BY_NAME = 0;
-
-
- /**
- * Request of all properties name and value.
- */
- public static final int ALL = 1;
-
-
- /**
- * Request of all properties name.
- */
- public static final int NAMES = 2;
-
-
// ----------------------------------------------------------- Constructors
@@ -185,25 +166,6 @@
/**
- * Method constructor.
- */
- public SearchMethod(String path, int depth) {
- this(path);
- setDepth(depth);
- }
-
-
- /**
- * Method constructor.
- */
- public SearchMethod(String path, int depth, int type) {
- this(path);
- setDepth(depth);
- setType(type);
- }
-
-
- /**
* Construct a SearchMethod using the given XML request body.
*
* @param path Relative path to the WebDAV resource
@@ -213,45 +175,14 @@
*/
public SearchMethod(String path, String query) {
this(path);
- setDepth(1);
setQuery(query);
- setType(BY_NAME);
}
- /**
- * Construct a SearchMethod using the given XML request body.
- *
- * @param path relative path to the WebDAV resource
- * (presumably a collection)
- * @param depth query scope
- * @param query complete request body in XML including a search query in
- * your favorite grammar
- */
- public SearchMethod(String path, int depth, String query) {
- this(path);
- setDepth(depth);
- setQuery(query);
- setType(BY_NAME);
- }
-
-
// ----------------------------------------------------- Instance Variables
/**
- * Type of the Propfind.
- */
- protected int type = ALL;
-
-
- /**
- * Depth.
- */
- protected int depth = DEPTH_INFINITY;
-
-
- /**
* The namespace abbreviation that prefixes DAV tags
*/
protected String prefix = null;
@@ -260,74 +191,6 @@
// ------------------------------------------------------------- Properties
- /**
- * Set header. handle the special case of Depth.
- *
- * @param headerName Header name
- * @param headerValue Header value
- */
- public void setHeader(String headerName, String headerValue) {
- if (headerName.equalsIgnoreCase("Depth")){
- int depth = -1;
- if (headerValue.equals("0")){
- depth = DEPTH_0;
- }
- if (headerValue.equals("1")){
- depth = DEPTH_1;
- }
- else if (headerValue.equalsIgnoreCase("infinity")){
- depth = DEPTH_INFINITY;
- }
- setDepth(depth);
- }
- else{
- super.setHeader(headerName, headerValue);
- }
- }
-
-
- /**
- * Type setter.
- *
- * @param type New type value
- */
- public void setType(int type) {
- checkNotUsed();
- this.type = type;
- }
-
-
- /**
- * Type getter.
- *
- * @return int type value
- */
- public int getType() {
- return type;
- }
-
-
- /**
- * Depth setter.
- *
- * @param depth New depth value
- */
- public void setDepth(int depth) {
- checkNotUsed();
- this.depth = depth;
- }
-
-
- /**
- * Depth getter.
- *
- * @return int depth value
- */
- public int getDepth() {
- return depth;
- }
-
-
// --------------------------------------------------- WebdavMethod Methods
@@ -336,6 +199,7 @@
prefix = null;
}
+
/**
* Generate additional headers needed by the request.
*
@@ -345,20 +209,7 @@
public void generateHeaders(String host, State state) {
super.generateHeaders(host, state);
-
super.setHeader("Content-Type", "text/xml; charset=utf-8");
-
- switch (depth) {
- case DEPTH_0:
- super.setHeader("Depth", "0");
- break;
- case DEPTH_1:
- super.setHeader("Depth", "1");
- break;
- case DEPTH_INFINITY:
- super.setHeader("Depth", "infinity");
- break;
- }
}