1 30 31 package org.apache.commons.httpclient.params; 32 33 46 public class HttpClientParams extends HttpMethodParams { 47 48 56 public static final String CONNECTION_MANAGER_TIMEOUT = "http.connection-manager.timeout"; 57 58 66 public static final String CONNECTION_MANAGER_CLASS = "http.connection-manager.class"; 67 68 74 public static final String PREEMPTIVE_AUTHENTICATION = "http.authentication.preemptive"; 75 76 82 public static final String REJECT_RELATIVE_REDIRECT = "http.protocol.reject-relative-redirect"; 83 84 91 public static final String MAX_REDIRECTS = "http.protocol.max-redirects"; 92 93 101 public static final String ALLOW_CIRCULAR_REDIRECTS = "http.protocol.allow-circular-redirects"; 102 103 111 public HttpClientParams() { 112 super(); 113 } 114 115 126 public HttpClientParams(HttpParams defaults) { 127 super(defaults); 128 } 129 130 137 public long getConnectionManagerTimeout() { 138 return getLongParameter(CONNECTION_MANAGER_TIMEOUT, 0); 139 } 140 141 148 public void setConnectionManagerTimeout(long timeout) { 149 setLongParameter(CONNECTION_MANAGER_TIMEOUT, timeout); 150 } 151 152 159 public Class getConnectionManagerClass() { 160 return (Class ) getParameter(CONNECTION_MANAGER_CLASS); 161 } 162 163 170 public void setConnectionManagerClass(Class clazz) { 171 setParameter(CONNECTION_MANAGER_CLASS, clazz); 172 } 173 174 181 public boolean isAuthenticationPreemptive() { 182 return getBooleanParameter(PREEMPTIVE_AUTHENTICATION, false); 183 } 184 185 191 public void setAuthenticationPreemptive(boolean value) { 192 setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value); 193 } 194 195 private static final String [] PROTOCOL_STRICTNESS_PARAMETERS = { 196 REJECT_RELATIVE_REDIRECT, 197 ALLOW_CIRCULAR_REDIRECTS 198 }; 199 200 201 public void makeStrict() { 202 super.makeStrict(); 203 setParameters(PROTOCOL_STRICTNESS_PARAMETERS, Boolean.TRUE); 204 } 205 206 207 public void makeLenient() { 208 super.makeLenient(); 209 setParameters(PROTOCOL_STRICTNESS_PARAMETERS, Boolean.FALSE); 210 } 211 } 212 | Popular Tags |