001: /*
002: * $Header$
003: * $Revision: 4672 $
004: * $Date: 2006-09-27 00:03:16 +0000 (Wed, 27 Sep 2006) $
005: *
006: * ====================================================================
007: *
008: * Copyright 1999-2004 The Apache Software Foundation
009: *
010: * Licensed under the Apache License, Version 2.0 (the "License");
011: * you may not use this file except in compliance with the License.
012: * You may obtain a copy of the License at
013: *
014: * http://www.apache.org/licenses/LICENSE-2.0
015: *
016: * Unless required by applicable law or agreed to in writing, software
017: * distributed under the License is distributed on an "AS IS" BASIS,
018: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019: * See the License for the specific language governing permissions and
020: * limitations under the License.
021: * ====================================================================
022: *
023: * This software consists of voluntary contributions made by many
024: * individuals on behalf of the Apache Software Foundation. For more
025: * information on the Apache Software Foundation, please see
026: * <http://www.apache.org/>.
027: *
028: */
029:
030: package org.apache.commons.httpclient;
031:
032: import java.util.ArrayList;
033: import java.util.Collection;
034: import java.util.Date;
035: import java.util.HashMap;
036: import java.util.Map;
037: import java.util.Iterator;
038: import java.util.SortedMap;
039: import java.util.TreeMap;
040:
041: import org.apache.commons.httpclient.cookie.CookieSpec;
042: import org.apache.commons.httpclient.cookie.CookiePolicy;
043: import org.apache.commons.httpclient.auth.AuthScope;
044: import org.apache.commons.logging.Log;
045: import org.apache.commons.logging.LogFactory;
046:
047: import com.sleepycat.collections.StoredIterator;
048:
049: /**
050: * <p>
051: * A container for HTTP attributes that may persist from request
052: * to request, such as {@link Cookie cookies} and authentication
053: * {@link Credentials credentials}.
054: * </p>
055: *
056: * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
057: * @author Rodney Waldhoff
058: * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
059: * @author Sean C. Sullivan
060: * @author <a href="mailto:becke@u.washington.edu">Michael Becke</a>
061: * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
062: * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
063: * @author <a href="mailto:adrian@intencha.com">Adrian Sutton</a>
064: *
065: * @version $Revision: 4672 $ $Date: 2006-09-27 00:03:16 +0000 (Wed, 27 Sep 2006) $
066: *
067: */
068: @SuppressWarnings("unchecked")
069: public class HttpState {
070:
071: // ----------------------------------------------------- Instance Variables
072:
073: /**
074: * Map of {@link Credentials credentials} by realm that this
075: * HTTP state contains.
076: */
077: private HashMap credMap = new HashMap();
078:
079: /**
080: * Map of {@link Credentials proxy credentials} by realm that this
081: * HTTP state contains
082: */
083: private HashMap proxyCred = new HashMap();
084:
085: // BEGIN IA CHANGES
086: // /**
087: // * Array of {@link Cookie cookies} that this HTTP state contains.
088: // */
089: // private ArrayList cookiesArrayList = new ArrayList();
090: /**
091: * SortedMap of {@link Cookie cookies} that this HTTP state contains.
092: */
093: private SortedMap cookiesMap = new TreeMap();
094: // END IA CHANGES
095:
096: private boolean preemptive = false;
097:
098: private int cookiePolicy = -1;
099: // -------------------------------------------------------- Class Variables
100:
101: /**
102: * The boolean system property name to turn on preemptive authentication.
103: * @deprecated This field and feature will be removed following HttpClient 3.0.
104: */
105: public static final String PREEMPTIVE_PROPERTY = "httpclient.authentication.preemptive";
106:
107: /**
108: * The default value for {@link #PREEMPTIVE_PROPERTY}.
109: * @deprecated This field and feature will be removed following HttpClient 3.0.
110: */
111: public static final String PREEMPTIVE_DEFAULT = "false";
112:
113: /** Log object for this class. */
114: private static final Log LOG = LogFactory.getLog(HttpState.class);
115:
116: /**
117: * Default constructor.
118: */
119: public HttpState() {
120: super ();
121: }
122:
123: // ------------------------------------------------------------- Properties
124:
125: /**
126: * Adds an {@link Cookie HTTP cookie}, replacing any existing equivalent cookies.
127: * If the given cookie has already expired it will not be added, but existing
128: * values will still be removed.
129: *
130: * @param cookie the {@link Cookie cookie} to be added
131: *
132: * @see #addCookies(Cookie[])
133: *
134: */
135: public synchronized void addCookie(Cookie cookie) {
136: LOG.trace("enter HttpState.addCookie(Cookie)");
137:
138: // BEGIN IA CHANGES
139: // PRIOR IMPL & COMPARISON HARNESS LEFT COMMENTED OUT FOR TEMPORARY REFERENCE
140: // Cookie removed1 = null;
141: // Cookie removed2 = null;
142: if (cookie != null) {
143: // first remove any old cookie that is equivalent
144: // for (Iterator it = cookiesArrayList.iterator(); it.hasNext();) {
145: // Cookie tmp = (Cookie) it.next();
146: // if (cookie.equals(tmp)) {
147: // it.remove();
148: // removed1 = tmp;
149: // break;
150: // }
151: // }
152: if (!cookie.isExpired()) {
153: // cookiesArrayList.add(cookie);
154: cookiesMap.put(cookie.getSortKey(), cookie);
155: } else {
156: cookiesMap.remove(cookie.getSortKey());
157: }
158: }
159: // if(removed1!=null && !removed1.equals(removed2)) {
160: // System.out.println("addCookie discrepancy");
161: // }
162: // END IA CHANGES
163: }
164:
165: /**
166: * Adds an array of {@link Cookie HTTP cookies}. Cookies are added individually and
167: * in the given array order. If any of the given cookies has already expired it will
168: * not be added, but existing values will still be removed.
169: *
170: * @param cookies the {@link Cookie cookies} to be added
171: *
172: * @see #addCookie(Cookie)
173: *
174: *
175: */
176: public synchronized void addCookies(Cookie[] cookies) {
177: LOG.trace("enter HttpState.addCookies(Cookie[])");
178:
179: if (cookies != null) {
180: for (int i = 0; i < cookies.length; i++) {
181: this .addCookie(cookies[i]);
182: }
183: }
184: }
185:
186: /**
187: * Returns an array of {@link Cookie cookies} that this HTTP
188: * state currently contains.
189: *
190: * @return an array of {@link Cookie cookies}.
191: *
192: * @see #getCookies(String, int, String, boolean)
193: *
194: * @deprecated use getCookiesMap()
195: */
196: public synchronized Cookie[] getCookies() {
197: LOG.trace("enter HttpState.getCookies()");
198: // BEGIN IA CHANGES
199: // PRIOR IMPL & COMPARISON HARNESS LEFT COMMENTED OUT FOR TEMPORARY REFERENCE
200: // Cookie[] arrayListAnswer = (Cookie[]) (cookiesArrayList.toArray(new Cookie[cookiesArrayList.size()]));
201: ArrayList arrayableCookies = new ArrayList();
202: Iterator iter = cookiesMap.values().iterator();
203: while (iter.hasNext()) {
204: arrayableCookies.add(iter.next());
205: }
206: StoredIterator.close(iter);
207: Cookie[] mapAnswer = (Cookie[]) arrayableCookies
208: .toArray(new Cookie[arrayableCookies.size()]);
209:
210: // if(cookiesArrayList.size()!=arrayableCookies.size()) {
211: // System.out.println("discrepancy");
212: // }
213: return mapAnswer;
214: // END IA CHANGES
215: }
216:
217: /**
218: * Returns a sorted map of {@link Cookie cookies} that this HTTP
219: * state currently contains.
220: *
221: * Any operations on this map should be synchronized with respect
222: * to this HttpState instance.
223: *
224: * @return sorter map of {@link Cookie cookies}
225: */
226: public synchronized SortedMap getCookiesMap() {
227: return cookiesMap;
228: }
229:
230: /**
231: * Replace the standard sorted map with an external implemenations
232: * (such as one backed by persistent store, like BDB's StoredSortedMap.)
233: *
234: * @param map alternate sorted map to use to store cookies
235: */
236: public synchronized void setCookiesMap(SortedMap map) {
237: this .cookiesMap = map;
238: }
239:
240: /**
241: * Returns an array of {@link Cookie cookies} in this HTTP
242: * state that match the given request parameters.
243: *
244: * @param domain the request domain
245: * @param port the request port
246: * @param path the request path
247: * @param secure <code>true</code> when using HTTPS
248: *
249: * @return an array of {@link Cookie cookies}.
250: *
251: * @see #getCookies()
252: *
253: * @deprecated use CookieSpec#match(String, int, String, boolean, Cookie)
254: */
255: public synchronized Cookie[] getCookies(String domain, int port,
256: String path, boolean secure) {
257: LOG
258: .trace("enter HttpState.getCookies(String, int, String, boolean)");
259:
260: CookieSpec matcher = CookiePolicy.getDefaultSpec();
261: // BEGIN IA CHANGES
262: // PRIOR IMPL & COMPARISON HARNESS LEFT COMMENTED OUT FOR TEMPORARY REFERENCE
263: // ArrayList list = new ArrayList(cookiesArrayList.size());
264: // for (int i = 0, m = cookiesArrayList.size(); i < m; i++) {
265: // Cookie cookie = (Cookie) (cookiesArrayList.get(i));
266: // if (matcher.match(domain, port, path, secure, cookie)) {
267: // list.add(cookie);
268: // }
269: // }
270: // Cookie[] arrayListAnswer = (Cookie[]) (list.toArray(new Cookie[list.size()]));
271: Cookie[] mapAnswer = matcher.match(domain, port, path, secure,
272: cookiesMap);
273:
274: // if(! (new HashSet(list).equals(new HashSet(Arrays.asList(mapAnswer))))) {
275: // System.out.println("discrepancy");
276: // }
277: return mapAnswer;
278: // END IA CHANGES
279: }
280:
281: /**
282: * Removes all of {@link Cookie cookies} in this HTTP state
283: * that have expired according to the current system time.
284: *
285: * @see #purgeExpiredCookies(java.util.Date)
286: *
287: */
288: public synchronized boolean purgeExpiredCookies() {
289: LOG.trace("enter HttpState.purgeExpiredCookies()");
290: return purgeExpiredCookies(new Date());
291: }
292:
293: /**
294: * Removes all of {@link Cookie cookies} in this HTTP state
295: * that have expired by the specified {@link java.util.Date date}.
296: *
297: * @param date The {@link java.util.Date date} to compare against.
298: *
299: * @return true if any cookies were purged.
300: *
301: * @see Cookie#isExpired(java.util.Date)
302: *
303: * @see #purgeExpiredCookies()
304: */
305: public synchronized boolean purgeExpiredCookies(Date date) {
306: LOG.trace("enter HttpState.purgeExpiredCookies(Date)");
307: // BEGIN IA CHANGES
308: // PRIOR IMPL & COMPARISON HARNESS LEFT COMMENTED OUT FOR TEMPORARY REFERENCE
309: // boolean arrayRemoved = false;
310: // Iterator ita = cookiesArrayList.iterator();
311: // while (ita.hasNext()) {
312: // if (((Cookie) (ita.next())).isExpired(date)) {
313: // ita.remove();
314: // arrayRemoved = true;
315: // }
316: // }
317: boolean removed = false;
318: Iterator it = cookiesMap.values().iterator();
319: while (it.hasNext()) {
320: if (((Cookie) (it.next())).isExpired(date)) {
321: it.remove();
322: removed = true;
323: }
324: }
325: StoredIterator.close(it);
326: // assert removed == arrayRemoved : "discrepancy"
327: // END IA CHANGES
328: return removed;
329: }
330:
331: /**
332: * Returns the current {@link CookiePolicy cookie policy} for this
333: * HTTP state.
334: *
335: * @return The {@link CookiePolicy cookie policy}.
336: *
337: * @deprecated Use
338: * {@link org.apache.commons.httpclient.params.HttpMethodParams#getCookiePolicy()},
339: * {@link HttpMethod#getParams()}.
340: */
341:
342: public int getCookiePolicy() {
343: return this .cookiePolicy;
344: }
345:
346: /**
347: * Defines whether preemptive authentication should be
348: * attempted.
349: *
350: * @param value <tt>true</tt> if preemptive authentication should be
351: * attempted, <tt>false</tt> otherwise.
352: *
353: * @deprecated Use
354: * {@link org.apache.commons.httpclient.params.HttpClientParams#setAuthenticationPreemptive(boolean)},
355: * {@link HttpClient#getParams()}.
356: */
357:
358: public void setAuthenticationPreemptive(boolean value) {
359: this .preemptive = value;
360: }
361:
362: /**
363: * Returns <tt>true</tt> if preemptive authentication should be
364: * attempted, <tt>false</tt> otherwise.
365: *
366: * @return boolean flag.
367: *
368: * @deprecated Use
369: * {@link org.apache.commons.httpclient.params.HttpClientParams#isAuthenticationPreemptive()},
370: * {@link HttpClient#getParams()}.
371: */
372:
373: public boolean isAuthenticationPreemptive() {
374: return this .preemptive;
375: }
376:
377: /**
378: * Sets the current {@link CookiePolicy cookie policy} for this HTTP
379: * state to one of the following supported policies:
380: * {@link CookiePolicy#COMPATIBILITY},
381: * {@link CookiePolicy#NETSCAPE_DRAFT} or
382: * {@link CookiePolicy#RFC2109}.
383: *
384: * @param policy new {@link CookiePolicy cookie policy}
385: *
386: * @deprecated
387: * Use {@link org.apache.commons.httpclient.params.HttpMethodParams#setCookiePolicy(String)},
388: * {@link HttpMethod#getParams()}.
389: */
390:
391: public void setCookiePolicy(int policy) {
392: this .cookiePolicy = policy;
393: }
394:
395: /**
396: * Sets the {@link Credentials credentials} for the given authentication
397: * realm on the given host. The <code>null</code> realm signifies default
398: * credentials for the given host, which should be used when no
399: * {@link Credentials credentials} have been explictly supplied for the
400: * challenging realm. The <code>null</code> host signifies default
401: * credentials, which should be used when no {@link Credentials credentials}
402: * have been explictly supplied for the challenging host. Any previous
403: * credentials for the given realm on the given host will be overwritten.
404: *
405: * @param realm the authentication realm
406: * @param host the host the realm belongs to
407: * @param credentials the authentication {@link Credentials credentials}
408: * for the given realm.
409: *
410: * @see #getCredentials(String, String)
411: * @see #setProxyCredentials(String, String, Credentials)
412: *
413: * @deprecated use #setCredentials(AuthScope, Credentials)
414: */
415:
416: public synchronized void setCredentials(String realm, String host,
417: Credentials credentials) {
418: LOG
419: .trace("enter HttpState.setCredentials(String, String, Credentials)");
420: credMap.put(new AuthScope(host, AuthScope.ANY_PORT, realm,
421: AuthScope.ANY_SCHEME), credentials);
422: }
423:
424: /**
425: * Sets the {@link Credentials credentials} for the given authentication
426: * scope. Any previous credentials for the given scope will be overwritten.
427: *
428: * @param authscope the {@link AuthScope authentication scope}
429: * @param credentials the authentication {@link Credentials credentials}
430: * for the given scope.
431: *
432: * @see #getCredentials(AuthScope)
433: * @see #setProxyCredentials(AuthScope, Credentials)
434: *
435: * @since 3.0
436: */
437: public synchronized void setCredentials(final AuthScope authscope,
438: final Credentials credentials) {
439: if (authscope == null) {
440: throw new IllegalArgumentException(
441: "Authentication scope may not be null");
442: }
443: LOG
444: .trace("enter HttpState.setCredentials(AuthScope, Credentials)");
445: credMap.put(authscope, credentials);
446: }
447:
448: /**
449: * Find matching {@link Credentials credentials} for the given authentication scope.
450: *
451: * @param map the credentials hash map
452: * @param token the {@link AuthScope authentication scope}
453: * @return the credentials
454: *
455: */
456: private static Credentials matchCredentials(final HashMap map,
457: final AuthScope authscope) {
458: // see if we get a direct hit
459: Credentials creds = (Credentials) map.get(authscope);
460: if (creds == null) {
461: // Nope.
462: // Do a full scan
463: int bestMatchFactor = -1;
464: AuthScope bestMatch = null;
465: Iterator items = map.keySet().iterator();
466: while (items.hasNext()) {
467: AuthScope current = (AuthScope) items.next();
468: int factor = authscope.match(current);
469: if (factor > bestMatchFactor) {
470: bestMatchFactor = factor;
471: bestMatch = current;
472: }
473: }
474: if (bestMatch != null) {
475: creds = (Credentials) map.get(bestMatch);
476: }
477: }
478: return creds;
479: }
480:
481: /**
482: * Get the {@link Credentials credentials} for the given authentication scope on the
483: * given host.
484: *
485: * If the <i>realm</i> exists on <i>host</i>, return the coresponding credentials.
486: * If the <i>host</i> exists with a <tt>null</tt> <i>realm</i>, return the corresponding
487: * credentials.
488: * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
489: * corresponding credentials. If the <i>realm</i> does not exist, return
490: * the default Credentials. If there are no default credentials, return
491: * <code>null</code>.
492: *
493: * @param realm the authentication realm
494: * @param host the host the realm is on
495: * @return the credentials
496: *
497: * @see #setCredentials(String, String, Credentials)
498: *
499: * @deprecated use #getCredentials(AuthScope)
500: */
501:
502: public synchronized Credentials getCredentials(String realm,
503: String host) {
504: LOG.trace("enter HttpState.getCredentials(String, String");
505: return matchCredentials(this .credMap, new AuthScope(host,
506: AuthScope.ANY_PORT, realm, AuthScope.ANY_SCHEME));
507: }
508:
509: /**
510: * Get the {@link Credentials credentials} for the given authentication scope.
511: *
512: * @param authscope the {@link AuthScope authentication scope}
513: * @return the credentials
514: *
515: * @see #setCredentials(AuthScope, Credentials)
516: *
517: * @since 3.0
518: */
519: public synchronized Credentials getCredentials(
520: final AuthScope authscope) {
521: if (authscope == null) {
522: throw new IllegalArgumentException(
523: "Authentication scope may not be null");
524: }
525: LOG.trace("enter HttpState.getCredentials(AuthScope)");
526: return matchCredentials(this .credMap, authscope);
527: }
528:
529: /**
530: * Sets the {@link Credentials credentials} for the given proxy authentication
531: * realm on the given proxy host. The <code>null</code> proxy realm signifies
532: * default credentials for the given proxy host, which should be used when no
533: * {@link Credentials credentials} have been explictly supplied for the
534: * challenging proxy realm. The <code>null</code> proxy host signifies default
535: * credentials, which should be used when no {@link Credentials credentials}
536: * have been explictly supplied for the challenging proxy host. Any previous
537: * credentials for the given proxy realm on the given proxy host will be
538: * overwritten.
539: *
540: * @param realm the authentication realm
541: * @param proxyHost the proxy host
542: * @param credentials the authentication credentials for the given realm
543: *
544: * @see #getProxyCredentials(AuthScope)
545: * @see #setCredentials(AuthScope, Credentials)
546: *
547: * @deprecated use #setProxyCredentials(AuthScope, Credentials)
548: */
549: public synchronized void setProxyCredentials(String realm,
550: String proxyHost, Credentials credentials) {
551: LOG
552: .trace("enter HttpState.setProxyCredentials(String, String, Credentials");
553: proxyCred.put(new AuthScope(proxyHost, AuthScope.ANY_PORT,
554: realm, AuthScope.ANY_SCHEME), credentials);
555: }
556:
557: /**
558: * Sets the {@link Credentials proxy credentials} for the given authentication
559: * realm. Any previous credentials for the given realm will be overwritten.
560: *
561: * @param authscope the {@link AuthScope authentication scope}
562: * @param credentials the authentication {@link Credentials credentials}
563: * for the given realm.
564: *
565: * @see #getProxyCredentials(AuthScope)
566: * @see #setCredentials(AuthScope, Credentials)
567: *
568: * @since 3.0
569: */
570: public synchronized void setProxyCredentials(
571: final AuthScope authscope, final Credentials credentials) {
572: if (authscope == null) {
573: throw new IllegalArgumentException(
574: "Authentication scope may not be null");
575: }
576: LOG
577: .trace("enter HttpState.setProxyCredentials(AuthScope, Credentials)");
578: proxyCred.put(authscope, credentials);
579: }
580:
581: /**
582: * Get the {@link Credentials credentials} for the proxy host with the given
583: * authentication scope.
584: *
585: * If the <i>realm</i> exists on <i>host</i>, return the coresponding credentials.
586: * If the <i>host</i> exists with a <tt>null</tt> <i>realm</i>, return the corresponding
587: * credentials.
588: * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
589: * corresponding credentials. If the <i>realm</i> does not exist, return
590: * the default Credentials. If there are no default credentials, return
591: * <code>null</code>.
592: *
593: * @param realm the authentication realm
594: * @param proxyHost the proxy host the realm is on
595: * @return the credentials
596: * @see #setProxyCredentials(String, String, Credentials)
597: *
598: * @deprecated use #getProxyCredentials(AuthScope)
599: */
600: public synchronized Credentials getProxyCredentials(String realm,
601: String proxyHost) {
602: LOG.trace("enter HttpState.getCredentials(String, String");
603: return matchCredentials(this .proxyCred, new AuthScope(
604: proxyHost, AuthScope.ANY_PORT, realm,
605: AuthScope.ANY_SCHEME));
606: }
607:
608: /**
609: * Get the {@link Credentials proxy credentials} for the given authentication scope.
610: *
611: * @param authscope the {@link AuthScope authentication scope}
612: * @return the credentials
613: *
614: * @see #setProxyCredentials(AuthScope, Credentials)
615: *
616: * @since 3.0
617: */
618: public synchronized Credentials getProxyCredentials(
619: final AuthScope authscope) {
620: if (authscope == null) {
621: throw new IllegalArgumentException(
622: "Authentication scope may not be null");
623: }
624: LOG.trace("enter HttpState.getProxyCredentials(AuthScope)");
625: return matchCredentials(this .proxyCred, authscope);
626: }
627:
628: /**
629: * Returns a string representation of this HTTP state.
630: *
631: * @return The string representation of the HTTP state.
632: *
633: * @see java.lang.Object#toString()
634: */
635: public synchronized String toString() {
636: StringBuffer sbResult = new StringBuffer();
637:
638: sbResult.append("[");
639: sbResult.append(getCredentialsStringRepresentation(proxyCred));
640: sbResult.append(" | ");
641: sbResult.append(getCredentialsStringRepresentation(credMap));
642: sbResult.append(" | ");
643: sbResult.append(getCookiesStringRepresentation(cookiesMap
644: .values()));
645: sbResult.append("]");
646:
647: String strResult = sbResult.toString();
648:
649: return strResult;
650: }
651:
652: /**
653: * Returns a string representation of the credentials.
654: * @param credMap The credentials.
655: * @return The string representation.
656: */
657: private static String getCredentialsStringRepresentation(
658: final Map credMap) {
659: StringBuffer sbResult = new StringBuffer();
660: Iterator iter = credMap.keySet().iterator();
661: while (iter.hasNext()) {
662: Object key = iter.next();
663: Credentials cred = (Credentials) credMap.get(key);
664: if (sbResult.length() > 0) {
665: sbResult.append(", ");
666: }
667: sbResult.append(key);
668: sbResult.append("#");
669: sbResult.append(cred.toString());
670: }
671: return sbResult.toString();
672: }
673:
674: /**
675: * Returns a string representation of the cookies.
676: * @param cookies The cookies
677: * @return The string representation.
678: */
679: private static String getCookiesStringRepresentation(
680: final Collection cookies) {
681: StringBuffer sbResult = new StringBuffer();
682: Iterator iter = cookies.iterator();
683: while (iter.hasNext()) {
684: Cookie ck = (Cookie) iter.next();
685: if (sbResult.length() > 0) {
686: sbResult.append("#");
687: }
688: sbResult.append(ck.toExternalForm());
689: }
690: return sbResult.toString();
691: }
692:
693: /**
694: * Clears all credentials.
695: */
696: public void clearCredentials() {
697: this .credMap.clear();
698: }
699:
700: /**
701: * Clears all proxy credentials.
702: */
703: public void clearProxyCredentials() {
704: this .proxyCred.clear();
705: }
706:
707: /**
708: * Clears all cookies.
709: */
710: public void clearCookies() {
711: // BEGIN IA CHANGES
712: // this.cookiesArrayList.clear();
713: this .cookiesMap.clear();
714: // END IA CHANGES
715: }
716:
717: /**
718: * Clears the state information (all cookies, credentials and proxy credentials).
719: */
720: public void clear() {
721: clearCookies();
722: clearCredentials();
723: clearProxyCredentials();
724: }
725: }
|