Example usage for org.apache.http.impl.io SocketInputBuffer SocketInputBuffer

List of usage examples for org.apache.http.impl.io SocketInputBuffer SocketInputBuffer

Introduction

In this page you can find the example usage for org.apache.http.impl.io SocketInputBuffer SocketInputBuffer.

Prototype

public SocketInputBuffer(Socket socket, int i, HttpParams httpParams) throws IOException 

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;/*w w  w.  ja  v  a  2  s .co 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:org.apache.axis2.transport.http.server.AxisHttpConnectionImpl.java

public AxisHttpConnectionImpl(final Socket socket, final HttpParams params) throws IOException {
    super();/*from  w  ww .ja  va  2 s  .  co  m*/
    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  va  2s. co 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;
}