1 /* 2 * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/params/HttpClientParams.java $ 3 * $Revision: 659595 $ 4 * $Date: 2008-05-23 09:47:14 -0700 (Fri, 23 May 2008) $ 5 * 6 * ==================================================================== 7 * 8 * Licensed to the Apache Software Foundation (ASF) under one or more 9 * contributor license agreements. See the NOTICE file distributed with 10 * this work for additional information regarding copyright ownership. 11 * The ASF licenses this file to You under the Apache License, Version 2.0 12 * (the "License"); you may not use this file except in compliance with 13 * the License. You may obtain a copy of the License at 14 * 15 * http://www.apache.org/licenses/LICENSE-2.0 16 * 17 * Unless required by applicable law or agreed to in writing, software 18 * distributed under the License is distributed on an "AS IS" BASIS, 19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 * See the License for the specific language governing permissions and 21 * limitations under the License. 22 * ==================================================================== 23 * 24 * This software consists of voluntary contributions made by many 25 * individuals on behalf of the Apache Software Foundation. For more 26 * information on the Apache Software Foundation, please see 27 * <http://www.apache.org/>. 28 * 29 */ 30 31 package org.apache.http.client.params; 32 33 import org.apache.http.params.HttpParams; 34 35 /** 36 * An adaptor for accessing HTTP client parameters in {@link HttpParams}. 37 * 38 * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a> 39 * 40 * @version $Revision: 659595 $ 41 * 42 * @since 4.0 43 * 44 * @deprecated Please use {@link java.net.URL#openConnection} instead. 45 * Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a> 46 * for further details. 47 */ 48 @Deprecated 49 public class HttpClientParams { 50 HttpClientParams()51 private HttpClientParams() { 52 super(); 53 } 54 isRedirecting(final HttpParams params)55 public static boolean isRedirecting(final HttpParams params) { 56 if (params == null) { 57 throw new IllegalArgumentException("HTTP parameters may not be null"); 58 } 59 return params.getBooleanParameter 60 (ClientPNames.HANDLE_REDIRECTS, true); 61 } 62 setRedirecting(final HttpParams params, boolean value)63 public static void setRedirecting(final HttpParams params, boolean value) { 64 if (params == null) { 65 throw new IllegalArgumentException("HTTP parameters may not be null"); 66 } 67 params.setBooleanParameter 68 (ClientPNames.HANDLE_REDIRECTS, value); 69 } 70 isAuthenticating(final HttpParams params)71 public static boolean isAuthenticating(final HttpParams params) { 72 if (params == null) { 73 throw new IllegalArgumentException("HTTP parameters may not be null"); 74 } 75 return params.getBooleanParameter 76 (ClientPNames.HANDLE_AUTHENTICATION, true); 77 } 78 setAuthenticating(final HttpParams params, boolean value)79 public static void setAuthenticating(final HttpParams params, boolean value) { 80 if (params == null) { 81 throw new IllegalArgumentException("HTTP parameters may not be null"); 82 } 83 params.setBooleanParameter 84 (ClientPNames.HANDLE_AUTHENTICATION, value); 85 } 86 getCookiePolicy(final HttpParams params)87 public static String getCookiePolicy(final HttpParams params) { 88 if (params == null) { 89 throw new IllegalArgumentException("HTTP parameters may not be null"); 90 } 91 String cookiePolicy = (String) 92 params.getParameter(ClientPNames.COOKIE_POLICY); 93 if (cookiePolicy == null) { 94 return CookiePolicy.BEST_MATCH; 95 } 96 return cookiePolicy; 97 } 98 setCookiePolicy(final HttpParams params, final String cookiePolicy)99 public static void setCookiePolicy(final HttpParams params, final String cookiePolicy) { 100 if (params == null) { 101 throw new IllegalArgumentException("HTTP parameters may not be null"); 102 } 103 params.setParameter(ClientPNames.COOKIE_POLICY, cookiePolicy); 104 } 105 106 } 107