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.params.HttpAbstractParamBean;
36  import org.apache.http.params.HttpParams;
37  
38  /**
39   * This is a Java Bean class that can be used to wrap an instance of
40   * {@link HttpParams} and manipulate HTTP client parameters using
41   * Java Beans conventions.
42   *
43   * @since 4.0
44   *
45   * @deprecated (4.3) use {@link org.apache.http.client.config.RequestConfig}.
46   */
47  @Deprecated
48  @NotThreadSafe
49  public class ClientParamBean extends HttpAbstractParamBean {
50  
51      public ClientParamBean (final HttpParams params) {
52          super(params);
53      }
54  
55      /**
56       * @deprecated (4.2)  do not use.
57       */
58      @Deprecated
59      public void setConnectionManagerFactoryClassName (final String factory) {
60          params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME, factory);
61      }
62  
63      public void setHandleRedirects (final boolean handle) {
64          params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, handle);
65      }
66  
67      public void setRejectRelativeRedirect (final boolean reject) {
68          params.setBooleanParameter(ClientPNames.REJECT_RELATIVE_REDIRECT, reject);
69      }
70  
71      public void setMaxRedirects (final int maxRedirects) {
72          params.setIntParameter(ClientPNames.MAX_REDIRECTS, maxRedirects);
73      }
74  
75      public void setAllowCircularRedirects (final boolean allow) {
76          params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, allow);
77      }
78  
79      public void setHandleAuthentication (final boolean handle) {
80          params.setBooleanParameter(ClientPNames.HANDLE_AUTHENTICATION, handle);
81      }
82  
83      public void setCookiePolicy (final String policy) {
84          params.setParameter(ClientPNames.COOKIE_POLICY, policy);
85      }
86  
87      public void setVirtualHost (final HttpHost host) {
88          params.setParameter(ClientPNames.VIRTUAL_HOST, host);
89      }
90  
91      public void setDefaultHeaders (final Collection <Header> headers) {
92          params.setParameter(ClientPNames.DEFAULT_HEADERS, headers);
93      }
94  
95      public void setDefaultHost (final HttpHost host) {
96          params.setParameter(ClientPNames.DEFAULT_HOST, host);
97      }
98  
99      /**
100      * @since 4.2
101      */
102     public void setConnectionManagerTimeout(final long timeout) {
103         params.setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout);
104     }
105 
106 }