@Override public void updated(WriteResult result) { final AsyncHandler ah = context.getAsyncHandler(); if (ah instanceof TransferCompletionHandler) { final long written = result.getWrittenSize(); context.totalBodyWritten += written; final long total = context.totalBodyWritten; ((TransferCompletionHandler) ah).onContentWriteProgress( written, total, requestPacket.getContentLength()); } } });
.last(true) .build(); if (requestPacket.getContentLength() == -1) { requestPacket.setContentLengthLong(data.length);
/** * Return the content length for this Request. */ public int getContentLength() { return (int) request.getContentLength(); }
/** * Return the content length for this Request. */ public int getContentLength() { return (int) request.getContentLength(); }
/** * Return the content length for this Request represented by Java long type. */ public long getContentLengthLong() { return request.getContentLength(); }
/** * Return the content length for this Request. */ public int getContentLength() { return (int) request.getContentLength(); }
/** * Return the content length for this Request. */ public int getContentLength() { return (int) request.getContentLength(); }
/** * Return the content length for this Request. */ public int getContentLength() { return (int) request.getContentLength(); }
/** * Return the content length for this Request represented by Java long type. */ public long getContentLengthLong() { return request.getContentLength(); }
/** * Return the content length for this Request represented by Java long type. */ public long getContentLengthLong() { return request.getContentLength(); }
/** * Return the content length for this Request. */ public int getContentLength() { return (int) request.getContentLength(); }
/** * Return the content length for this Request represented by Java long type. */ public long getContentLengthLong() { return request.getContentLength(); }
/** * Return the content length for this Request. */ public int getContentLength() { return (int) request.getContentLength(); }
/** * Return the content length for this Request represented by Java long type. */ public long getContentLengthLong() { return request.getContentLength(); }
/** * Return the content length for this Request represented by Java long type. */ public long getContentLengthLong() { return request.getContentLength(); }
@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; }
requestPacket.setContentType(contentType); if (LOGGER.isDebugEnabled()) { LOGGER.debug("REQUEST(modified): contentLength={}, contentType={}", new Object[]{requestPacket.getContentLength(), requestPacket.getContentType()});
@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; }
/** * @param httpRequest * @return <tt>false</tt> if the request payload size is specified by the * content-length header and according to the request parsing state * the remaining payload size is larger than {@link #getMaxPayloadRemainderToSkip()}. * Otherwise return <tt>true</tt> */ private boolean checkContentLengthRemainder(final HttpRequestPacket httpRequest) { return maxPayloadRemainderToSkip < 0 || httpRequest.getContentLength() <= 0 || ((HttpPacketParsing) httpRequest).getContentParsingState().chunkRemainder <= maxPayloadRemainderToSkip; }
protected void prepareOutgoingRequest(final HttpRequestPacket request) { String contentType = request.getContentType(); if (contentType != null) { request.getHeaders().setValue(Header.ContentType).setString(contentType); } if (request.getContentLength() != -1) { // FixedLengthTransferEncoding will set proper Content-Length header FIXED_LENGTH_ENCODING.prepareSerialize(null, request, null); } }