FileDocCategorySizeDatePackage
Msg.javaAPI DocApache Tomcat 6.0.145110Fri Jul 20 04:20:36 BST 2007org.apache.jk.core

Msg

public abstract class Msg extends Object
A single packet for communication between the web server and the container. In a more generic sense, it's the event that drives the processing chain. XXX Use Event, make Msg a particular case.
author
Henri Gomez [hgomez@apache.org]
author
Dan Milstein [danmil@shore.net]
author
Keith Wannamaker [Keith@Wannamaker.org]
author
Kevin Seguin
author
Costin Manolache

Fields Summary
Constructors Summary
Methods Summary
public abstract voidappendByte(int val)

public abstract voidappendByteChunk(org.apache.tomcat.util.buf.ByteChunk bc)

public abstract voidappendBytes(org.apache.tomcat.util.buf.MessageBytes mb)

public abstract voidappendBytes(byte[] b, int off, int numBytes)
Copy a chunk of bytes into the packet, starting at the current write position. The chunk of bytes is encoded with the length in two bytes first, then the data itself, and finally a terminating \0 (which is not included in the encoded length).

param
b The array from which to copy bytes.
param
off The offset into the array at which to start copying
param
numBytes The number of bytes to copy.

public abstract voidappendInt(int val)

public abstract voidappendLongInt(int val)

public abstract voiddump(java.lang.String msg)

public abstract voidend()
For a packet to be sent to the web server, finish the process of accumulating data and write the length of the data payload into the header.

public abstract byte[]getBuffer()

public abstract bytegetByte()

public abstract voidgetBytes(org.apache.tomcat.util.buf.MessageBytes mb)

public abstract intgetBytes(byte[] dest)
Copy a chunk of bytes from the packet into an array and advance the read position past the chunk. See appendBytes() for details on the encoding.

return
The number of bytes copied.

public abstract intgetHeaderLength()

public abstract intgetInt()
Read an integer from packet, and advance the read position past it. Integers are encoded as two unsigned bytes with the high-order byte first, and, as far as I can tell, in little-endian order within each byte.

public abstract intgetLen()

public abstract intgetLongInt()
Read a 32 bits integer from packet, and advance the read position past it. Integers are encoded as four unsigned bytes with the high-order byte first, and, as far as I can tell, in little-endian order within each byte.

private static java.lang.Stringhex(int x)

        //	    if( x < 0) x=256 + x;
        String h=Integer.toHexString( x );
        if( h.length() == 1 ) h = "0" + h;
        return h.substring( h.length() - 2 );
    
public static java.lang.StringhexLine(byte[] buf, int start, int len)

        StringBuffer sb=new StringBuffer();
        for( int i=start; i< start+16 ; i++ ) {
            if( i < len + 4)
                sb.append( hex( buf[i] ) + " ");
            else
                sb.append( "   " );
        }
        sb.append(" | ");
        for( int i=start; i < start+16 && i < len + 4; i++ ) {
            if( ! Character.isISOControl( (char)buf[i] ))
                sb.append( new Character((char)buf[i]) );
            else
                sb.append( "." );
        }
        return sb.toString();
    
public abstract bytepeekByte()

public abstract intpeekInt()

public abstract intprocessHeader()

public abstract voidreset()
Prepare this packet for accumulating a message from the container to the web server. Set the write position to just after the header (but leave the length unwritten, because it is as yet unknown).