/** *WriteaMessageBytesoutatthecurrentwriteposition.AnullMessageBytesisencodedasastringwithlength0. * *@parammbThedatatowrite
*/ publicvoid appendBytes(MessageBytes mb) { if (mb == null) {
log.error(sm.getString("ajpmessage.null"), new NullPointerException());
appendInt(0);
appendByte(0); return;
} if (mb.getType() != MessageBytes.T_BYTES) {
mb.toBytes();
ByteChunk bc = mb.getByteChunk(); // Need to filter out CTLs excluding TAB. ISO-8859-1 and UTF-8 // values will be OK. Strings using other encodings may be // corrupted. byte[] buffer = bc.getBuffer(); for (int i = bc.getOffset(); i < bc.getLength(); i++) { // byte values are signed i.e. -128 to 127 // The values are used unsigned. 0 to 31 are CTLs so they are // filtered (apart from TAB which is 9). 127 is a control (DEL). // The values 128 to 255 are all OK. Converting those to signed // gives -128 to -1. if ((buffer[i] > -1 && buffer[i] <= 31 && buffer[i] != 9) || buffer[i] == 127) {
buffer[i] = ' ';
}
}
}
appendByteChunk(mb.getByteChunk());
}
publicint processHeader(boolean toContainer) {
pos = 0; int mark = getInt();
len = getInt(); // Verify message signature if ((toContainer && mark != 0x1234) || (!toContainer && mark != 0x4142)) {
log.error(sm.getString("ajpmessage.invalid", "" + mark)); if (log.isDebugEnabled()) {
dump("In");
} return -1;
} if (log.isDebugEnabled()) {
log.debug("Received " + len + " " + buf[0]);
} return len;
}
privatevoid dump(String prefix) { if (log.isDebugEnabled()) {
log.debug(prefix + ": " + HexUtils.toHexString(buf) + " " + pos + "/" + (len + 4));
} int max = pos; if (len + 4 > pos) {
max = len + 4;
} if (max > 1000) {
max = 1000;
} if (log.isDebugEnabled()) { for (int j = 0; j < max; j += 16) {
log.debug(hexLine(buf, j, len));
}
}
}
privatevoid validatePos(int posToTest) { if (posToTest > len + 4) { // Trying to read data beyond the end of the AJP message thrownew ArrayIndexOutOfBoundsException(sm.getString("ajpMessage.invalidPos", Integer.valueOf(posToTest)));
}
} // ------------------------------------------------------ Protected Methods
protectedstatic String hexLine(byte buf[], int start, int len) {
StringBuilder sb = new StringBuilder(); for (int i = start; i < start + 16; i++) { if (i < len + 4) {
sb.append(hex(buf[i])).append(' ');
} else {
sb.append(" ");
}
}
sb.append(" | "); for (int i = start; i < start + 16 && i < len + 4; i++) { if (!Character.isISOControl((char) buf[i])) {
sb.append(Character.valueOf((char) buf[i]));
} else {
sb.append('.');
}
} return sb.toString();
}
protectedstatic String hex(int x) {
String h = Integer.toHexString(x); if (h.length() == 1) {
h = "0" + h;
} return h.substring(h.length() - 2);
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-10-04)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.