@Override public void close() throws IOException { delegate.feed(Buffers.EMPTY_BUFFER, true); } }
static void cleanupTransaction(final HttpContext httpCtx, final CompletionHandler<HttpTransactionContext> completionHandler) { final HttpTransactionContext httpTxContext = currentTransaction(httpCtx); assert httpTxContext != null; httpTxContext.scheduleCleanup(httpCtx, completionHandler); }
@SuppressWarnings(value = {"unchecked"}) void done(Object result) { if (future != null) { future.done(result); } }
builder = builder.setBody(entityBytes); } else { final FeedableBodyGenerator bodyGenerator = new FeedableBodyGenerator(); final Integer chunkSize = requestContext.resolveProperty( ClientProperties.CHUNKED_ENCODING_SIZE, ClientProperties.DEFAULT_CHUNK_SIZE); bodyGenerator.setMaxPendingBytes(chunkSize); final FeedableBodyGenerator.Feeder feeder = new FeedableBodyGenerator.SimpleFeeder(bodyGenerator) { @Override bodyGenerator.setFeeder(feeder); builder.setBody(bodyGenerator);
this.grizzlyClient = new AsyncHttpClient(new GrizzlyAsyncHttpProvider(asyncClientConfig), asyncClientConfig);
private void addProxyHeaders( final Request req, final HttpRequestPacket requestPacket, final Realm realm, final ProxyServer proxy, final boolean isUsedConnection, final boolean isConnect) throws IOException { setKeepAliveForHeader(Header.ProxyConnection, requestPacket); setProxyAuthorizationHeader(req, requestPacket, proxy, realm, isUsedConnection, isConnect); }
void abort(final Throwable t) { if (future != null) { future.abort(t); } }
@Override public Response prepareResponse(HttpResponseHeaders headers, List<HttpResponseBodyPart> bodyParts) { return new GrizzlyResponse(response, this, headers, bodyParts); } }
@Override public String getResponseBodyExcerpt(int maxLength) throws IOException { // TODO FIX NULL return getResponseBodyExcerpt(maxLength, null); }
public void onTimeout(Connection connection) { timeout(connection); } });
static HttpTransactionContext startTransaction( final Connection connection, final GrizzlyAsyncHttpProvider provider, final Request request, final GrizzlyResponseFuture future) { return new HttpTransactionContext(provider, connection, future, request); }
public static PayloadGenerator getPayloadGenerator(final Request request) { for (final PayloadGenerator h : HANDLERS) { if (h.handlesPayloadType(request)) { return h; } } return null; }
@SuppressWarnings("unchecked") void onRequestFullySent() { synchronized (this) { if (isRequestFullySent) { return; } isRequestFullySent = true; } if (cleanupTask != null) { cleanupTask.run(); } }
public void touch() { final HttpTransactionContext tx = transactionCtx; if (tx != null) { tx.touchConnection(); } }
@Override public SSLEngineConfigurator copy() { return new AhcSSLEngineConfigurator(ahcSslEngineFactory); }
@Override public SSLEngine createSSLEngine() { return createSSLEngine(null, -1); }
@Override public void failed(final Throwable throwable) { future.abort(throwable); }
@Override public void write(int b) throws IOException { final byte[] buffer = new byte[1]; buffer[0] = (byte) b; delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER, buffer), false); }
@Override public void write(byte[] b, int off, int len) throws IOException { delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER, b, off, len), false); }
@Override public void write(byte[] b) throws IOException { delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER, b), false); }