/** Example of reading request by chunk and getting values from chunk to chunk */ private void readHttpDataChunkByChunk() { try { while (decoder.hasNext()) { InterfaceHttpData data = decoder.next(); if (data != null) { // check if current HttpData is a FileUpload and previously set as partial if (partialContent == data) { logger.info(" 100% (FinalSize: " + partialContent.length() + ")"); partialContent = null; } try { // new value writeHttpData(data); } finally { data.release(); } } } // Check partial decoding for a FileUpload InterfaceHttpData data = decoder.currentPartialHttpData(); if (data != null) { StringBuilder builder = new StringBuilder(); if (partialContent == null) { partialContent = (HttpData) data; if (partialContent instanceof FileUpload) { builder .append("Start FileUpload: ") .append(((FileUpload) partialContent).getFilename()) .append(" "); } else { builder.append("Start Attribute: ").append(partialContent.getName()).append(" "); } builder.append("(DefinedSize: ").append(partialContent.definedLength()).append(")"); } if (partialContent.definedLength() > 0) { builder .append(" ") .append(partialContent.length() * 100 / partialContent.definedLength()) .append("% "); logger.info(builder.toString()); } else { builder.append(" ").append(partialContent.length()).append(" "); logger.info(builder.toString()); } } } catch (EndOfDataDecoderException e1) { // end responseContent.append("\r\n\r\nEND OF CONTENT CHUNK BY CHUNK\r\n\r\n"); } }