public static int getSocketBufferSize(final HttpParams params) { if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } return params.getIntParameter (CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1); }
/** * Returns linger-on-close timeout. Value <tt>0</tt> implies that the option is * disabled. Value <tt>-1</tt> implies that the JRE default is used. * * @return the linger-on-close timeout */ public static int getLinger(final HttpParams params) { if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } return params.getIntParameter(CoreConnectionPNames.SO_LINGER, -1); }
/** * Returns the timeout until a connection is etablished. A value of zero * means the timeout is not used. The default value is zero. * * @return timeout in milliseconds. */ public static int getConnectionTimeout(final HttpParams params) { if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } return params.getIntParameter (CoreConnectionPNames.CONNECTION_TIMEOUT, 0); }
/** * Returns the default socket timeout (<tt>SO_TIMEOUT</tt>) in milliseconds which is the * timeout for waiting for data. A timeout value of zero is interpreted as an infinite * timeout. This value is used when no socket timeout is set in the * method parameters. * * @return timeout in milliseconds */ public static int getSoTimeout(final HttpParams params) { if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } return params.getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0); }
/** * Gets the maximum number of connections allowed. * * @param params HTTP parameters * * @return The maximum number of connections allowed. * * @see ConnManagerPNames#MAX_TOTAL_CONNECTIONS */ public static int getMaxTotalConnections( final HttpParams params) { if (params == null) { throw new IllegalArgumentException ("HTTP parameters must not be null."); } return params.getIntParameter(MAX_TOTAL_CONNECTIONS, DEFAULT_MAX_TOTAL_CONNECTIONS); }
public AbstractMessageParser( final SessionInputBuffer buffer, final LineParser parser, final HttpParams params) { super(); if (buffer == null) { throw new IllegalArgumentException("Session input buffer may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.sessionBuffer = buffer; this.maxHeaderCount = params.getIntParameter( CoreConnectionPNames.MAX_HEADER_COUNT, -1); this.maxLineLen = params.getIntParameter( CoreConnectionPNames.MAX_LINE_LENGTH, -1); this.lineParser = (parser != null) ? parser : BasicLineParser.DEFAULT; }
public DefaultResponseParser( final SessionInputBuffer buffer, final LineParser parser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, parser, params); if (responseFactory == null) { throw new IllegalArgumentException ("Response factory may not be null"); } this.responseFactory = responseFactory; this.lineBuf = new CharArrayBuffer(128); this.maxGarbageLines = params.getIntParameter( ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, Integer.MAX_VALUE); }
@Override public IgnitedHttpRequest withTimeout(int timeout) { oldSocketTimeout = httpClient.getParams().getIntParameter(CoreConnectionPNames.SO_TIMEOUT, IgnitedHttp.DEFAULT_SOCKET_TIMEOUT); oldConnTimeout = httpClient.getParams().getIntParameter( CoreConnectionPNames.CONNECTION_TIMEOUT, IgnitedHttp.DEFAULT_WAIT_FOR_CONNECTION_TIMEOUT); ignitedHttp.setSocketTimeout(timeout); ignitedHttp.setConnectionTimeout(timeout); timeoutChanged = true; return this; }
protected void init(final InputStream instream, int buffersize, final HttpParams params) { if (instream == null) { throw new IllegalArgumentException("Input stream may not be null"); } if (buffersize <= 0) { throw new IllegalArgumentException("Buffer size may not be negative or zero"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.instream = instream; this.buffer = new byte[buffersize]; this.bufferpos = 0; this.bufferlen = 0; this.linebuffer = new ByteArrayBuffer(buffersize); this.charset = HttpProtocolParams.getHttpElementCharset(params); this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII) || this.charset.equalsIgnoreCase(HTTP.ASCII); this.maxLineLen = params.getIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, -1); this.metrics = new HttpTransportMetricsImpl(); }
this.maxRedirects = this.params.getIntParameter(ClientPNames.MAX_REDIRECTS, 100); this.targetAuthState = new AuthState(); this.proxyAuthState = new AuthState();
this.maxRedirects = this.params.getIntParameter(ClientPNames.MAX_REDIRECTS, 100); this.targetAuthState = new AuthState(); this.proxyAuthState = new AuthState();
int tms = request.getParams().getIntParameter( CoreProtocolPNames.WAIT_FOR_CONTINUE, 2000);
/** * Gets the http connection read timeout in milliseconds. */ public long getConnectionTimeout() { if (params == null) { return 0; } return (long)params.getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0); }
public static int getSocketBufferSize(final HttpParams params) { if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } return params.getIntParameter (CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1); }
/** * Returns linger-on-close timeout. Value <tt>0</tt> implies that the option is * disabled. Value <tt>-1</tt> implies that the JRE default is used. * * @return the linger-on-close timeout */ public static int getLinger(final HttpParams params) { if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } return params.getIntParameter(CoreConnectionPNames.SO_LINGER, -1); }
public static int getSocketBufferSize(final HttpParams params) { if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } return params.getIntParameter (CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1); }
/** * Obtains value of the {@link CoreConnectionPNames#SO_TIMEOUT} parameter. * If not set, defaults to {@code 0}. * * @param params HTTP parameters. * @return SO_TIMEOUT. */ public static int getSoTimeout(final HttpParams params) { Args.notNull(params, "HTTP parameters"); return params.getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0); }
/** * Obtains value of the {@link CoreConnectionPNames#CONNECTION_TIMEOUT} * parameter. If not set, defaults to {@code 0}. * * @param params HTTP parameters. * @return connect timeout. */ public static int getConnectionTimeout(final HttpParams params) { Args.notNull(params, "HTTP parameters"); return params.getIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 0); }
/** * @deprecated (4.3) no longer used. */ @Deprecated protected HttpClientConnection create(final Socket socket, final HttpParams params) throws IOException { final int bufsize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024); final DefaultBHttpClientConnection conn = new DefaultBHttpClientConnection(bufsize); conn.bind(socket); return conn; }
public static SocketConfig getSocketConfig(final HttpParams params) { return SocketConfig.custom() .setSoTimeout(params.getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0)) .setSoReuseAddress(params.getBooleanParameter(CoreConnectionPNames.SO_REUSEADDR, false)) .setSoKeepAlive(params.getBooleanParameter(CoreConnectionPNames.SO_KEEPALIVE, false)) .setSoLinger(params.getIntParameter(CoreConnectionPNames.SO_LINGER, -1)) .setTcpNoDelay(params.getBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)) .build(); }