remm 2004/10/19 08:28:13 Modified: catalina/src/share/org/apache/catalina/connector CoyoteAdapter.java Log: - Optimize session IDs conversion to String. Revision Changes Path 1.7 +28 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java Index: CoyoteAdapter.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- CoyoteAdapter.java 4 Oct 2004 09:25:11 -0000 1.6 +++ CoyoteAdapter.java 19 Oct 2004 15:28:13 -0000 1.7 @@ -366,6 +366,7 @@ // Override anything requested in the URL if (!request.isRequestedSessionIdFromCookie()) { // Accept only the first session id cookie + convertMB(scookie.getValue()); request.setRequestedSessionId (scookie.getValue().toString()); request.setRequestedSessionCookie(true); @@ -376,6 +377,7 @@ } else { if (!request.isRequestedSessionIdValid()) { // Replace the session id until one is valid + convertMB(scookie.getValue()); request.setRequestedSessionId (scookie.getValue().toString()); } @@ -432,6 +434,31 @@ cbuf[i] = (char) (bbuf[i + start] & 0xff); } uri.setChars(cbuf, 0, bc.getLength()); + + } + + + /** + * Character conversion of the a US-ASCII MessageBytes. + */ + protected void convertMB(MessageBytes mb) { + + // This is of course only meaningful for bytes + if (mb.getType() != MessageBytes.T_BYTES) + return; + + ByteChunk bc = mb.getByteChunk(); + CharChunk cc = mb.getCharChunk(); + cc.allocate(bc.getLength(), -1); + + // Default encoding: fast conversion + byte[] bbuf = bc.getBuffer(); + char[] cbuf = cc.getBuffer(); + int start = bc.getStart(); + for (int i = 0; i < bc.getLength(); i++) { + cbuf[i] = (char) (bbuf[i + start] & 0xff); + } + mb.setChars(cbuf, 0, bc.getLength()); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]