List of usage examples for org.apache.http.impl.io SocketOutputBuffer SocketOutputBuffer
public SocketOutputBuffer(Socket socket, int i, HttpParams httpParams) throws IOException
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 ava 2 s. c om 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();// ww w. j av a 2s. c o 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/*w w w . 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; }