You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/11/24 15:46:09 UTC
cvs commit: jakarta-cactus/framework/src/java/share/org/apache/cactus/client AbstractConnectionHelper.java
vmassol 2002/11/24 06:46:09
Modified: documentation/docs/xdocs changes.xml
framework/src/java/share/org/apache/cactus/client
AbstractConnectionHelper.java
Log:
Improved error handling when dealing with invalid cookies
Revision Changes Path
1.59 +3 -0 jakarta-cactus/documentation/docs/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- changes.xml 24 Nov 2002 14:17:16 -0000 1.58
+++ changes.xml 24 Nov 2002 14:46:09 -0000 1.59
@@ -48,6 +48,9 @@
</devs>
<release version="1.5" date="- in CVS">
+ <action dev="VMA" type="update">
+ Improved error handling when dealing with invalid Cookies.
+ </action>
<action dev="VMA" type="fix" due-to="Roumen B. Antonov" due-to-email="rantonov@fourthgen.com">
Fixed a potential bug with classloaders. On the server side, Cactus
looks for the TestCase class by searching first the WebApp Classloader
1.3 +36 -3 jakarta-cactus/framework/src/java/share/org/apache/cactus/client/AbstractConnectionHelper.java
Index: AbstractConnectionHelper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/client/AbstractConnectionHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractConnectionHelper.java 28 Aug 2002 08:27:36 -0000 1.2
+++ AbstractConnectionHelper.java 24 Nov 2002 14:46:09 -0000 1.3
@@ -160,8 +160,11 @@
* @param theRequest the request containing all data to pass to the server
* redirector.
* @param theUrl the URL to connect to
+ * @throws ClientException if an error occurred when creating the cookie
+ * string
*/
public String getCookieString(WebRequest theRequest, URL theUrl)
+ throws ClientException
{
// If no Cookies, then exit
Vector cookies = theRequest.getCookies();
@@ -212,8 +215,7 @@
}
// and create the cookie header to send
- Header cookieHeader =
- org.apache.commons.httpclient.Cookie.createCookieHeader(
+ Header cookieHeader = createCookieHeader(
Cookie.getCookieDomain(theRequest, theUrl.getHost()),
Cookie.getCookiePath(theRequest, theUrl.getFile()),
httpclientCookies);
@@ -222,5 +224,36 @@
}
return null;
+ }
+
+ /**
+ * Create a HttpClient {@link Header} for cookies that matches
+ * the domain and path.
+ *
+ * @param theDomain the cookie domain to match
+ * @param thePath the cookie path to match
+ * @param theCookies the list of potential cookies
+ * @return the HttpClient {@link Header} containing the matching
+ * cookies
+ * @throws ClientException if no cookie was matching the domain
+ * and path
+ */
+ private Header createCookieHeader(String theDomain, String thePath,
+ org.apache.commons.httpclient.Cookie[] theCookies)
+ throws ClientException
+ {
+ Header cookieHeader =
+ org.apache.commons.httpclient.Cookie.createCookieHeader(
+ theDomain, thePath, theCookies);
+
+ if (cookieHeader == null)
+ {
+ throw new ClientException("Failed to create Cookie header for ["
+ + "domain = [" + theDomain + ", path = [" + thePath
+ + ", cookies = [" + theCookies + "]]. Turn on HttpClient "
+ + "logging for more information about the error");
+ }
+
+ return cookieHeader;
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>