1 /*
2 * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java,v 1.22 2003/05/08 18:39:07 olegk Exp $
3 * $Revision: 1.22 $
4 * $Date: 2003/05/08 18:39:07 $
5 *
6 * ====================================================================
7 *
8 * The Apache Software License, Version 1.1
9 *
10 * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
11 * reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 *
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in
22 * the documentation and/or other materials provided with the
23 * distribution.
24 *
25 * 3. The end-user documentation included with the redistribution, if
26 * any, must include the following acknowlegement:
27 * "This product includes software developed by the
28 * Apache Software Foundation (http://www.apache.org/)."
29 * Alternately, this acknowlegement may appear in the software itself,
30 * if and wherever such third-party acknowlegements normally appear.
31 *
32 * 4. The names "The Jakarta Project", "Commons", and "Apache Software
33 * Foundation" must not be used to endorse or promote products derived
34 * from this software without prior written permission. For written
35 * permission, please contact apache@apache.org.
36 *
37 * 5. Products derived from this software may not be called "Apache"
38 * nor may "Apache" appear in their names without prior written
39 * permission of the Apache Group.
40 *
41 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
42 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
43 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
44 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
45 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
47 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
48 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
49 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
51 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 * ====================================================================
54 *
55 * This software consists of voluntary contributions made by many
56 * individuals on behalf of the Apache Software Foundation. For more
57 * information on the Apache Software Foundation, please see
58 * <http://www.apache.org/>.
59 *
60 * [Additional notices, if required by prior licensing conditions]
61 *
62 */
63
64 package org.apache.commons.httpclient;
65
66 import java.util.ArrayList;
67 import java.util.Date;
68 import java.util.HashMap;
69 import java.util.Map;
70 import java.util.List;
71 import java.util.Iterator;
72 import org.apache.commons.httpclient.cookie.CookieSpec;
73 import org.apache.commons.httpclient.cookie.CookiePolicy;
74 import org.apache.commons.httpclient.auth.HttpAuthRealm;
75 import org.apache.commons.logging.Log;
76 import org.apache.commons.logging.LogFactory;
77
78 /***
79 * <p>
80 * A container for HTTP attributes that may persist from request
81 * to request, such as {@link Cookie}s and authentication
82 * {@link Credentials}.
83 * </p>
84 * <p>
85 * Preemptive authentication can be turned on by using the property value of
86 * #PREEMPTIVE_PROPERTY. If left unspecified, it has the default value of
87 * #PREEMPTIVE_DEFAULT. This configurable behaviour conforms to rcf2617:
88 * </p>
89 *
90 * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
91 * @author Rodney Waldhoff
92 * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
93 * @author Sean C. Sullivan
94 * @author <a href="mailto:becke@u.washington.edu">Michael Becke</a>
95 * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
96 * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
97 * @author <a href="mailto:adrian@intencha.com">Adrian Sutton</a>
98 *
99 * @version $Revision: 1.22 $ $Date: 2003/05/08 18:39:07 $
100 *
101 */
102 public class HttpState {
103
104 // ----------------------------------------------------- Instance Variables
105
106 /***
107 * Whether I should attempt to authenticate preemptively.
108 */
109 private boolean preemptive;
110
111 /***
112 * The boolean property name to turn on preemptive authentication.
113 */
114 public static final String PREEMPTIVE_PROPERTY =
115 "httpclient.authentication.preemptive";
116
117 /***
118 * The default property value for #PREEMPTIVE_PROPERTY.
119 */
120 public static final String PREEMPTIVE_DEFAULT = "false";
121
122 /***
123 * My {@link Credentials Credentials}s, by realm.
124 */
125 private HashMap credMap = new HashMap();
126
127 /***
128 * My proxy {@link Credentials Credentials}, by realm.
129 */
130 private HashMap proxyCred = new HashMap();
131
132 /***
133 * The default authentication realm.
134 */
135 public static final HttpAuthRealm DEFAULT_AUTH_REALM = new HttpAuthRealm(null, null);
136
137 /***
138 * My {@link Cookie Cookie}s.
139 */
140 private ArrayList cookies = new ArrayList();
141 /***
142 * My cookie policy. Default is {@link CookiePolicy.RFC2109}
143 */
144 private int cookiePolicy = CookiePolicy.RFC2109;
145
146 /*** The current connection manager */
147 private HttpConnectionManager httpConnectionManager;
148
149 // -------------------------------------------------------- Class Variables
150
151 /*** Log object for this class. */
152 private static final Log LOG = LogFactory.getLog(HttpState.class);
153
154 /***
155 * Constructor for HttpState.
156 */
157 public HttpState() {
158
159 super();
160
161 this.cookiePolicy = CookiePolicy.getDefaultPolicy();
162
163 // check the preemptive policy
164 // TODO: this needs to be a service from some configuration class
165 String preemptiveDefault =
166 System.getProperties().getProperty(PREEMPTIVE_PROPERTY,
167 PREEMPTIVE_DEFAULT);
168 preemptiveDefault = preemptiveDefault.trim().toLowerCase();
169
170 if (!(preemptiveDefault.equals("true")
171 || preemptiveDefault.equals("false"))) { // property problem
172 LOG.warn("Configuration property " + PREEMPTIVE_PROPERTY
173 + " must be either true or false. Using default: "
174 + PREEMPTIVE_DEFAULT);
175 preemptiveDefault = PREEMPTIVE_DEFAULT;
176 }
177 this.preemptive = ("true".equals(preemptiveDefault));
178 }
179
180 // ------------------------------------------------------------- Properties
181
182 /***
183 * Add a cookie.
184 * If the given <i>cookie</i> has already expired,
185 * deletes the corresponding existing cookie (if any).
186 *
187 * @param cookie the {@link Cookie} to add
188 *
189 * @see #addCookies(Cookie[])
190 *
191 */
192 public synchronized void addCookie(Cookie cookie) {
193 LOG.trace("enter HttpState.addCookie(Cookie)");
194
195 if (cookie != null) {
196 // first remove any old cookie that is equivalent
197 for (Iterator it = cookies.iterator(); it.hasNext();) {
198 Cookie tmp = (Cookie) it.next();
199 if (cookie.equals(tmp)) {
200 it.remove();
201 break;
202 }
203 }
204 if (!cookie.isExpired()) {
205 cookies.add(cookie);
206 }
207 }
208 }
209
210 /***
211 * Add zero or more cookies
212 * If any given <i>cookie</i> has already expired,
213 * deletes the corresponding existing cookie (if any).
214 *
215 * @param newcookies the {@link Cookie}s to add
216 *
217 * @see #addCookie(Cookie)
218 *
219 *
220 */
221 public synchronized void addCookies(Cookie[] newcookies) {
222 LOG.trace("enter HttpState.addCookies(Cookie[])");
223
224 if (newcookies != null) {
225 for (int i = 0; i < newcookies.length; i++) {
226 this.addCookie(newcookies[i]);
227 }
228 }
229 }
230
231 /***
232 * Obtain an array of my {@link Cookie}s.
233 *
234 * @return an array of my {@link Cookie}s.
235 *
236 * @see #getCookies(String, int, String, boolean, java.util.Date)
237 *
238 */
239 public synchronized Cookie[] getCookies() {
240 LOG.trace("enter HttpState.getCookies()");
241 return (Cookie[]) (cookies.toArray(new Cookie[cookies.size()]));
242 }
243
244 /***
245 * Obtain an array of my {@link Cookie}s that
246 * match the given request parameters.
247 *
248 * @param domain the request domain
249 * @param port the request port
250 * @param path the request path
251 * @param secure <code>true</code> when using HTTPS
252 * @param now the {@link Date} by which expiration is determined
253 * @return an array of my {@link Cookie}s.
254 *
255 * @see Cookie#matches
256 * @see #getCookies()
257 *
258 * @deprecated use HttpState.getCookies(String, int, String, boolean)
259 */
260 public synchronized Cookie[] getCookies(
261 String domain,
262 int port,
263 String path,
264 boolean secure,
265 Date now
266 ) {
267 return getCookies(domain, port, path, secure);
268 }
269
270
271 /***
272 * Obtain an array of my {@link Cookie}s that
273 * match the given request parameters.
274 *
275 * @param domain the request domain
276 * @param port the request port
277 * @param path the request path
278 * @param secure <code>true</code> when using HTTPS
279 * @return an array of my {@link Cookie}s.
280 *
281 * @see Cookie#matches
282 * @see #getCookies()
283 *
284 */
285 public synchronized Cookie[] getCookies(
286 String domain,
287 int port,
288 String path,
289 boolean secure
290 ) {
291 LOG.trace("enter HttpState.getCookies(String, int, String, boolean)");
292
293 CookieSpec matcher = CookiePolicy.getDefaultSpec();
294 ArrayList list = new ArrayList(cookies.size());
295 for (int i = 0, m = cookies.size(); i < m; i++) {
296 Cookie cookie = (Cookie) (cookies.get(i));
297 if (matcher.match(domain, port, path, secure, cookie)) {
298 list.add(cookie);
299 }
300 }
301 return (Cookie[]) (list.toArray(new Cookie[list.size()]));
302 }
303
304 /***
305 * Remove all of my {@link Cookie}s that
306 * have expired according to the current
307 * system time.
308 *
309 * @see #purgeExpiredCookies(java.util.Date)
310 *
311 */
312 public synchronized boolean purgeExpiredCookies() {
313 LOG.trace("enter HttpState.purgeExpiredCookies()");
314 return purgeExpiredCookies(new Date());
315 }
316
317 /***
318 * Remove all of my {@link Cookie}s that have expired by the specified
319 * <i>date</i>.
320 *
321 * @param date The date to compare against.
322 * @return true if any cookies were purged.
323 * @see Cookie#isExpired(java.util.Date)
324 * @see #purgeExpiredCookies()
325 */
326 public synchronized boolean purgeExpiredCookies(Date date) {
327 LOG.trace("enter HttpState.purgeExpiredCookies(Date)");
328 boolean removed = false;
329 Iterator it = cookies.iterator();
330 while (it.hasNext()) {
331 if (((Cookie) (it.next())).isExpired(date)) {
332 it.remove();
333 removed = true;
334 }
335 }
336 return removed;
337 }
338
339
340 /***
341 * Return the current {@link CookiePolicy}
342 * @return The cookie policy.
343 */
344
345 public int getCookiePolicy() {
346 return this.cookiePolicy;
347 }
348
349
350 /***
351 * Defines whether preemptive authentication should be
352 * attempted or not.
353 *
354 * @param value boolean flag
355 */
356
357 public void setAuthenticationPreemptive(boolean value) {
358 this.preemptive = value;
359 }
360
361
362 /***
363 * Return <tt>true</tt> if preemptive authentication should be
364 * attempted, otherwise return <tt>false</tt>
365 *
366 * @return boolean flag.
367 */
368
369 public boolean isAuthenticationPreemptive() {
370 return this.preemptive;
371 }
372
373
374 /***
375 * Set the {@link CookiePolicy} to one of {@link
376 * CookiePolicy#COMPATIBILITY}, {@link CookiePolicy#NETSCAPE_DRAFT} or
377 * {@link CookiePolicy#RFC2109}
378 * @param policy new cookie policy
379 */
380
381 public void setCookiePolicy(int policy) {
382 this.cookiePolicy = policy;
383 }
384
385 /***
386 * Set the Credentials for the given authentication realm.
387 *
388 * When <i>realm</i> is <code>null</code>, I'll use the given
389 * <i>credentials</i> when no other {@link Credentials} have
390 * been supplied for the given challenging realm.
391 * (I.e., use a <code>null</code> realm to set the "default"
392 * credentials.)
393 * <p>
394 * Any previous credentials for this realm will be overwritten.
395 *
396 * @deprecated This method does not distinguish between realms with the
397 * same name on different hosts. Use
398 * {@link HttpState#setCredentials(String, Credentials)} instead.
399 *
400 * @param realm the authentication realm
401 * @param credentials the authentication credentials for the given realm
402 *
403 * @see #getCredentials(String, String)
404 * @see #setProxyCredentials(String, String, Credentials)
405 *
406 */
407
408 public synchronized void setCredentials(String realm, Credentials credentials) {
409 LOG.trace("enter HttpState.setCredentials(String, Credentials)");
410 setCredentials(realm, null, credentials);
411 }
412
413 /*** Sets the credentials for <tt>realm</tt> on <tt>host</tt>.
414 * with no host.
415 *
416 * When <i>realm</i> is <code>null</code>, I'll use the given
417 * <i>credentials</i> when no other {@link Credentials} have
418 * been supplied for the given challenging realm.
419 * (I.e., use a <code>null</code> realm to set the "default"
420 * credentials.)
421 * <p>
422 * Any previous credentials for this realm will be overwritten.
423 *
424 * @param realm the authentication realm
425 * @param host the host the realm belongs to
426 * @param credentials the authentication credentials for the given realm.
427 *
428 * @see #getCredentials(String, String)
429 * @see #setProxyCredentials(String, String, Credentials)
430 */
431
432 public synchronized void setCredentials(String realm, String host, Credentials credentials) {
433 LOG.trace(
434 "enter HttpState.setCredentials(String realm, String host, Credentials credentials)");
435 credMap.put(new HttpAuthRealm(host, realm), credentials);
436 }
437
438
439 /***
440 * Find matching credentials for the given authentication realm and host.
441 *
442 * If the <i>realm</i> exists on <i>host</i>, return the coresponding credentials.
443 * If the <i>host</i> exists with a <tt>null</tt> <i>realm</i>, return the corresponding
444 * credentials.
445 * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
446 * corresponding credentials. If the <i>realm</i> does not exist, return
447 * the default Credentials. If there are no default credentials, return
448 * <code>null</code>.
449 *
450 * @param map the credentials hash map
451 * @param realm the authentication realm
452 * @param host the host the realm is on
453 * @return the credentials
454 *
455 */
456 private static Credentials matchCredentials(HashMap map, String realm, String host) {
457 HttpAuthRealm entry = new HttpAuthRealm(host, realm);
458 Credentials creds = (Credentials) map.get(entry);
459 if (creds == null && host != null && realm != null) {
460 entry = new HttpAuthRealm(host, null);
461 creds = (Credentials) map.get(entry);
462 if (creds == null) {
463 entry = new HttpAuthRealm(null, realm);
464 creds = (Credentials) map.get(entry);
465 }
466 }
467 if (creds == null) {
468 creds = (Credentials) map.get(DEFAULT_AUTH_REALM);
469 }
470 return creds;
471 }
472
473 /***
474 * Get the Credentials for the given authentication realm.
475 *
476 * If the <i>realm</i> exists on <i>host</i>, return the coresponding credentials.
477 * If the <i>host</i> exists with a <tt>null</tt> <i>realm</i>, return the corresponding
478 * credentials.
479 * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
480 * corresponding credentials. If the <i>realm</i> does not exist, return
481 * the default Credentials. If there are no default credentials, return
482 * <code>null</code>.
483 *
484 * @param realm the authentication realm
485 * @param host the host the realm is on
486 * @return the credentials
487 *
488 * @see #setCredentials(String, String, Credentials)
489 *
490 */
491
492 public synchronized Credentials getCredentials(String realm, String host) {
493 LOG.trace("enter HttpState.getCredentials(String, String");
494 return matchCredentials(this.credMap, realm, host);
495 }
496
497 /***
498 * Get the Credentials for the given authentication realm.
499 *
500 * If the <i>realm</i> exists on <i>host</i>, return the coresponding credentials.
501 * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
502 * corresponding credentials. If the <i>realm</i> does not exist, return
503 * the default Credentials. If there is no default credentials, return
504 * <code>null</code>.
505 *
506 * @deprecated This method does not distinguish between realms on different
507 * servers with the same name. Use {@link #getCredentials(String, String)}
508 * instead.
509 *
510 * @param realm the authentication realm
511 * @return the credentials
512 *
513 * @see #setCredentials(String, String, Credentials)
514 *
515 */
516
517 public synchronized Credentials getCredentials(String realm) {
518 LOG.trace("enter HttpState.getCredentials(String)");
519
520 return getCredentials(realm, null);
521 }
522
523 /***
524 * Set the for the proxy with the given authentication realm.
525 *
526 * When <i>realm</i> is <code>null</code>, I'll use the given
527 * <i>credentials</i> when no other {@link Credentials} have
528 * been supplied for the given challenging realm.
529 * (I.e., use a <code>null</code> realm to set the "default"
530 * credentials.) Realms rarely make much sense with proxies, so
531 * <code>null</code> is normally a good choice here.
532 * <p>
533 * Any previous credentials for this realm will be overwritten.
534 *
535 * @deprecated This method does not differentiate between realms with
536 * the same name on different servers. Use
537 * {@link #setProxyCredentials(String, String, Credentials)} instead.
538 *
539 * @param realm the authentication realm
540 * @param credentials the authentication credentials for the given realm
541 *
542 * @see #getProxyCredentials(String)
543 * @see #setCredentials(String, Credentials)
544 *
545 */
546
547 public synchronized void setProxyCredentials(String realm, Credentials credentials) {
548 LOG.trace("enter HttpState.setProxyCredentials(String, credentials)");
549 setProxyCredentials(realm, null, credentials);
550 }
551
552 /***
553 * Set the credentials for the proxy with the given authentication realm.
554 *
555 * When <i>realm</i> and <i>proxyHost</i> are <code>null</code>, I'll use the given
556 * <i>credentials</i> when no other {@link Credentials} have
557 * been supplied for the given challenging realm.
558 * (I.e., use a <code>null</code> realm to set the "default"
559 * credentials.) Realms rarely make much sense with proxies, so
560 * <code>null</code> is normally a good choice here.
561 * <p>
562 * Any previous credentials for this realm will be overwritten.
563 *
564 * @param realm the authentication realm
565 * @param proxyHost the proxy host
566 * @param credentials the authentication credentials for the given realm
567 *
568 * @see #getProxyCredentials(String)
569 * @see #setCredentials(String, Credentials)
570 *
571 */
572 public synchronized void setProxyCredentials(
573 String realm,
574 String proxyHost,
575 Credentials credentials
576 ) {
577 LOG.trace("enter HttpState.setProxyCredentials(String, String, Credentials");
578 proxyCred.put(new HttpAuthRealm(proxyHost, realm), credentials);
579 }
580
581 /***
582 * Get the Credentials for the proxy with the given authentication realm.
583 *
584 * If the <i>realm</i> exists, return the coresponding credentials. If the
585 * <i>realm</i> does not exist, return the default Credentials. If there is
586 * no default credentials, return <code>null</code>.
587 *
588 * @deprecated This method does not distinguish between realms on different hosts.
589 * Use {@link #getProxyCredentials(String, String)} instead.
590 *
591 * @param realm the authentication realm
592 * @return the credentials
593 * @see #setProxyCredentials(String, String, Credentials)
594 */
595
596 public synchronized Credentials getProxyCredentials(String realm) {
597 LOG.trace("enter HttpState.getProxyCredentials(String)");
598 return getProxyCredentials(realm, null);
599 }
600
601 /***
602 * Get the Credentials for the proxy with the given authentication realm on the given
603 * <i>host</i>.
604 *
605 * If the <i>realm</i> exists on <i>host</i>, return the coresponding credentials.
606 * If the <i>host</i> exists with a <tt>null</tt> <i>realm</i>, return the corresponding
607 * credentials.
608 * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
609 * corresponding credentials. If the <i>realm</i> does not exist, return
610 * the default Credentials. If there are no default credentials, return
611 * <code>null</code>.
612 *
613 * @param realm the authentication realm
614 * @param proxyHost the proxy host the realm is on
615 * @return the credentials
616 * @see #setProxyCredentials(String, String, Credentials)
617 */
618 public synchronized Credentials getProxyCredentials(String realm, String proxyHost) {
619 LOG.trace("enter HttpState.getCredentials(String, String");
620 return matchCredentials(this.proxyCred, realm, proxyHost);
621 }
622
623 /***
624 * Return a string representation of this object.
625 * @return The string representation.
626 * @see java.lang.Object#toString()
627 */
628 public synchronized String toString() {
629 StringBuffer sbResult = new StringBuffer();
630
631 sbResult.append("[");
632 sbResult.append(getProxyCredentialsStringRepresentation(proxyCred));
633 sbResult.append(" | ");
634 sbResult.append(getCredentialsStringRepresentation(proxyCred));
635 sbResult.append(" | ");
636 sbResult.append(getCookiesStringRepresentation(cookies));
637 sbResult.append("]");
638
639 String strResult = sbResult.toString();
640
641 return strResult;
642 }
643
644 /***
645 * Return a string representation of the proxy credentials
646 * @param proxyCredMap The proxy credentials
647 * @return StringBuffer The string representation.
648 */
649 private static StringBuffer getProxyCredentialsStringRepresentation(final Map proxyCredMap) {
650 StringBuffer sbResult = new StringBuffer();
651 Iterator iter = proxyCredMap.keySet().iterator();
652 while (iter.hasNext()) {
653 Object key = iter.next();
654 Credentials cred = (Credentials) proxyCredMap.get(key);
655 if (sbResult.length() > 0) {
656 sbResult.append(", ");
657 }
658 sbResult.append(key);
659 sbResult.append("#");
660 sbResult.append(cred.toString());
661 }
662 return sbResult;
663 }
664
665 /***
666 * Return a string representation of the credentials.
667 * @param credMap The credentials.
668 * @return StringBuffer The string representation.
669 */
670 private static StringBuffer getCredentialsStringRepresentation(final Map credMap) {
671 StringBuffer sbResult = new StringBuffer();
672 Iterator iter = credMap.keySet().iterator();
673 while (iter.hasNext()) {
674 Object key = iter.next();
675 Credentials cred = (Credentials) credMap.get(key);
676 if (sbResult.length() > 0) {
677 sbResult.append(", ");
678 }
679 sbResult.append(key);
680 sbResult.append("#");
681 sbResult.append(cred.toString());
682 }
683 return sbResult;
684 }
685
686 /***
687 * Return a string representation of the cookies.
688 * @param cookies The cookies
689 * @return StringBuffer The string representation.
690 */
691 private static StringBuffer getCookiesStringRepresentation(final List cookies) {
692 StringBuffer sbResult = new StringBuffer();
693 Iterator iter = cookies.iterator();
694 while (iter.hasNext()) {
695 Cookie ck = (Cookie) iter.next();
696 if (sbResult.length() > 0) {
697 sbResult.append("#");
698 }
699 sbResult.append(ck.toExternalForm());
700 }
701 return sbResult;
702 }
703
704 /***
705 * Returns the httpConnectionManager.
706 * @return HttpConnectionManager
707 *
708 * @deprecated Connection manager is controlled by the HttpClient class.
709 * Use {@link HttpClient#getHttpConnectionManager()} instead.
710 *
711 * @since 2.0
712 */
713 public synchronized HttpConnectionManager getHttpConnectionManager() {
714 return httpConnectionManager;
715 }
716
717 /***
718 * Sets the httpConnectionManager.
719 * @param httpConnectionManager The httpConnectionManager to set
720 *
721 * @deprecated Connection manager is controlled by the HttpClient class.
722 * Use {@link HttpClient#setHttpConnectionManager(HttpConnectionManager)} instead.
723 *
724 * @since 2.0
725 */
726 public synchronized void setHttpConnectionManager(
727 HttpConnectionManager httpConnectionManager
728 ) {
729 this.httpConnectionManager = httpConnectionManager;
730 }
731 }
This page was automatically generated by Maven