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/03/24 17:52:53 UTC

cvs commit: jakarta-cactus/framework/src/java/share/org/apache/cactus/client HttpClientHelper.java

vmassol     02/03/24 08:52:53

  Modified:    framework/src/java/share/org/apache/cactus/client
                        HttpClientHelper.java
  Log:
  fixed cookie handling
  
  Revision  Changes    Path
  1.2       +21 -3     jakarta-cactus/framework/src/java/share/org/apache/cactus/client/HttpClientHelper.java
  
  Index: HttpClientHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/client/HttpClientHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpClientHelper.java	1 Mar 2002 00:43:46 -0000	1.1
  +++ HttpClientHelper.java	24 Mar 2002 16:52:53 -0000	1.2
  @@ -84,7 +84,7 @@
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    * @author <a href="mailto:Jason.Robertson@acs-inc.com">Jason Robertson</a>
    *
  - * @version $Id: HttpClientHelper.java,v 1.1 2002/03/01 00:43:46 vmassol Exp $
  + * @version $Id: HttpClientHelper.java,v 1.2 2002/03/24 16:52:53 vmassol Exp $
    */
   public class HttpClientHelper
   {
  @@ -369,14 +369,32 @@
               for (int i = 0; i < cookies.size(); i++) {
                   org.apache.cactus.Cookie cactusCookie =
                       (org.apache.cactus.Cookie) cookies.elementAt(i);
  +
  +                // If no domain has been specified, use a default one
  +                String domain;
  +                if (cactusCookie.getDomain() == null) {
  +                    domain = HttpClientHelper.getDomain(theRequest, theConnection);
  +                } else {
  +                    domain = cactusCookie.getDomain();
  +                }
  +
  +                // If not path has been specified , use a default one
  +                String path;
  +                if (cactusCookie.getPath() == null) {
  +                    path = HttpClientHelper.getPath(theRequest, theConnection);
  +                } else {
  +                    path = cactusCookie.getPath();
  +                }
  +
                   httpclientCookies[i] =
                       new org.apache.commons.httpclient.Cookie(
  -                        cactusCookie.getDomain(), cactusCookie.getName(),
  +                        domain, cactusCookie.getName(),
                           cactusCookie.getValue());
  +
                   httpclientCookies[i].setComment(cactusCookie.getComment());
                   httpclientCookies[i].setExpiryDate(
                           cactusCookie.getExpiryDate());
  -                httpclientCookies[i].setPath(cactusCookie.getPath());
  +                httpclientCookies[i].setPath(path);
                   httpclientCookies[i].setSecure(cactusCookie.isSecure());
               }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>