Author: markt Date: Fri Aug 30 21:57:45 2013 New Revision: 1519097 URL: http://svn.apache.org/r1519097 Log: Pull up receive
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1519097&r1=1519096&r2=1519097&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Fri Aug 30 21:57:45 2013 @@ -649,8 +649,47 @@ public abstract class AbstractAjpProcess throws IOException; // Methods used by SocketInputBuffer - protected abstract boolean receive() throws IOException; + /** Receive a chunk of data. Called to implement the + * 'special' packet in ajp13 and to receive the data + * after we send a GET_BODY packet + */ + protected boolean receive() throws IOException { + + first = false; + bodyMessage.reset(); + + readMessage(bodyMessage, true); + + // No data received. + if (bodyMessage.getLen() == 0) { + // just the header + // Don't mark 'end of stream' for the first chunk. + return false; + } + int blen = bodyMessage.peekInt(); + if (blen == 0) { + return false; + } + bodyMessage.getBodyBytes(bodyBytes); + empty = false; + return true; + } + + + /** + * Read an AJP message. + * + * @param message The message to populate + * @param block If there is no data available to read when this method is + * called, should this call block until data becomes available? + + * @return true if the message has been read, false if no data was read + * + * @throws IOException any other failure, including incomplete reads + */ + protected abstract boolean readMessage(AjpMessage message, + boolean blockOnFirstRead) throws IOException; @Override public final boolean isComet() { Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1519097&r1=1519096&r2=1519097&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Fri Aug 30 21:57:45 2013 @@ -429,35 +429,6 @@ public class AjpAprProcessor extends Abs } - /** Receive a chunk of data. Called to implement the - * 'special' packet in ajp13 and to receive the data - * after we send a GET_BODY packet - */ - @Override - public boolean receive() throws IOException { - - first = false; - bodyMessage.reset(); - - readMessage(bodyMessage, true); - - // No data received. - if (bodyMessage.getLen() == 0) { - // just the header - // Don't mark 'end of stream' for the first chunk. - return false; - } - int blen = bodyMessage.peekInt(); - if (blen == 0) { - return false; - } - - bodyMessage.getBodyBytes(bodyBytes); - empty = false; - return true; - } - - /** * Read an AJP message. * @@ -468,6 +439,7 @@ public class AjpAprProcessor extends Abs * * @throws IOException any other failure, including incomplete reads */ + @Override protected boolean readMessage(AjpMessage message, boolean block) throws IOException { Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1519097&r1=1519096&r2=1519097&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Fri Aug 30 21:57:45 2013 @@ -363,35 +363,6 @@ public class AjpNioProcessor extends Abs } - /** Receive a chunk of data. Called to implement the - * 'special' packet in ajp13 and to receive the data - * after we send a GET_BODY packet - */ - @Override - public boolean receive() throws IOException { - - first = false; - bodyMessage.reset(); - - readMessage(bodyMessage, true); - - // No data received. - if (bodyMessage.getLen() == 0) { - // just the header - // Don't mark 'end of stream' for the first chunk. - return false; - } - int blen = bodyMessage.peekInt(); - if (blen == 0) { - return false; - } - - bodyMessage.getBodyBytes(bodyBytes); - empty = false; - return true; - } - - /** * Read an AJP message. * @@ -399,6 +370,7 @@ public class AjpNioProcessor extends Abs * * @throws IOException any other failure, including incomplete reads */ + @Override protected boolean readMessage(AjpMessage message, boolean blockFirstRead) throws IOException { @@ -430,7 +402,7 @@ public class AjpNioProcessor extends Abs Integer.valueOf(messageLength), Integer.valueOf(buf.length))); } - bytesRead += read(buf, headerLength, messageLength, true); + read(buf, headerLength, messageLength, true); return true; } } Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1519097&r1=1519096&r2=1519097&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Fri Aug 30 21:57:45 2013 @@ -312,35 +312,6 @@ public class AjpProcessor extends Abstra } - /** Receive a chunk of data. Called to implement the - * 'special' packet in ajp13 and to receive the data - * after we send a GET_BODY packet - */ - @Override - public boolean receive() throws IOException { - - first = false; - bodyMessage.reset(); - - readMessage(bodyMessage, true); - - // No data received. - if (bodyMessage.getLen() == 0) { - // just the header - // Don't mark 'end of stream' for the first chunk. - return false; - } - int blen = bodyMessage.peekInt(); - if (blen == 0) { - return false; - } - - bodyMessage.getBodyBytes(bodyBytes); - empty = false; - return true; - } - - /** * Read an AJP message. * @@ -350,6 +321,7 @@ public class AjpProcessor extends Abstra * didn't return anything * @throws IOException any other failure, including incomplete reads */ + @Override protected boolean readMessage(AjpMessage message, boolean ignored) throws IOException { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org