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; }
final CompletionHandler<WriteResult> handler = ((last) ? new LastPacketCompletionHandler() : null); feedableBodyGenerator.context.write(content, handler);
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>() {
.build(); buffer.allowBufferDispose(false); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null));
/** * Acknowledge a HTTP <code>Expect</code> header. The response status * code and reason phrase should be set before invoking this method. * * @throws IOException if an error occurs writing the acknowledgment. */ public void acknowledge() throws IOException { ctx.write(outputHeader, IS_BLOCKING); }
public void write(final Object message, final CompletionHandler<WriteResult> completionHandler, final boolean blocking) { write(null, message, completionHandler, null, null, blocking); }
public void write(final Object address, final Object message, final CompletionHandler<WriteResult> completionHandler, final boolean blocking) { write(address, message, completionHandler, null, null, blocking); }
public void write(final Object message, final CompletionHandler<WriteResult> completionHandler, final boolean blocking) { write(null, message, completionHandler, null, null, blocking); }
public void write(final Object message, final CompletionHandler<WriteResult> completionHandler, final boolean blocking) { write(null, message, completionHandler, null, null, blocking); }
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; }
@Deprecated public void write(final Object address, final Object message, final CompletionHandler<WriteResult> completionHandler, final org.glassfish.grizzly.asyncqueue.PushBackHandler pushBackHandler) { write(address, message, completionHandler, pushBackHandler, transportFilterContext.isBlocking()); }
public void write(final Object message, final CompletionHandler<WriteResult> completionHandler) { write(null, message, completionHandler, null, null, transportFilterContext.isBlocking()); }
requestPacket.httpContentBuilder().content(buffer). last(last).build(); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null));
private void handleUnsupportedVersion(final FilterChainContext ctx, final HttpRequestPacket request) throws IOException { unsupportedVersionsResponseBuilder.requestPacket(request); ctx.write(unsupportedVersionsResponseBuilder.build()); }
private void sendSettingsAck(final Http2Session http2Session, final FilterChainContext context) { final SettingsFrame frame = SettingsFrame.builder() .setAck() .build(); context.write( frameCodec.serializeAndRecycle( http2Session, frame) ); }
private void commitAndCloseAsError(FilterChainContext ctx, HttpResponsePacket response) { final HttpContent errorHttpResponse = customizeErrorResponse(response); final Buffer resBuf = encodeHttpPacket(ctx, errorHttpResponse); ctx.write(resBuf); response.getProcessingState().getHttpContext().close(); }
@Override public NextAction handleRead(FilterChainContext ctx) throws IOException { ctx.write(new FileTransfer(f)); return ctx.getStopAction(); } });