rwaldhoff 01/08/14 15:39:21
Modified: httpclient/src/java/org/apache/commons/httpclient Tag:
rlwrefactoring HttpMethodBase.java
httpclient/src/test/org/apache/commons/httpclient Tag:
rlwrefactoring TestWebapp.java
httpclient/src/test-webapp/conf Tag: rlwrefactoring web.xml
Added: httpclient/src/test/org/apache/commons/httpclient Tag:
rlwrefactoring TestWebappRedirect.java
Log:
Five additional tests, testing redirect handling.
New servlet implementing the server-side of these tests.
Fix to HttpMethodBase so the tests actually pass.
Revision Changes Path
No revision
No revision
1.10.2.14 +6 -6
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
Index: HttpMethodBase.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
retrieving revision 1.10.2.13
retrieving revision 1.10.2.14
diff -u -r1.10.2.13 -r1.10.2.14
--- HttpMethodBase.java 2001/08/14 20:22:29 1.10.2.13
+++ HttpMethodBase.java 2001/08/14 22:39:21 1.10.2.14
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
1.10.2.13 2001/08/14 20:22:29 rwaldhoff Exp $
- * $Revision: 1.10.2.13 $
- * $Date: 2001/08/14 20:22:29 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
1.10.2.14 2001/08/14 22:39:21 rwaldhoff Exp $
+ * $Revision: 1.10.2.14 $
+ * $Date: 2001/08/14 22:39:21 $
* ====================================================================
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
@@ -67,7 +67,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author Rodney Waldhoff
- * @version $Id: HttpMethodBase.java,v 1.10.2.13 2001/08/14 20:22:29 rwaldhoff Exp $
+ * @version $Id: HttpMethodBase.java,v 1.10.2.14 2001/08/14 22:39:21 rwaldhoff Exp $
*/
public abstract class HttpMethodBase implements HttpMethod {
@@ -375,7 +375,7 @@
for(;;) {
// for now, just track path and qstring
- visited.add(getPath() + queryString);
+ visited.add(getPath() + (null == getQueryString() ? "" :
getQueryString()));
log.debug("HttpMethodBase.execute(): looping.");
@@ -517,7 +517,7 @@
String qs = url.getQuery();
// if we haven't already, let's try it again with the new
path
- if(visited.contains(absolutePath + queryString)) {
+ if(visited.contains(absolutePath + (null == qs ? "" : qs)))
{
throw new HttpException("Redirect going into a loop,
visited \"" + absolutePath + "\" already.");
} else {
if(log.isDebugEnabled()) {
No revision
No revision
1.1.2.2 +5 -4
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebapp.java
Index: TestWebapp.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebapp.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- TestWebapp.java 2001/08/13 16:02:57 1.1.2.1
+++ TestWebapp.java 2001/08/14 22:39:21 1.1.2.2
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebapp.java,v
1.1.2.1 2001/08/13 16:02:57 rwaldhoff Exp $
- * $Revision: 1.1.2.1 $
- * $Date: 2001/08/13 16:02:57 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebapp.java,v
1.1.2.2 2001/08/14 22:39:21 rwaldhoff Exp $
+ * $Revision: 1.1.2.2 $
+ * $Date: 2001/08/14 22:39:21 $
* ====================================================================
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
@@ -32,7 +32,7 @@
* "httpclient.test.webappContext" property.
*
* @author Rodney Waldhoff
- * @version $Id: TestWebapp.java,v 1.1.2.1 2001/08/13 16:02:57 rwaldhoff Exp $
+ * @version $Id: TestWebapp.java,v 1.1.2.2 2001/08/14 22:39:21 rwaldhoff Exp $
*/
public class TestWebapp extends TestCase {
@@ -45,6 +45,7 @@
suite.addTest(TestWebappMethods.suite());
suite.addTest(TestWebappParameters.suite());
suite.addTest(TestWebappHeaders.suite());
+ suite.addTest(TestWebappRedirect.suite());
return suite;
}
No revision
No revision
1.1.2.1 +168 -0
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappRedirect.java
No revision
No revision
1.1.2.2 +10 -0 jakarta-commons/httpclient/src/test-webapp/conf/Attic/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test-webapp/conf/Attic/web.xml,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- web.xml 2001/08/13 15:56:31 1.1.2.1
+++ web.xml 2001/08/14 22:39:21 1.1.2.2
@@ -20,6 +20,11 @@
<servlet-class>org.apache.commons.httpclient.RequestBodyServlet</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>redirect</servlet-name>
+ <servlet-class>org.apache.commons.httpclient.RedirectServlet</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>params</servlet-name>
<url-pattern>/params</url-pattern>
@@ -33,5 +38,10 @@
<servlet-mapping>
<servlet-name>body</servlet-name>
<url-pattern>/body</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>redirect</servlet-name>
+ <url-pattern>/redirect</url-pattern>
</servlet-mapping>
</web-app>