balld       01/07/12 12:23:45

  Modified:    src/org/apache/cocoon/environment Request.java
               src/org/apache/cocoon/environment/commandline
                        CommandLineRequest.java
               src/org/apache/cocoon/environment/http HttpRequest.java
               src/org/apache/cocoon/environment/wrapper
                        RequestWrapper.java
  Log:
  added getCookieMap method to Request interface
  
  Revision  Changes    Path
  1.4       +11 -1     xml-cocoon2/src/org/apache/cocoon/environment/Request.java
  
  Index: Request.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/Request.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Request.java      2001/07/12 14:18:51     1.3
  +++ Request.java      2001/07/12 19:23:26     1.4
  @@ -12,6 +12,7 @@
   import java.io.UnsupportedEncodingException;
   import java.util.Enumeration;
   import java.util.Locale;
  +import java.util.Map;
   import java.security.Principal;
   
   /**
  @@ -20,7 +21,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Berin Loritsch</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2001/07/12 14:18:51 $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/07/12 19:23:26 $
    *
    */
   
  @@ -346,6 +347,15 @@
        */
   
       Cookie[] getCookies();
  +
  +    /**
  +     * Returns a map of the <code>Cookie</code> objects the client sent 
  +     * with this request, indexed by name. This method returns an empty
  +     * map if no cookies were sent.
  +     *
  +     * @return a Map of <code>Cookie</code> objects
  +     */
  +    Map getCookieMap();
   
       /**
        *
  
  
  
  1.4       +6 -1      
xml-cocoon2/src/org/apache/cocoon/environment/commandline/CommandLineRequest.java
  
  Index: CommandLineRequest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/commandline/CommandLineRequest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CommandLineRequest.java   2001/06/19 12:10:03     1.3
  +++ CommandLineRequest.java   2001/07/12 19:23:34     1.4
  @@ -15,6 +15,8 @@
   import java.util.Iterator;
   import java.util.Locale;
   import java.util.Map;
  +import java.util.HashMap;
  +import java.util.Collections;
   import org.apache.cocoon.Constants;
   import org.apache.cocoon.environment.Cookie;
   import org.apache.cocoon.environment.Environment;
  @@ -25,7 +27,7 @@
    * Creates a specific servlet request simulation from command line usage.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2001/06/19 12:10:03 $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/07/12 19:23:34 $
    */
   
   /*
  @@ -170,6 +172,9 @@
       public String getRemoteUser() { return System.getProperty("user.name"); }
   
       public Cookie[] getCookies() { return null; }
  +    public Map getCookieMap() {
  +        return Collections.unmodifiableMap(new HashMap());
  +    }
       public Session getSession() { return null; }
       public Session getSession(boolean create) { return null; }
       public String getRequestedSessionId() { return null; }
  
  
  
  1.4       +18 -2     
xml-cocoon2/src/org/apache/cocoon/environment/http/HttpRequest.java
  
  Index: HttpRequest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/http/HttpRequest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpRequest.java  2001/06/14 18:29:18     1.3
  +++ HttpRequest.java  2001/07/12 19:23:37     1.4
  @@ -13,6 +13,9 @@
   import java.util.Enumeration;
   import java.util.Locale;
   import java.util.Vector;
  +import java.util.Map;
  +import java.util.HashMap;
  +import java.util.Collections;
   import javax.servlet.RequestDispatcher;
   import javax.servlet.ServletInputStream;
   import javax.servlet.http.HttpServletRequest;
  @@ -25,7 +28,7 @@
    * to provide request information for HTTP servlets.
    *
    * @author <a href="mailto:giacomo@apache,org";>Giacomo Pati</a>
  - * @version CVS $Id: HttpRequest.java,v 1.3 2001/06/14 18:29:18 dims Exp $
  + * @version CVS $Id: HttpRequest.java,v 1.4 2001/07/12 19:23:37 balld Exp $
    */
   
   public class HttpRequest implements Request {
  @@ -78,17 +81,30 @@
       }
   
       private Cookie[] wrappedCookies = null;
  +    private Map wrappedCookieMap = null;
  +
       public Cookie[] getCookies() {
           if (this.wrappedCookies == null) {
  +            this.wrappedCookieMap = new HashMap();
               javax.servlet.http.Cookie[] cookies = this.req.getCookies();
               if (cookies != null) {
                   this.wrappedCookies = new Cookie[cookies.length];
                   for(int i=0; i<cookies.length;i++) {
  -                    this.wrappedCookies[i] = new HttpCookie(cookies[i]);
  +                    HttpCookie cookie = new HttpCookie(cookies[i]);
  +                    this.wrappedCookies[i] = cookie;
  +                    this.wrappedCookieMap.put(cookie.getName(),cookie);
                   }
               }
           }
           return this.wrappedCookies;
  +    }
  +
  +    public Map getCookieMap() {
  +        if (this.wrappedCookieMap != null) {
  +            return Collections.unmodifiableMap(this.wrappedCookieMap);
  +        } else {
  +            return Collections.unmodifiableMap(new HashMap());
  +        }
       }
   
       public long getDateHeader(String name) {
  
  
  
  1.6       +7 -2      
xml-cocoon2/src/org/apache/cocoon/environment/wrapper/RequestWrapper.java
  
  Index: RequestWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/wrapper/RequestWrapper.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RequestWrapper.java       2001/07/12 14:19:01     1.5
  +++ RequestWrapper.java       2001/07/12 19:23:42     1.6
  @@ -23,7 +23,7 @@
    * are different.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version $Id: RequestWrapper.java,v 1.5 2001/07/12 14:19:01 dims Exp $
  + * @version $Id: RequestWrapper.java,v 1.6 2001/07/12 19:23:42 balld Exp $
    */
   public final class RequestWrapper implements Request {
   
  @@ -177,6 +177,10 @@
           return this.req.getCookies();
       }
   
  +    public Map getCookieMap() {
  +        return this.req.getCookieMap();
  +    }
  +
       public long getDateHeader(String name) {
           return this.req.getDateHeader(name);
       }
  @@ -268,4 +272,5 @@
       public String getAuthType() {
           return this.req.getAuthType();
       }
  -}
  \ No newline at end of file
  +
  +}
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to