/** * Callback to write data from the buffer. */ protected void flush(boolean explicit) throws IOException { if (explicit && !finished) { // Send the flush message output(flushMessageArray, 0, flushMessageArray.length); } }
/** * Callback to write data from the buffer. */ protected void flush(boolean explicit) throws IOException { // Calling code should ensure that there is no data in the buffers for // non-blocking writes. // TODO Validate the assertion above if (explicit && !finished) { // Send the flush message output(flushMessageArray, 0, flushMessageArray.length, true); } }
/** * Callback to write data from the buffer. */ protected void flush(boolean explicit) throws IOException { if (explicit && !finished) { // Send the flush message output(flushMessageArray, 0, flushMessageArray.length); } }
/** * Get more request body data from the web server and store it in the * internal buffer. * * @return true if there is more data, false if not. */ protected boolean refillReadBuffer() throws IOException { // If the server returns an empty packet, assume that that end of // the stream has been reached (yuck -- fix protocol??). // FORM support if (replay) { endOfStream = true; // we've read everything there is } if (endOfStream) { return false; } // Request more data immediately output(getBodyMessageArray, 0, getBodyMessageArray.length); boolean moreData = receive(); if( !moreData ) { endOfStream = true; } return moreData; }
/** * Get more request body data from the web server and store it in the * internal buffer. * * @return true if there is more data, false if not. */ protected boolean refillReadBuffer() throws IOException { // If the server returns an empty packet, assume that that end of // the stream has been reached (yuck -- fix protocol??). // FORM support if (replay) { endOfStream = true; // we've read everything there is } if (endOfStream) { return false; } // Request more data immediately output(getBodyMessageArray, 0, getBodyMessageArray.length); boolean moreData = receive(); if( !moreData ) { endOfStream = true; } return moreData; }
/** * Get more request body data from the web server and store it in the * internal buffer. * * @return true if there is more data, false if not. */ protected boolean refillReadBuffer(boolean block) throws IOException { // If the server returns an empty packet, assume that that end of // the stream has been reached (yuck -- fix protocol??). // FORM support if (replay) { endOfStream = true; // we've read everything there is } if (endOfStream) { return false; } // Request more data immediately if (!first && !waitingForBodyMessage) { output(getBodyMessageArray, 0, getBodyMessageArray.length, true); waitingForBodyMessage = true; } boolean moreData = receive(block); if (!moreData && ((first && !bodyPresent) || (!first && !waitingForBodyMessage))) { endOfStream = true; } return moreData; }
private void writeResponseMessage(boolean block) throws IOException { int len = responseMessage.getLen(); int written = 1; if (responseMsgPos == -1) { // New message. Advance the write position to the beginning responseMsgPos = 0; } while (written > 0 && responseMsgPos < len) { written = output( responseMessage.getBuffer(), responseMsgPos, len, block); responseMsgPos += written; } // Message fully written, reset the position for a new message. if (responseMsgPos == len) { responseMsgPos = -1; } }
/** * Finish AJP response. */ protected void finish() throws IOException { if (!response.isCommitted()) { // Validate and write response headers try { prepareResponse(); } catch (IOException e) { // Set error flag error = true; } } if (finished) return; finished = true; // Swallow the unread body packet if present if (first && request.getContentLengthLong() > 0 || waitingForBodyMessage) { receive(true); } // Add the end message if (error) { output(endAndCloseMessageArray, 0, endAndCloseMessageArray.length, true); } else { output(endMessageArray, 0, endMessageArray.length, true); } }
/** * Finish AJP response. */ protected void finish() throws IOException { if (!response.isCommitted()) { // Validate and write response headers try { prepareResponse(); } catch (IOException e) { // Set error flag error = true; } } if (finished) return; finished = true; // Swallow the unread body packet if present if (first && request.getContentLengthLong() > 0) { receive(); } // Add the end message if (error) { output(endAndCloseMessageArray, 0, endAndCloseMessageArray.length); } else { output(endMessageArray, 0, endMessageArray.length); } }
/** * Finish AJP response. */ protected void finish() throws IOException { if (!response.isCommitted()) { // Validate and write response headers try { prepareResponse(); } catch (IOException e) { // Set error flag error = true; } } if (finished) return; finished = true; // Swallow the unread body packet if present if (first && request.getContentLengthLong() > 0) { receive(); } // Add the end message if (error) { output(endAndCloseMessageArray, 0, endAndCloseMessageArray.length); } else { output(endMessageArray, 0, endMessageArray.length); } }
output(responseMessage.getBuffer(), 0, responseMessage.getLen());
output(responseHeaderMessage.getBuffer(), 0, responseHeaderMessage.getLen());
output(responseMessage.getBuffer(), 0, responseMessage.getLen());
output(responseMessage.getBuffer(), 0, responseMessage.getLen(), true);
output(pongMessageArray, 0, pongMessageArray.length, true); } catch (IOException e) { error = true;