1 /*
2 * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v 1.76.2.2 2003/10/11 19:44:27 olegk Exp $
3 * $Revision: 1.76.2.2 $
4 * $Date: 2003/10/11 19:44:27 $
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.io.IOException;
67 import java.net.URL;
68 import java.security.Security;
69 import java.security.Provider;
70
71 import org.apache.commons.httpclient.protocol.Protocol;
72 import org.apache.commons.logging.Log;
73 import org.apache.commons.logging.LogFactory;
74
75
76 /***
77 * <p>
78 * An HTTP "user-agent", containing an {@link HttpState HTTP state} and
79 * one or more {@link HttpConnection HTTP connections}, to which
80 * {@link HttpMethod HTTP methods} can be applied.
81 * </p>
82 * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
83 * @author <a href="mailto:rwaldhoff@apache.org">Rodney Waldhoff</a>
84 * @author Sean C. Sullivan
85 * @author <a href="mailto:dion@apache.org">dIon Gillard</a>
86 * @author Ortwin Gl�ck
87 * @author <a href="mailto:becke@u.washington.edu">Michael Becke</a>
88 * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
89 * @author Sam Maloney
90 * @author Laura Werner
91 * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
92 *
93 * @version $Revision: 1.76.2.2 $ $Date: 2003/10/11 19:44:27 $
94 */
95 public class HttpClient {
96
97
98 // -------------------------------------------------------------- Constants
99
100 /*** Log object for this class. */
101 private static final Log LOG = LogFactory.getLog(HttpClient.class);
102
103 static {
104 if (LOG.isDebugEnabled()) {
105 try {
106 LOG.debug("Java version: " + System.getProperty("java.version"));
107 LOG.debug("Java vendor: " + System.getProperty("java.vendor"));
108 LOG.debug("Java class path: " + System.getProperty("java.class.path"));
109 LOG.debug("Operating system name: " + System.getProperty("os.name"));
110 LOG.debug("Operating system architecture: " + System.getProperty("os.arch"));
111 LOG.debug("Operating system version: " + System.getProperty("os.version"));
112
113 Provider[] providers = Security.getProviders();
114 for (int i = 0; i < providers.length; i++) {
115 Provider provider = providers[i];
116 LOG.debug(provider.getName() + " " + provider.getVersion()
117 + ": " + provider.getInfo());
118 }
119 } catch(SecurityException ignore) {
120 }
121 }
122 }
123 // ----------------------------------------------------------- Constructors
124
125 /***
126 * Creates an instance of HttpClient using a
127 * {@link SimpleHttpConnectionManager simple HTTP connection manager}.
128 *
129 * @see SimpleHttpConnectionManager
130 */
131 public HttpClient() {
132 this(new SimpleHttpConnectionManager());
133 }
134
135 /***
136 * Creates an instance of HttpClient with a user specified connection manager.
137 * @param httpConnectionManager The {@link HttpConnectionManager connection manager}
138 * to use.
139 *
140 * @since 2.0
141 */
142 public HttpClient(HttpConnectionManager httpConnectionManager) {
143
144 if (httpConnectionManager == null) {
145 throw new IllegalArgumentException("httpConnectionManager cannot be null");
146 }
147
148 this.state = new HttpState();
149 this.httpConnectionManager = httpConnectionManager;
150
151 this.hostConfiguration = new HostConfiguration();
152
153 }
154
155 // ----------------------------------------------------- Instance Variables
156
157 /***
158 * The {@link HttpConnectionManager connection manager} being used to manage
159 * connections for this HttpClient
160 */
161 private HttpConnectionManager httpConnectionManager;
162
163 /***
164 * The {@link HttpState HTTP state} associated with this HttpClient.
165 */
166 private HttpState state;
167
168 /***
169 * The timout in milliseconds when waiting for a connection from the
170 * {@link HttpConnectionManager connection manager}
171 */
172 private long httpConnectionTimeout = 0;
173
174 /***
175 * The socket timeout in milliseconds.
176 */
177 private int timeoutInMilliseconds = 0;
178
179 /***
180 * The connection timeout in milliseconds.
181 */
182 private int connectionTimeout = 0;
183
184 /***
185 * The {@link HostConfiguration host configuration} associated with
186 * the HttpClient
187 */
188 private HostConfiguration hostConfiguration;
189
190 /***
191 * True if strict mode is enabled.
192 */
193 private boolean strictMode = false;
194
195 // ------------------------------------------------------------- Properties
196
197 /***
198 * Returns {@link HttpState HTTP state} associated with the HttpClient.
199 *
200 * @see #setState(HttpState)
201 * @return the shared client state
202 */
203 public synchronized HttpState getState() {
204 return state;
205 }
206
207 /***
208 * Assigns {@link HttpState HTTP state} for the HttpClient.
209 *
210 * @see #getState()
211 * @param state the new {@link HttpState HTTP state} for the client
212 */
213 public synchronized void setState(HttpState state) {
214 this.state = state;
215 }
216
217 /***
218 * Defines how strictly the method follows the HTTP protocol specification
219 * (see RFC 2616 and other relevant RFCs).
220 *
221 * In the strict mode the method precisely
222 * implements the requirements of the specification, whereas in non-strict mode
223 * it attempts to mimic the exact behaviour of commonly used HTTP agents,
224 * which many HTTP servers expect.
225 *
226 * @param strictMode <tt>true</tt> for strict mode, <tt>false</tt> otherwise
227 *
228 * @see #isStrictMode()
229 */
230 public synchronized void setStrictMode(boolean strictMode) {
231 this.strictMode = strictMode;
232 }
233
234 /***
235 * Returns the value of the strict mode flag.
236 *
237 * @return <tt>true</tt> if strict mode is enabled, <tt>false</tt> otherwise
238 *
239 * @see #setStrictMode(boolean)
240 */
241 public synchronized boolean isStrictMode() {
242 return strictMode;
243 }
244
245 /***
246 * Sets the socket timeout (<tt>SO_TIMEOUT</tt>) in milliseconds which is the
247 * timeout for waiting for data. A timeout value of zero is interpreted as an
248 * infinite timeout.
249 *
250 * @param newTimeoutInMilliseconds Timeout in milliseconds
251 */
252 public synchronized void setTimeout(int newTimeoutInMilliseconds) {
253 this.timeoutInMilliseconds = newTimeoutInMilliseconds;
254 }
255
256 /***
257 * Sets the timeout in milliseconds used when retrieving an
258 * {@link HttpConnection HTTP connection} from the
259 * {@link HttpConnectionManager HTTP connection manager}.
260 *
261 * @param timeout the timeout in milliseconds
262 *
263 * @see HttpConnectionManager#getConnection(HostConfiguration, long)
264 */
265 public synchronized void setHttpConnectionFactoryTimeout(long timeout) {
266 this.httpConnectionTimeout = timeout;
267 }
268
269 /***
270 * Sets the timeout until a connection is etablished. A timeout value of
271 * zero means the timeout is not used. The default value is zero.
272 *
273 * @param newTimeoutInMilliseconds Timeout in milliseconds.
274 *
275 * @see HttpConnection#setConnectionTimeout(int)
276 */
277 public synchronized void setConnectionTimeout(int newTimeoutInMilliseconds) {
278 this.connectionTimeout = newTimeoutInMilliseconds;
279 }
280
281 // --------------------------------------------------------- Public Methods
282
283 /***
284 * Sets the host, port and default protocol (http) to be used when executing a
285 * method.
286 *
287 * @param host the host to connect to
288 * @param port the port to connect to
289 *
290 * @see #getHostConfiguration()
291 *
292 * @deprecated use {@link HostConfiguration}
293 */
294 public void startSession(String host, int port) {
295 LOG.trace("enter HttpClient.startSession(String, int)");
296 startSession(host, port, false);
297 }
298
299 /***
300 * Sets the host, port and protocol to be used when executing a method.
301 *
302 * @param host the host to connect to
303 * @param port the port to connect to
304 * @param https when <code>true</code>, create an HTTPS session
305 *
306 * @see #getHostConfiguration()
307 *
308 * @deprecated use {@link HostConfiguration}
309 */
310 public void startSession(String host, int port, boolean https) {
311 LOG.trace("enter HttpClient.startSession(String, int, boolean)");
312
313 if (LOG.isDebugEnabled()) {
314 LOG.debug("HttpClient.startSession(String,int,boolean): Host:"
315 + host + " Port:" + port + " HTTPS:" + https);
316 }
317
318 this.hostConfiguration.setHost(host, port, https ? "https" : "http");
319 }
320
321 /***
322 * Sets the host, port, default protocol (http) and credentials to be used when
323 * executing a method.
324 *
325 * @param host the host to connect to
326 * @param port the port to connect to
327 * @param creds the default credentials to use
328 *
329 * @see #getHostConfiguration()
330 * @see #getState()
331 * @see #startSession(String, int, Credentials, boolean)
332 *
333 * @deprecated use {@link HostConfiguration} and {@link HttpState}
334 */
335 public void startSession(String host, int port, Credentials creds) {
336 LOG.trace("enter HttpClient.startSession(String, int, Credentials)");
337 startSession(host, port, creds, false);
338 }
339
340 /***
341 * Sets the host, port, protocol and credentials to be used when executing a
342 * method.
343 *
344 * @param host the host to connect to
345 * @param port the port to connect to
346 * @param creds the default credentials to use
347 * @param https when <code>true</code>, create an HTTPS session
348 *
349 * @see #getHostConfiguration()
350 * @see #getState()
351 *
352 * @deprecated use {@link HostConfiguration} and {@link HttpState}
353 */
354 public void startSession(String host, int port, Credentials creds, boolean https) {
355 LOG.trace("enter HttpClient.startSession(String, int, Credentials, boolean)");
356
357 if (LOG.isDebugEnabled()) {
358 LOG.debug(
359 "Starting HttpClient session"
360 + " Host:" + host
361 + " Port:" + port + " Credentials:" + creds
362 + " HTTPS:" + https);
363 }
364 getState().setCredentials(null, creds);
365 this.hostConfiguration.setHost(
366 host,
367 port,
368 https ? "https" : "http"
369 );
370 }
371
372 /***
373 * Sets the host, port, protocol and credentials to be used when executing a
374 * method using the server specified by the scheme, userinfo, host and port
375 * of the given <i>uri</i>.
376 * <p>
377 * Note that the path component is not utilized.
378 * <p>
379 * @param uri an <code>HttpURL</code> or <code>HttpsURL</code> instance; the
380 * {@link URI URI} from which the scheme, userinfo, host and port of the
381 * session are determined
382 *
383 * @throws IllegalStateException not enough information to process
384 * @throws URIException If the URI is bad.
385 *
386 * @see #getHostConfiguration()
387 *
388 * @deprecated use {@link HostConfiguration}
389 */
390 public void startSession(URI uri)
391 throws URIException, IllegalStateException {
392
393 LOG.trace("enter HttpClient.startSession(URI)");
394
395 String scheme = uri.getScheme();
396 if (scheme == null) { // it may a URI instance or abs_path
397 LOG.error("no scheme to start a session");
398 throw new IllegalStateException("no scheme to start a session");
399 }
400
401 Protocol protocol = Protocol.getProtocol(scheme);
402
403 String userinfo = uri.getUserinfo();
404 if (userinfo != null) {
405 getState().setCredentials(null,
406 new UsernamePasswordCredentials(userinfo));
407 }
408 String host = uri.getHost();
409 if (host == null || host.length() == 0) {
410 LOG.error("no host to start a session");
411 throw new IllegalStateException("no host to start a session");
412 }
413 int port = uri.getPort();
414 if (port == -1) { // neither HttpURL or HttpsURL instance
415 LOG.error("HttpURL or HttpsURL instance required");
416 throw new IllegalStateException
417 ("HttpURL or HttpsURL instance required");
418 }
419 this.hostConfiguration.setHost(host, null, port, protocol);
420 }
421
422 /***
423 * Sets the host, port and protocol to be used when executing a method.
424 * <p>
425 * Note that everything but the protocol, host and port of the
426 * given <i>url</i> is ignored.
427 * </p>
428 * @param url the {@link URL URL} from which the protocol, host, and port of
429 * the session are determined
430 *
431 * @exception IllegalArgumentException if the protocol is not http or https
432 *
433 * @see #getHostConfiguration()
434 *
435 * @deprecated use {@link HostConfiguration}
436 */
437 public void startSession(URL url) throws IllegalArgumentException {
438 LOG.trace("enter HttpClient.startSession(String, int, Credentials, boolean)");
439
440 int port = url.getPort();
441 Protocol protocol = Protocol.getProtocol(url.getProtocol());
442
443 hostConfiguration.setHost(url.getHost(), null, port, protocol);
444 }
445
446 /***
447 * Sets the host, port, protocol and credentials to be used when executing a
448 * method.
449 * <p>
450 * Note that everything but the protocol, host and port of the
451 * given <i>url</i> is ignored.
452 * </p>
453 * @param url the {@link URL URL} from which the protocol, host, and port of
454 * the session are determined
455 * @param creds the default credentials to use
456 *
457 * @exception IllegalArgumentException if the protocol is not http or https
458 *
459 * @see #getHostConfiguration()
460 * @see #getState()
461 *
462 * @deprecated use {@link HostConfiguration} and {@link HttpState}
463 */
464 public void startSession(URL url, Credentials creds)
465 throws IllegalArgumentException {
466
467 LOG.trace("enter HttpClient.startSession(URL, Credentials)");
468 getState().setCredentials(null, creds);
469 startSession(url);
470 }
471
472 /***
473 * Sets the host, port, protocol(http) and proxy to be used when executing a
474 * method.
475 *
476 * @param host the host to connect to
477 * @param port the port to connect to
478 * @param proxyhost the proxy host to connect via
479 * @param proxyport the proxy port to connect via
480 *
481 * @see #getHostConfiguration()
482 *
483 * @deprecated use {@link HostConfiguration}
484 */
485 public void startSession(String host, int port, String proxyhost, int proxyport) {
486 LOG.trace("enter HttpClient.startSession(String, int, String, int)");
487 startSession(host, port, proxyhost, proxyport, false);
488 }
489
490 /***
491 * Sets the host, port, protocol and proxy to be used when executing a
492 * method.
493 *
494 * @param host the host to connect to
495 * @param port the port to connect to
496 * @param proxyhost the proxy host to connect via
497 * @param proxyport the proxy port to connect via
498 * @param secure whether or not to connect using HTTPS
499 *
500 * @see #getHostConfiguration()
501 *
502 * @deprecated use {@link HostConfiguration}
503 */
504 public void startSession(String host, int port,
505 String proxyhost, int proxyport, boolean secure) {
506
507 LOG.trace("enter HttpClient.startSession("
508 + "String, int, String, int, boolean)");
509 this.hostConfiguration.setHost (host, port, secure ? "https" : "http");
510 this.hostConfiguration.setProxy(proxyhost, proxyport);
511 }
512
513 /***
514 * Executes the given {@link HttpMethod HTTP method}.
515 *
516 * @param method the {@link HttpMethod HTTP method} to execute.
517 * @return the method's response code
518 *
519 * @throws IOException If an I/O (transport) error occurs. Some transport exceptions
520 * can be recovered from.
521 * @throws HttpException If a protocol exception occurs. Usually protocol exceptions
522 * cannot be recovered from.
523 */
524 public int executeMethod(HttpMethod method)
525 throws IOException, HttpException {
526
527 LOG.trace("enter HttpClient.executeMethod(HttpMethod)");
528 // execute this method and use its host configuration, if it has one
529 return executeMethod(
530 method.getHostConfiguration() != null
531 ? method.getHostConfiguration()
532 : getHostConfiguration(),
533 method,
534 null
535 );
536
537 }
538
539 /***
540 * Executes the given {@link HttpMethod HTTP method} using custom
541 * {@link HostConfiguration host configuration}.
542 *
543 * @param hostConfiguration The {@link HostConfiguration host configuration} to use.
544 * @param method the {@link HttpMethod HTTP method} to execute.
545 * @return the method's response code
546 *
547 * @throws IOException If an I/O (transport) error occurs. Some transport exceptions
548 * can be recovered from.
549 * @throws HttpException If a protocol exception occurs. Usually protocol exceptions
550 * cannot be recovered from.
551 * @since 2.0
552 */
553 public int executeMethod(HostConfiguration hostConfiguration, HttpMethod method)
554 throws IOException, HttpException {
555
556 LOG.trace("enter HttpClient.executeMethod(HostConfiguration,HttpMethod)");
557
558 return executeMethod(hostConfiguration, method, null);
559 }
560
561
562
563 /***
564 * Executes the given {@link HttpMethod HTTP method} using the given custom
565 * {@link HostConfiguration host configuration} with the given custom
566 * {@link HttpState HTTP state}.
567 *
568 * @param hostConfiguration The {@link HostConfiguration host configuration} to use.
569 * @param method the {@link HttpMethod HTTP method} to execute.
570 * @param state the {@link HttpState HTTP state} to use when executing the method.
571 * If <code>null</code>, the state returned by {@link #getState} will be used instead.
572 *
573 * @return the method's response code
574 *
575 * @throws IOException If an I/O (transport) error occurs. Some transport exceptions
576 * can be recovered from.
577 * @throws HttpException If a protocol exception occurs. Usually protocol exceptions
578 * cannot be recovered from.
579 * @since 2.0
580 */
581 public int executeMethod(HostConfiguration hostConfiguration,
582 HttpMethod method, HttpState state)
583 throws IOException, HttpException {
584
585 LOG.trace("enter HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState)");
586
587 if (method == null) {
588 throw new IllegalArgumentException("HttpMethod parameter may not be null");
589 }
590
591 int soTimeout = 0;
592 boolean strictMode = false;
593 int connectionTimeout = 0;
594 long httpConnectionTimeout = 0;
595 HostConfiguration defaultHostConfiguration = null;
596
597 /* access all synchronized data in a single block, this will keeps us
598 * from accessing data asynchronously as well having to regain the lock
599 * for each item.
600 */
601 synchronized (this) {
602 soTimeout = this.timeoutInMilliseconds;
603 strictMode = this.strictMode;
604 connectionTimeout = this.connectionTimeout;
605 httpConnectionTimeout = this.httpConnectionTimeout;
606 if (state == null) {
607 state = getState();
608 }
609 defaultHostConfiguration = getHostConfiguration();
610 }
611
612 HostConfiguration methodConfiguration
613 = new HostConfiguration(hostConfiguration);
614
615 if (hostConfiguration != defaultHostConfiguration) {
616 // we may need to apply some defaults
617 if (!methodConfiguration.isHostSet()) {
618 methodConfiguration.setHost(
619 defaultHostConfiguration.getHost(),
620 defaultHostConfiguration.getVirtualHost(),
621 defaultHostConfiguration.getPort(),
622 defaultHostConfiguration.getProtocol()
623 );
624 }
625 if (!methodConfiguration.isProxySet()
626 && defaultHostConfiguration.isProxySet()) {
627
628 methodConfiguration.setProxy(
629 defaultHostConfiguration.getProxyHost(),
630 defaultHostConfiguration.getProxyPort()
631 );
632 }
633 if (methodConfiguration.getLocalAddress() == null
634 && defaultHostConfiguration.getLocalAddress() != null) {
635
636 methodConfiguration.setLocalAddress(defaultHostConfiguration.getLocalAddress());
637 }
638 }
639
640 HttpConnectionManager connmanager = this.httpConnectionManager;
641 if (state.getHttpConnectionManager() != null) {
642 connmanager = state.getHttpConnectionManager();
643 }
644
645 HttpConnection connection = connmanager.getConnection(
646 methodConfiguration,
647 httpConnectionTimeout
648 );
649
650 try {
651 // Catch all possible exceptions to make sure to release the
652 // connection, as although the user may call
653 // Method->releaseConnection(), the method doesn't know about the
654 // connection until HttpMethod.execute() is called.
655
656 method.setStrictMode(strictMode);
657
658 if (!connection.isOpen()) {
659 connection.setSoTimeout(soTimeout);
660 connection.setConnectionTimeout(connectionTimeout);
661 connection.open();
662 if (connection.isProxied() && connection.isSecure()) {
663 method = new ConnectMethod(method);
664 }
665 }
666 } catch (IOException e) {
667 connection.releaseConnection();
668 throw e;
669 } catch (RuntimeException e) {
670 connection.releaseConnection();
671 throw e;
672 }
673
674 return method.execute(state, connection);
675 }
676
677 /***
678 * @deprecated this method has no effect. {@link HttpMethod#releaseConnection()}
679 * should be used to release resources after a HttpMethod has been executed.
680 *
681 * @see HttpMethod#releaseConnection()
682 */
683 public void endSession() throws IOException {
684 }
685
686 /***
687 * Returns the host that the client is accessing.
688 *
689 * @return The host that the client is accessing, or <code>null</code> if
690 * the session has not been started via startSession.
691 */
692 public String getHost() {
693 return hostConfiguration.getHost();
694 }
695
696 /***
697 * Returns the port that the client is accessing.
698 *
699 * @return The port that the client is accessing, or -1 if the session
700 * has not been started via startSession().
701 */
702 public int getPort() {
703 return hostConfiguration.getPort();
704 }
705
706 /***
707 * Returns the {@link HostConfiguration host configuration} associated with the
708 * HttpClient.
709 *
710 * @return {@link HostConfiguration host configuration}
711 *
712 * @since 2.0
713 */
714 public synchronized HostConfiguration getHostConfiguration() {
715 return hostConfiguration;
716 }
717
718 /***
719 * Assigns the {@link HostConfiguration host configuration} to use with the
720 * HttpClient.
721 *
722 * @param hostConfiguration The {@link HostConfiguration host configuration} to set
723 *
724 * @since 2.0
725 */
726 public synchronized void setHostConfiguration(HostConfiguration hostConfiguration) {
727 this.hostConfiguration = hostConfiguration;
728 }
729
730 /***
731 * Returns the {@link HttpConnectionManager HTTP connection manager} associated
732 * with the HttpClient.
733 *
734 * @return {@link HttpConnectionManager HTTP connection manager}
735 *
736 * @since 2.0
737 */
738 public synchronized HttpConnectionManager getHttpConnectionManager() {
739 return httpConnectionManager;
740 }
741
742 /***
743 * Assigns the {@link HttpConnectionManager HTTP connection manager} to use with
744 * the HttpClient.
745 *
746 * @param httpConnectionManager The {@link HttpConnectionManager HTTP connection manager}
747 * to set
748 *
749 * @since 2.0
750 */
751 public synchronized void setHttpConnectionManager(
752 HttpConnectionManager httpConnectionManager
753 ) {
754 this.httpConnectionManager = httpConnectionManager;
755 }
756
757 }
This page was automatically generated by Maven