View Javadoc

1   /*
2    * ====================================================================
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   * ====================================================================
20   *
21   * This software consists of voluntary contributions made by many
22   * individuals on behalf of the Apache Software Foundation.  For more
23   * information on the Apache Software Foundation, please see
24   * <http://www.apache.org/>.
25   *
26   */
27  
28  package org.apache.http.client.params;
29  
30  import java.util.Collection;
31  
32  import org.apache.http.Header;
33  import org.apache.http.HttpHost;
34  import org.apache.http.annotation.NotThreadSafe;
35  import org.apache.http.client.config.RequestConfig;
36  import org.apache.http.params.HttpAbstractParamBean;
37  import org.apache.http.params.HttpParams;
38  
39  /**
40   * This is a Java Bean class that can be used to wrap an instance of
41   * {@link HttpParams} and manipulate HTTP client parameters using
42   * Java Beans conventions.
43   *
44   * @since 4.0
45   *
46   * @deprecated (4.3) use {@link RequestConfig}
47   */
48  @Deprecated
49  @NotThreadSafe
50  public class ClientParamBean extends HttpAbstractParamBean {
51  
52      public ClientParamBean (final HttpParams params) {
53          super(params);
54      }
55  
56      /**
57       * @deprecated (4.2)  do not use.
58       */
59      @Deprecated
60      public void setConnectionManagerFactoryClassName (final String factory) {
61          params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME, factory);
62      }
63  
64      public void setHandleRedirects (final boolean handle) {
65          params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, handle);
66      }
67  
68      public void setRejectRelativeRedirect (final boolean reject) {
69          params.setBooleanParameter(ClientPNames.REJECT_RELATIVE_REDIRECT, reject);
70      }
71  
72      public void setMaxRedirects (final int maxRedirects) {
73          params.setIntParameter(ClientPNames.MAX_REDIRECTS, maxRedirects);
74      }
75  
76      public void setAllowCircularRedirects (final boolean allow) {
77          params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, allow);
78      }
79  
80      public void setHandleAuthentication (final boolean handle) {
81          params.setBooleanParameter(ClientPNames.HANDLE_AUTHENTICATION, handle);
82      }
83  
84      public void setCookiePolicy (final String policy) {
85          params.setParameter(ClientPNames.COOKIE_POLICY, policy);
86      }
87  
88      public void setVirtualHost (final HttpHost host) {
89          params.setParameter(ClientPNames.VIRTUAL_HOST, host);
90      }
91  
92      public void setDefaultHeaders (final Collection <Header> headers) {
93          params.setParameter(ClientPNames.DEFAULT_HEADERS, headers);
94      }
95  
96      public void setDefaultHost (final HttpHost host) {
97          params.setParameter(ClientPNames.DEFAULT_HOST, host);
98      }
99  
100     /**
101      * @since 4.2
102      */
103     public void setConnectionManagerTimeout(final long timeout) {
104         params.setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout);
105     }
106 
107 }