Example usage for org.apache.http.params HttpParams getIntParameter

List of usage examples for org.apache.http.params HttpParams getIntParameter

Introduction

In this page you can find the example usage for org.apache.http.params HttpParams getIntParameter.

Prototype

int getIntParameter(String str, int i);

Source Link

Usage

From source file:org.vietspider.net.apache.AbstractSessionInputBuffer.java

protected void init(final InputStream _instream, int buffersize, final HttpParams params) {
    if (_instream == null) {
        throw new IllegalArgumentException("Input stream may not be null");
    }//from  www  .j  a v  a  2 s.co m
    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.timeoutSocket = params.getBooleanParameter("vietspider.socket.timeout", false);
    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();
}

From source file:org.mycard.net.network.AndroidHttpClientConnection.java

/***
 * Bind socket and set HttpParams to AndroidHttpClientConnection
 * @param socket outgoing socket//from   w  ww  .  j  av a 2  s  . c  o  m
 * @param params HttpParams
 * @throws IOException
  */
public void bind(final Socket socket, final HttpParams params) throws IOException {
    if (socket == null) {
        throw new IllegalArgumentException("Socket may not be null");
    }
    if (params == null) {
        throw new IllegalArgumentException("HTTP parameters may not be null");
    }
    assertNotOpen();
    socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params));
    socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params));

    int linger = HttpConnectionParams.getLinger(params);
    if (linger >= 0) {
        socket.setSoLinger(linger > 0, linger);
    }
    this.socket = socket;

    int buffersize = HttpConnectionParams.getSocketBufferSize(params);
    this.inbuffer = new SocketInputBuffer(socket, buffersize, params);
    this.outbuffer = new SocketOutputBuffer(socket, buffersize, params);

    maxHeaderCount = params.getIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, -1);
    maxLineLength = params.getIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, -1);

    this.requestWriter = new HttpRequestWriter(outbuffer, null, params);

    this.metrics = new HttpConnectionMetricsImpl(inbuffer.getMetrics(), outbuffer.getMetrics());

    this.open = true;
}

From source file:org.apache.http.impl.conn.DefaultResponseParser.java

protected int getMaxGarbageLines(final HttpParams params) {
    return params.getIntParameter(org.apache.http.conn.params.ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE,
            Integer.MAX_VALUE);/*from   w w  w.j  av  a 2  s.  c  o m*/
}