@SuppressWarnings("unchecked") private LastPacketCompletionHandler() { delegate = ((!feedableBodyGenerator.requestPacket.isCommitted()) ? feedableBodyGenerator.context.getTransportContext().getCompletionHandler() : null); c = feedableBodyGenerator.context.getConnection(); origMaxPendingBytes = feedableBodyGenerator.origMaxPendingBytes; }
requestPacket.setContentLengthLong(data.length); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null));
@SuppressWarnings({"unchecked"}) public boolean generate(final FilterChainContext ctx, final Request request, final HttpRequestPacket requestPacket) throws IOException { this.request = request; this.requestPacket = requestPacket; // Set content-length if possible final long contentLength = delegate.getContentLength(request); if (contentLength != -1) { requestPacket.setContentLengthLong(contentLength); } ctx.write(requestPacket, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null)); return true; }
.build(); buffer.allowBufferDispose(false); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null));
requestPacket.httpContentBuilder().content(b). last(last).build(); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null)); ctx.write(requestPacket, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null)); ctx.write(new FileTransfer(f), new EmptyCompletionHandler<WriteResult>() {
LOGGER.debug("REQUEST: " + requestPacket.toString()); ctx.write(requestPacket, ctx.getTransportContext().getCompletionHandler());
@SuppressWarnings({"unchecked"}) public boolean generate(final FilterChainContext ctx, final Request request, final HttpRequestPacket requestPacket) throws IOException { String charset = request.getBodyEncoding(); if (charset == null) { charset = Charsets.ASCII_CHARSET.name(); } final byte[] data = request.getStringData().getBytes(charset); final MemoryManager mm = ctx.getMemoryManager(); final Buffer gBuffer = Buffers.wrap(mm, data); if (requestPacket.getContentLength() == -1) { requestPacket.setContentLengthLong(data.length); } final HttpContent content = requestPacket.httpContentBuilder() .content(gBuffer) .last(true) .build(); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null)); return true; }
@SuppressWarnings({"unchecked"}) public boolean generate(final FilterChainContext ctx, final Request request, final HttpRequestPacket requestPacket) throws IOException { final MemoryManager mm = ctx.getMemoryManager(); final byte[] data = request.getByteData(); final Buffer gBuffer = Buffers.wrap(mm, data); if (requestPacket.getContentLength() == -1) { requestPacket.setContentLengthLong(data.length); } final HttpContent content = requestPacket.httpContentBuilder() .content(gBuffer) .last(true) .build(); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null)); return true; }
requestPacket.httpContentBuilder().content(buffer). last(last).build(); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null));
@SuppressWarnings("unchecked") private LastPacketCompletionHandler() { delegate = ((!feedableBodyGenerator.requestPacket.isCommitted()) ? feedableBodyGenerator.context.getTransportContext().getCompletionHandler() : null); c = feedableBodyGenerator.context.getConnection(); origMaxPendingBytes = feedableBodyGenerator.origMaxPendingBytes; }
public static FilterChainContext create(final Connection connection, final Closeable closeable) { FilterChainContext context = ThreadCache.takeFromCache(CACHE_IDX); if (context == null) { context = new FilterChainContext(); } context.setConnection(connection); context.setCloseable(closeable); context.getTransportContext().isBlocking = connection.isBlocking(); return context; }
public static FilterChainContext create(final Connection connection, final Closeable closeable) { FilterChainContext context = ThreadCache.takeFromCache(CACHE_IDX); if (context == null) { context = new FilterChainContext(); } context.setConnection(connection); context.setCloseable(closeable); context.getTransportContext().isBlocking = connection.isBlocking(); return context; }
public static FilterChainContext create(final Connection connection, final Closeable closeable) { FilterChainContext context = ThreadCache.takeFromCache(CACHE_IDX); if (context == null) { context = new FilterChainContext(); } context.setConnection(connection); context.setCloseable(closeable); context.getTransportContext().isBlocking = connection.isBlocking(); return context; }
public static FilterChainContext create(final Connection connection, final Closeable closeable) { FilterChainContext context = ThreadCache.takeFromCache(CACHE_IDX); if (context == null) { context = new FilterChainContext(); } context.setConnection(connection); context.setCloseable(closeable); context.getTransportContext().isBlocking = connection.isBlocking(); return context; }
public static FilterChainContext create(final Connection connection, final Closeable closeable) { FilterChainContext context = ThreadCache.takeFromCache(CACHE_IDX); if (context == null) { context = new FilterChainContext(); } context.setConnection(connection); context.setCloseable(closeable); context.getTransportContext().isBlocking = connection.isBlocking(); return context; }
@Override public NextAction handleRead(final FilterChainContext ctx) throws IOException { // blocking mode means this read is initiated from HttpHandler if (!ctx.getTransportContext().isBlocking()) { // create a plug for this FilterChainContext final Plug plug = Plug.create(ctx, this); ctx.getInternalContext().addLifeCycleListener(plug); plugAttr.set(ctx, plug); } return ctx.getInvokeAction(); }
@Override public NextAction handleRead(final FilterChainContext ctx) throws IOException { // blocking mode means this read is initiated from HttpHandler if (!ctx.getTransportContext().isBlocking()) { // create a plug for this FilterChainContext final Plug plug = Plug.create(ctx, this); ctx.getInternalContext().addLifeCycleListener(plug); plugAttr.set(ctx, plug); } return ctx.getInvokeAction(); }
@Override public NextAction handleRead(final FilterChainContext ctx) throws IOException { // blocking mode means this read is initiated from HttpHandler if (!ctx.getTransportContext().isBlocking()) { // create a plug for this FilterChainContext final Plug plug = Plug.create(ctx, this); ctx.getInternalContext().addLifeCycleListener(plug); plugAttr.set(ctx, plug); } return ctx.getInvokeAction(); }
@Override public NextAction handleRead(final FilterChainContext ctx) throws IOException { // blocking mode means this read is initiated from HttpHandler if (!ctx.getTransportContext().isBlocking()) { // create a plug for this FilterChainContext final Plug plug = Plug.create(ctx, this); ctx.getInternalContext().addLifeCycleListener(plug); plugAttr.set(ctx, plug); } return ctx.getInvokeAction(); }
@Override public NextAction handleRead(final FilterChainContext ctx) throws IOException { // blocking mode means this read is initiated from HttpHandler if (!ctx.getTransportContext().isBlocking()) { // create a plug for this FilterChainContext final Plug plug = Plug.create(ctx, this); ctx.getInternalContext().addLifeCycleListener(plug); plugAttr.set(ctx, plug); } return ctx.getInvokeAction(); }