1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 package org.apache.commons.httpclient.params;
32
33 /***
34 * This class represents a collection of HTTP protocol parameters applicable to
35 * {@link org.apache.commons.httpclient.HostConfiguration instances of HostConfiguration}.
36 * Protocol parameters may be linked together to form a hierarchy. If a particular
37 * parameter value has not been explicitly defined in the collection itself, its
38 * value will be drawn from the parent collection of parameters.
39 *
40 * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
41 *
42 * @version $Revision$
43 *
44 * @since 3.0
45 */
46 public class HostParams extends DefaultHttpParams {
47
48 /***
49 * Defines the request headers to be sent per default with each request.
50 * <p>
51 * This parameter expects a value of type {@link java.util.Collection}. The
52 * collection is expected to contain {@link org.apache.commons.httpclient.Header}s.
53 * </p>
54 */
55 public static final String DEFAULT_HEADERS = "http.default-headers";
56
57 /***
58 * Creates a new collection of parameters with the collection returned
59 * by {@link #getDefaultParams()} as a parent. The collection will defer
60 * to its parent for a default value if a particular parameter is not
61 * explicitly set in the collection itself.
62 *
63 * @see #getDefaultParams()
64 */
65 public HostParams() {
66 super();
67 }
68
69 /***
70 * Creates a new collection of parameters with the given parent.
71 * The collection will defer to its parent for a default value
72 * if a particular parameter is not explicitly set in the collection
73 * itself.
74 *
75 * @param defaults the parent collection to defer to, if a parameter
76 * is not explictly set in the collection itself.
77 *
78 * @see #getDefaultParams()
79 */
80 public HostParams(HttpParams defaults) {
81 super(defaults);
82 }
83
84 /***
85 * Sets the virtual host name.
86 *
87 * @param hostname The host name
88 */
89 public void setVirtualHost(final String hostname) {
90 setParameter(HttpMethodParams.VIRTUAL_HOST, hostname);
91 }
92
93 /***
94 * Returns the virtual host name.
95 *
96 * @return The virtual host name
97 */
98 public String getVirtualHost() {
99 return (String) getParameter(HttpMethodParams.VIRTUAL_HOST);
100 }
101
102 }