|
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 ch.boye.httpclientandroidlib.client.params; |
|
29 |
|
30 import java.util.Collection; |
|
31 |
|
32 import ch.boye.httpclientandroidlib.annotation.NotThreadSafe; |
|
33 |
|
34 import ch.boye.httpclientandroidlib.Header; |
|
35 import ch.boye.httpclientandroidlib.HttpHost; |
|
36 import ch.boye.httpclientandroidlib.conn.ClientConnectionManagerFactory; |
|
37 import ch.boye.httpclientandroidlib.params.HttpAbstractParamBean; |
|
38 import ch.boye.httpclientandroidlib.params.HttpParams; |
|
39 |
|
40 /** |
|
41 * This is a Java Bean class that can be used to wrap an instance of |
|
42 * {@link HttpParams} and manipulate HTTP client parameters using |
|
43 * Java Beans conventions. |
|
44 * |
|
45 * @since 4.0 |
|
46 */ |
|
47 @NotThreadSafe |
|
48 public class ClientParamBean extends HttpAbstractParamBean { |
|
49 |
|
50 public ClientParamBean (final HttpParams params) { |
|
51 super(params); |
|
52 } |
|
53 |
|
54 public void setConnectionManagerFactoryClassName (final String factory) { |
|
55 params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME, factory); |
|
56 } |
|
57 |
|
58 @Deprecated |
|
59 public void setConnectionManagerFactory(ClientConnectionManagerFactory factory) { |
|
60 params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY, 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 } |