Example usage for org.apache.http.params HttpConnectionParams getTcpNoDelay

List of usage examples for org.apache.http.params HttpConnectionParams getTcpNoDelay

Introduction

In this page you can find the example usage for org.apache.http.params HttpConnectionParams getTcpNoDelay.

Prototype

public static boolean getTcpNoDelay(HttpParams httpParams) 

Source Link

Usage

From source file:net.oneandone.sushi.fs.webdav.WebdavConnection.java

public static WebdavConnection open(Socket socket, HttpParams params) throws IOException {
    int linger;/*from w w  w.  j av  a2s  . c o  m*/
    int buffersize;
    SessionInputBuffer input;
    SessionOutputBuffer output;

    socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params));
    socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params));
    linger = HttpConnectionParams.getLinger(params);
    if (linger >= 0) {
        socket.setSoLinger(linger > 0, linger);
    }
    buffersize = HttpConnectionParams.getSocketBufferSize(params);
    if (WebdavFilesystem.WIRE.isLoggable(Level.FINE)) {
        input = new LoggingSessionInputBuffer(socket, buffersize, params, WebdavFilesystem.WIRE);
        output = new LoggingSessionOutputBuffer(socket, buffersize, params, WebdavFilesystem.WIRE);
    } else {
        input = new SocketInputBuffer(socket, buffersize, params);
        output = new SocketOutputBuffer(socket, buffersize, params);
    }
    return new WebdavConnection(socket, input, output, params);
}

From source file:com.subgraph.vega.internal.http.proxy.VegaHttpServerConnection.java

public void bind(final Socket socket, final HttpParams params) throws IOException {
    if (socket == null) {
        throw new IllegalArgumentException("Socket may not be null");
    }/*from  www.ja v  a2 s.  c  o m*/
    if (params == null) {
        throw new IllegalArgumentException("HTTP parameters may not be null");
    }

    socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params));
    socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params));

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

    super.bind(socket, params);
}

From source file:org.apache.axis2.transport.http.server.AxisHttpConnectionImpl.java

public AxisHttpConnectionImpl(final Socket socket, final HttpParams params) throws IOException {
    super();//from  w ww .j  a v  a2  s  . com
    if (socket == null) {
        throw new IllegalArgumentException("Socket may not be null");
    }
    if (params == null) {
        throw new IllegalArgumentException("HTTP parameters may not be null");
    }
    socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params));
    socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params));

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

    int buffersize = HttpConnectionParams.getSocketBufferSize(params);
    this.socket = socket;
    this.outbuffer = new SocketOutputBuffer(socket, buffersize, params);
    this.inbuffer = new SocketInputBuffer(socket, buffersize, params);
    this.contentLenStrategy = new StrictContentLengthStrategy();
    this.requestParser = new HttpRequestParser(this.inbuffer, null, new DefaultHttpRequestFactory(), params);
    this.responseWriter = new HttpResponseWriter(this.outbuffer, null, params);
}

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

/***
 * Bind socket and set HttpParams to AndroidHttpClientConnection
 * @param socket outgoing socket/*from   w  ww .  j a va2 s .  c  om*/
 * @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:com.qiniu.android.http.ClientConnectionOperator.java

/**
 * Performs standard initializations on a newly created socket.
 *
 * @param sock    the socket to prepare/*from   w  w  w.j  av  a 2 s  .  co  m*/
 * @param context the context for the connection
 * @param params  the parameters from which to prepare the socket
 * @throws IOException in case of an IO problem
 */
protected void prepareSocket(final Socket sock, final HttpContext context, final HttpParams params)
        throws IOException {
    sock.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params));
    sock.setSoTimeout(HttpConnectionParams.getSoTimeout(params));

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