/**
+ * GetBody message array. Not static like the other message arrays since the
+ * message varies with packetSize and that can vary per connector.
+ */
+ protected final byte[] getBodyMessageArray;
+
+
+ /**
* AJP packet size.
*/
protected int packetSize;
requestHeaderMessage = new AjpMessage(packetSize);
responseHeaderMessage = new AjpMessage(packetSize);
bodyMessage = new AjpMessage(packetSize);
+
+ // Set the getBody message buffer
+ AjpMessage getBodyMessage = new AjpMessage(16);
+ getBodyMessage.reset();
+ getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
+ // Adjust read size if packetSize != default (Constants.MAX_PACKET_SIZE)
+ getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize -
+ Constants.MAX_PACKET_SIZE);
+ getBodyMessage.end();
+ getBodyMessageArray = new byte[getBodyMessage.getLen()];
+ System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray,
+ 0, getBodyMessage.getLen());
}
response.setOutputBuffer(new SocketOutputBuffer());
- // Set the get body message buffer
- AjpMessage getBodyMessage = new AjpMessage(16);
- getBodyMessage.reset();
- getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
- // Adjust allowed size if packetSize != default (Constants.MAX_PACKET_SIZE)
- getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize - Constants.MAX_PACKET_SIZE);
- getBodyMessage.end();
- getBodyMessageBuffer =
- ByteBuffer.allocateDirect(getBodyMessage.getLen());
- getBodyMessageBuffer.put(getBodyMessage.getBuffer(), 0,
- getBodyMessage.getLen());
-
// Allocate input and output buffers
inputBuffer = ByteBuffer.allocateDirect(packetSize * 2);
inputBuffer.limit(0);
protected ByteBuffer outputBuffer = null;
- /**
- * Direct buffer used for sending right away a get body message.
- */
- protected final ByteBuffer getBodyMessageBuffer;
-
-
// --------------------------------------------------------- Public Methods
}
// Request more data immediately
- Socket.sendb(socket.getSocket().longValue(), getBodyMessageBuffer, 0,
- getBodyMessageBuffer.position());
+ Socket.send(socket.getSocket().longValue(), getBodyMessageArray, 0,
+ getBodyMessageArray.length);
boolean moreData = receive();
if( !moreData ) {
pool = endpoint.getSelectorPool();
- // Set the get body message buffer
- AjpMessage getBodyMessage = new AjpMessage(16);
- getBodyMessage.reset();
- getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
- // Adjust allowed size if packetSize != default (Constants.MAX_PACKET_SIZE)
- getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize - Constants.MAX_PACKET_SIZE);
- getBodyMessage.end();
- getBodyMessageArray = new byte[getBodyMessage.getLen()];
- System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray,
- 0, getBodyMessage.getLen());
-
// Cause loading of HexUtils
HexUtils.load();
protected NioSelectorPool pool;
- /**
- * Direct buffer used for sending right away a get body message.
- */
- protected final byte[] getBodyMessageArray;
-
-
// --------------------------------------------------------- Public Methods
response.setOutputBuffer(new SocketOutputBuffer());
- // Set the get body message buffer
- AjpMessage getBodyMessage = new AjpMessage(16);
- getBodyMessage.reset();
- getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
- // Adjust allowed size if packetSize != default (Constants.MAX_PACKET_SIZE)
- getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize - Constants.MAX_PACKET_SIZE);
- getBodyMessage.end();
- getBodyMessageArray = new byte[getBodyMessage.getLen()];
- System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray,
- 0, getBodyMessage.getLen());
-
// Cause loading of HexUtils
HexUtils.load();
protected OutputStream output;
- /**
- * Direct buffer used for sending right away a get body message.
- */
- protected final byte[] getBodyMessageArray;
-
-
- // ------------------------------------------------------------- Properties
-
-
// --------------------------------------------------------- Public Methods