1 30 31 package org.apache.commons.httpclient.params; 32 33 46 public class HttpConnectionParams extends DefaultHttpParams { 47 48 58 public static final String SO_TIMEOUT = "http.socket.timeout"; 59 60 71 public static final String TCP_NODELAY = "http.tcp.nodelay"; 72 73 83 public static final String SO_SNDBUF = "http.socket.sendbuffer"; 84 85 95 public static final String SO_RCVBUF = "http.socket.receivebuffer"; 96 97 107 public static final String SO_LINGER = "http.socket.linger"; 108 109 116 public static final String CONNECTION_TIMEOUT = "http.connection.timeout"; 117 118 127 public static final String STALE_CONNECTION_CHECK = "http.connection.stalecheck"; 128 129 137 public HttpConnectionParams() { 138 super(); 139 } 140 141 149 public int getSoTimeout() { 150 return getIntParameter(SO_TIMEOUT, 0); 151 } 152 153 161 public void setSoTimeout(int timeout) { 162 setIntParameter(SO_TIMEOUT, timeout); 163 } 164 165 175 public void setTcpNoDelay(boolean value) { 176 setBooleanParameter(TCP_NODELAY, value); 177 } 178 179 185 public boolean getTcpNoDelay() { 186 return getBooleanParameter(TCP_NODELAY, true); 187 } 188 189 197 public int getSendBufferSize() { 198 return getIntParameter(SO_SNDBUF, -1); 199 } 200 201 209 public void setSendBufferSize(int size) { 210 setIntParameter(SO_SNDBUF, size); 211 } 212 213 221 public int getReceiveBufferSize() { 222 return getIntParameter(SO_RCVBUF, -1); 223 } 224 225 233 public void setReceiveBufferSize(int size) { 234 setIntParameter(SO_RCVBUF, size); 235 } 236 237 243 public int getLinger() { 244 return getIntParameter(SO_LINGER, -1); 245 } 246 247 257 public void setLinger(int value) { 258 setIntParameter(SO_LINGER, value); 259 } 260 261 267 public int getConnectionTimeout() { 268 return getIntParameter(CONNECTION_TIMEOUT, 0); 269 } 270 271 277 public void setConnectionTimeout(int timeout) { 278 setIntParameter(CONNECTION_TIMEOUT, timeout); 279 } 280 281 290 public boolean isStaleCheckingEnabled() { 291 return getBooleanParameter(STALE_CONNECTION_CHECK, true); 292 } 293 294 303 public void setStaleCheckingEnabled(boolean value) { 304 setBooleanParameter(STALE_CONNECTION_CHECK, value); 305 } 306 } 307 | Popular Tags |