From 0cef3b514f3b682c691c4ba0eb4ae1399440d869 Mon Sep 17 00:00:00 2001 From: Shanti Subramanyam Date: Tue, 13 Nov 2012 11:39:42 -0800 Subject: [PATCH] Fix for Issue #3: Add support for retrieving all cookies in HttpTransport Added a new method getCookies() in HttpTransport and corresponding implementation in hc3. --- driver/src/com/sun/faban/driver/HttpTransport.java | 10 ++++++++++ .../faban/driver/transport/hc3/ApacheHC3Transport.java | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/driver/src/com/sun/faban/driver/HttpTransport.java b/driver/src/com/sun/faban/driver/HttpTransport.java index 71058b4b..c7541859 100644 --- a/driver/src/com/sun/faban/driver/HttpTransport.java +++ b/driver/src/com/sun/faban/driver/HttpTransport.java @@ -23,6 +23,8 @@ */ package com.sun.faban.driver; +import org.apache.commons.httpclient.Cookie; + import java.io.IOException; import java.io.InputStream; import java.io.Reader; @@ -699,6 +701,14 @@ public String[] getCookieValuesByName(String name) { return delegate.getCookieValuesByName(name); } + /** + * Obtains the list of all cookies + * @return array of Cookie objects + */ + public Cookie[] getCookies() { + return delegate.getCookies(); + } + /** * Obtains the header fields of the last request's response. * @param name The response header field of interest diff --git a/driver/src/com/sun/faban/driver/transport/hc3/ApacheHC3Transport.java b/driver/src/com/sun/faban/driver/transport/hc3/ApacheHC3Transport.java index ab333589..3fab6a7e 100644 --- a/driver/src/com/sun/faban/driver/transport/hc3/ApacheHC3Transport.java +++ b/driver/src/com/sun/faban/driver/transport/hc3/ApacheHC3Transport.java @@ -1443,6 +1443,14 @@ public String[] getCookieValuesByName(String name) { return valueSet.toArray(values); } + /** + * Returns all the cookies + * @return array of Cookie objects + */ + public Cookie[] getCookies() { + return hc.getState().getCookies(); + } + /** * Obtains the header fields of the last request's response. * @param name The response header field of interest