@Override protected void onInputReady(final DefaultNHttpClientConnection conn) { conn.consumeInput(this.handler); }
@Override protected void onOutputReady(final DefaultNHttpClientConnection conn) { conn.produceOutput(this.handler); }
/** * @deprecated (4.3) no longer used. */ @Deprecated protected DefaultNHttpClientConnection createConnection( final IOSession session, final HttpResponseFactory responseFactory, final ByteBufferAllocator allocator, final HttpParams params) { return new DefaultNHttpClientConnection(session, responseFactory, allocator, params); }
@Override public void submitRequest(final HttpRequest request) throws IOException, HttpException { Args.notNull(request, "HTTP request"); assertNotClosed(); if (this.request != null) { throw new HttpException("Request already submitted"); } onRequestSubmitted(request); this.requestWriter.write(request); this.hasBufferedOutput = this.outbuf.hasData(); if (request instanceof HttpEntityEnclosingRequest && ((HttpEntityEnclosingRequest) request).getEntity() != null) { prepareEncoder(request); this.request = request; } this.connMetrics.incrementRequestCount(); this.session.setEvent(EventMask.WRITE); }
/** * Creates a new instance of this class given the underlying I/O session. * * @param session the underlying I/O session. * @param responseFactory HTTP response factory. * @param allocator byte buffer allocator. * @param params HTTP parameters. * * @deprecated (4.3) use {@link DefaultNHttpClientConnection#DefaultNHttpClientConnection( * IOSession, int, int, ByteBufferAllocator, CharsetDecoder, CharsetEncoder, * MessageConstraints, ContentLengthStrategy, ContentLengthStrategy, * NHttpMessageWriterFactory, NHttpMessageParserFactory)} */ @Deprecated public DefaultNHttpClientConnection( final IOSession session, final HttpResponseFactory responseFactory, final ByteBufferAllocator allocator, final HttpParams params) { super(session, allocator, params); Args.notNull(responseFactory, "Response factory"); this.responseParser = createResponseParser(this.inbuf, responseFactory, params); this.requestWriter = createRequestWriter(this.outbuf, params); this.hasBufferedInput = false; this.hasBufferedOutput = false; this.session.setBufferStatus(this); }
if (this.response != null) { if (this.response.getStatusLine().getStatusCode() >= 200) { final HttpEntity entity = prepareDecoder(this.response); this.response.setEntity(entity); this.connMetrics.incrementResponseCount(); onResponseReceived(this.response); handler.responseReceived(this); if (this.contentDecoder == null) { resetInput(); resetInput(); resetInput(); handler.exception(this, ex); } catch (final Exception ex) {
@Override protected void onConnected(final DefaultNHttpClientConnection conn) { Axis2HttpRequest axis2Req = (Axis2HttpRequest) conn.getContext().getAttribute(IOSession.ATTACHMENT_KEY); try { this.handler.connected(conn, axis2Req); } catch (final Exception ex) { this.handler.exception(conn, ex); } }
@Override protected NHttpMessageWriter<HttpRequest> createRequestWriter( final SessionOutputBuffer buffer, final HttpParams params) { return new LoggingNHttpMessageWriter( super.createRequestWriter(buffer, params)); }
@Override protected NHttpMessageParser<HttpResponse> createResponseParser( final SessionInputBuffer buffer, final HttpResponseFactory responseFactory, final HttpParams params) { return new LoggingNHttpMessageParser( super.createResponseParser(buffer, responseFactory, params)); }
@Override public void submitRequest(final HttpRequest request) throws IOException, HttpException { Args.notNull(request, "HTTP request"); assertNotClosed(); if (this.request != null) { throw new HttpException("Request already submitted"); } onRequestSubmitted(request); this.requestWriter.write(request); this.hasBufferedOutput = this.outbuf.hasData(); if (request instanceof HttpEntityEnclosingRequest && ((HttpEntityEnclosingRequest) request).getEntity() != null) { prepareEncoder(request); this.request = request; } this.connMetrics.incrementRequestCount(); this.session.setEvent(EventMask.WRITE); }
/** * Creates a new instance of this class given the underlying I/O session. * * @param session the underlying I/O session. * @param responseFactory HTTP response factory. * @param allocator byte buffer allocator. * @param params HTTP parameters. * * @deprecated (4.3) use {@link DefaultNHttpClientConnection#DefaultNHttpClientConnection( * IOSession, int, int, ByteBufferAllocator, CharsetDecoder, CharsetEncoder, * MessageConstraints, ContentLengthStrategy, ContentLengthStrategy, * NHttpMessageWriterFactory, NHttpMessageParserFactory)} */ @Deprecated public DefaultNHttpClientConnection( final IOSession session, final HttpResponseFactory responseFactory, final ByteBufferAllocator allocator, final HttpParams params) { super(session, allocator, params); Args.notNull(responseFactory, "Response factory"); this.responseParser = createResponseParser(this.inbuf, responseFactory, params); this.requestWriter = createRequestWriter(this.outbuf, params); this.hasBufferedInput = false; this.hasBufferedOutput = false; this.session.setBufferStatus(this); }
if (this.response != null) { if (this.response.getStatusLine().getStatusCode() >= 200) { final HttpEntity entity = prepareDecoder(this.response); this.response.setEntity(entity); this.connMetrics.incrementResponseCount(); onResponseReceived(this.response); handler.responseReceived(this); if (this.contentDecoder == null) { resetInput(); resetInput(); resetInput(); handler.exception(this, ex); } catch (final Exception ex) {
@Override protected void onConnected(final DefaultNHttpClientConnection conn) { final Object attachment = conn.getContext().getAttribute(IOSession.ATTACHMENT_KEY); try { this.handler.connected(conn, attachment); } catch (final Exception ex) { this.handler.exception(conn, ex); } }
@Override protected void onInputReady(final DefaultNHttpClientConnection conn) { conn.consumeInput(this.handler); }
@Override protected void onOutputReady(final DefaultNHttpClientConnection conn) { conn.produceOutput(this.handler); }
@Override protected void onConnected(final DefaultNHttpClientConnection conn) { final Object attachment = conn.getContext().getAttribute(IOSession.ATTACHMENT_KEY); try { this.handler.connected(conn, attachment); } catch (final Exception ex) { this.handler.exception(conn, ex); } }
/** * @deprecated (4.3) no longer used. */ @Deprecated protected DefaultNHttpClientConnection createConnection( final IOSession session, final HttpResponseFactory responseFactory, final ByteBufferAllocator allocator, final HttpParams params) { return new DefaultNHttpClientConnection(session, responseFactory, allocator, params); }
@Override protected void onInputReady(final DefaultNHttpClientConnection conn) { conn.consumeInput(this.handler); }
@Override protected void onOutputReady(final DefaultNHttpClientConnection conn) { conn.produceOutput(this.handler); }
@Override protected void onConnected(final DefaultNHttpClientConnection conn) { HostConnections hostConnections = (HostConnections) conn.getContext().getAttribute(IOSession.ATTACHMENT_KEY); try { this.handler.connected(conn, hostConnections); } catch (final Exception ex) { this.handler.exception(conn, ex); } }