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 wa...@apache.org on 2002/05/17 12:39:42 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/search/basic BasicQueryScope.java
wam 02/05/17 03:39:42
Modified: src/share/org/apache/slide/search SearchQueryResult.java
SearchQuery.java
src/webdav/server/org/apache/slide/webdav/method
SearchMethod.java
src/share/org/apache/slide/search/basic BasicQueryScope.java
Added: src/share/org/apache/slide/search BadGatewayException.java
Log:
bug fixing in error handling
Revision Changes Path
1.10 +5 -4 jakarta-slide/src/share/org/apache/slide/search/SearchQueryResult.java
Index: SearchQueryResult.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQueryResult.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SearchQueryResult.java 26 Apr 2002 15:19:12 -0000 1.9
+++ SearchQueryResult.java 17 May 2002 10:39:41 -0000 1.10
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQueryResult.java,v 1.9 2002/04/26 15:19:12 wam Exp $
- * $Revision: 1.9 $
- * $Date: 2002/04/26 15:19:12 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQueryResult.java,v 1.10 2002/05/17 10:39:41 wam Exp $
+ * $Revision: 1.10 $
+ * $Date: 2002/05/17 10:39:41 $
*
* ====================================================================
*
@@ -82,7 +82,7 @@
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
* @author <a href="mailto:martin.wallmer@softweareag.com">Martin Wallmer</a>
*
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class SearchQueryResult {
@@ -91,6 +91,7 @@
public final static int STATUS_INVALID_SCOPE = 2;
public final static int STATUS_PARTIAL_RESULT = 3;
public final static int STATUS_UNPROCESSABLE_ENTITY = 4;
+ public final static int STATUS_BAD_GATEWAY = 5;
private int status;
private String description;
1.6 +10 -17 jakarta-slide/src/share/org/apache/slide/search/SearchQuery.java
Index: SearchQuery.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQuery.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SearchQuery.java 25 Apr 2002 21:30:15 -0000 1.5
+++ SearchQuery.java 17 May 2002 10:39:41 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQuery.java,v 1.5 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.5 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQuery.java,v 1.6 2002/05/17 10:39:41 wam Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/05/17 10:39:41 $
*
* ====================================================================
*
@@ -75,16 +75,11 @@
* Search query.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public abstract class SearchQuery {
protected Structure structureHelper;
-
- /** may be limited by configuration */
- // protected int maxDepth = Integer.MAX_VALUE;
-
- /** */
protected SearchToken searchToken;
/**
@@ -97,14 +92,12 @@
public abstract SearchQueryResult execute ()
throws ServiceAccessException;
+ /**
+ * Get all properties that shall be returned in the <propstat/> element
+ *
+ * @return a RequestedProperties
+ *
+ */
public abstract RequestedProperties requestedProperties ();
-
-// public void setSlideToken (SlideToken token) {
-// this.slideToken = token;
-// }
-
-// public void setMaxDepth (int maxDepth) {
-// this.maxDepth = maxDepth;
-// }
}
1.1 jakarta-slide/src/share/org/apache/slide/search/BadGatewayException.java
Index: BadGatewayException.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/BadGatewayException.java,v 1.1 2002/05/17 10:39:41 wam Exp $
* $Revision: 1.1 $
* $Date: 2002/05/17 10:39:41 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Slide", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.slide.search;
/**
* Indicates a Bad Gateway exception
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
* @version $Revision: 1.1 $
*/
public class BadGatewayException extends BadQueryException {
// ----------------------------------------------------------- Constructors
/**
* Constructor.
*
* @param message Exception message
*/
public BadGatewayException (String message) {
super(message);
}
}
1.19 +19 -3 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java
Index: SearchMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SearchMethod.java 17 May 2002 05:54:32 -0000 1.18
+++ SearchMethod.java 17 May 2002 10:39:41 -0000 1.19
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v 1.18 2002/05/17 05:54:32 juergen Exp $
- * $Revision: 1.18 $
- * $Date: 2002/05/17 05:54:32 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v 1.19 2002/05/17 10:39:41 wam Exp $
+ * $Revision: 1.19 $
+ * $Date: 2002/05/17 10:39:41 $
*
* ====================================================================
*
@@ -79,6 +79,7 @@
import org.apache.slide.search.SearchLanguage;
import org.apache.slide.search.BadQueryException;
import org.apache.slide.search.InvalidQueryException;
+import org.apache.slide.search.BadGatewayException;
//import org.apache.slide.lock.LockException;
//import org.apache.slide.lock.LockTokenNotFoundException;
@@ -184,8 +185,17 @@
e.getMessage());
throw new WebdavException(WebdavStatus.SC_UNPROCESSABLE_ENTITY);
}
+ catch (BadGatewayException e) {
+ resp.setStatus(WebdavStatus.SC_BAD_GATEWAY);
+ resp.setContentType (TEXT_XML);
+ createErrorResult (SearchQueryResult.STATUS_BAD_GATEWAY,
+ e.getMessage());
+ throw new WebdavException(WebdavStatus.SC_BAD_GATEWAY);
+ }
catch (BadQueryException e) {
resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
+ createErrorResult (SearchQueryResult.STATUS_BAD_QUERY,
+ e.getMessage());
throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
}
}
@@ -439,6 +449,11 @@
href = req.getContextPath();
break;
+ case SearchQueryResult.STATUS_BAD_GATEWAY:
+ errorStatus = WebdavStatus.SC_BAD_GATEWAY;
+ href = queryResult.getHref();
+ break;
+
default:
throw new WebdavException
(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
@@ -492,3 +507,4 @@
}
}
}
+
1.6 +20 -4 jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java
Index: BasicQueryScope.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BasicQueryScope.java 26 Apr 2002 15:19:11 -0000 1.5
+++ BasicQueryScope.java 17 May 2002 10:39:42 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v 1.5 2002/04/26 15:19:11 wam Exp $
- * $Revision: 1.5 $
- * $Date: 2002/04/26 15:19:11 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v 1.6 2002/05/17 10:39:42 wam Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/05/17 10:39:42 $
*
* ====================================================================
*
@@ -65,6 +65,9 @@
import org.apache.slide.search.*;
+import java.util.List;
+import java.net.URL;
+
import org.apache.slide.content.NodeProperty;
import org.apache.slide.search.BadQueryException;
@@ -76,7 +79,7 @@
* Holds the scope information supplied with the <FROM> element.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class BasicQueryScope implements QueryScope {
@@ -129,7 +132,20 @@
throw new BadQueryException ("expected DAV:from");
Element scope = fromElement.getChild (Literals.SCOPE, namespace);
+
+ if (scope.getChildren (Literals.HREF, namespace).size() != 1) {
+ throw new BadQueryException ("exactly one href element must be defined");
+ }
+
href = scope.getChildTextTrim (Literals.HREF, namespace);
+
+ try {
+ URL url = new URL (href);
+ throw new BadGatewayException (href + ": Bad Gateway (no server redirection allowed)");
+ }
+ // must not be a valid URL (server redirection not implemented)
+ catch (java.net.MalformedURLException e) {}
+
if (!href.endsWith("/"))
href += "/";
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>