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 cm...@apache.org on 2003/05/05 21:14:07 UTC
cvs commit: jakarta-cactus/framework/src/java/share/org/apache/cactus/client/connector/http HttpClientConnectionHelper.java
cmlenz 2003/05/05 12:14:07
Modified: framework/src/java/share/org/apache/cactus/client/connector/http
HttpClientConnectionHelper.java
Log:
Instead of setting the cookies as header, use the HttpState class provided by Commons-HttpClient.
For me, this solves the build errors seen in recent Gump builds.
Revision Changes Path
1.4 +7 -9 jakarta-cactus/framework/src/java/share/org/apache/cactus/client/connector/http/HttpClientConnectionHelper.java
Index: HttpClientConnectionHelper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/client/connector/http/HttpClientConnectionHelper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HttpClientConnectionHelper.java 19 Mar 2003 17:08:35 -0000 1.3
+++ HttpClientConnectionHelper.java 5 May 2003 19:14:07 -0000 1.4
@@ -71,6 +71,7 @@
import org.apache.cactus.util.UrlUtil;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
@@ -151,14 +152,6 @@
// Add the other header fields
addHeaders(theRequest);
- // Add the cookies
- String cookieString = getCookieString(theRequest, url);
-
- if (cookieString != null)
- {
- this.method.addRequestHeader("Cookie", cookieString);
- }
-
// Add the POST parameters if no user data has been specified (user data
// overried post parameters)
if (theRequest.getUserData() != null)
@@ -170,11 +163,16 @@
addParametersPost(theRequest);
}
+ // Add the cookies
+ HttpState state = new HttpState();
+ state.addCookies(createHttpClientCookies(theRequest, url));
+
// Open the connection and get the result
HttpClient client = new HttpClient();
HostConfiguration hostConfiguration = new HostConfiguration();
hostConfiguration.setHost(url.getHost(), url.getPort(),
Protocol.getProtocol(url.getProtocol()));
+ client.setState(state);
client.executeMethod(hostConfiguration, this.method);
// Wrap the HttpClient method in a java.net.HttpURLConnection object
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org