FileDocCategorySizeDatePackage
WorkerDummy.javaAPI DocApache Tomcat 6.0.142831Fri Jul 20 04:20:36 BST 2007org.apache.jk.common

WorkerDummy

public class WorkerDummy extends org.apache.jk.core.JkHandler
A dummy worker, will just send back a dummy response. Used for testing and tunning.

Fields Summary
org.apache.tomcat.util.buf.MessageBytes
body
private int
headersMsgNote
private static final int
dL
Constructors Summary
public WorkerDummy()

        String msg="HelloWorld";
        byte b[]=msg.getBytes();
        body.setBytes(b, 0, b.length);
    
Methods Summary
public voidinit()
Initialize the worker. After this call the worker will be ready to accept new requests.

        headersMsgNote=wEnv.getNoteId( WorkerEnv.ENDPOINT_NOTE, "headerMsg" );
    
public intinvoke(org.apache.jk.core.Msg in, org.apache.jk.core.MsgContext ep)

    
            
         
    
        MsgAjp msg=(MsgAjp)ep.getNote( headersMsgNote );
        if( msg==null ) {
            msg=new MsgAjp();
            ep.setNote( headersMsgNote, msg );
        }

        msg.reset();
        msg.appendByte(AjpConstants.JK_AJP13_SEND_HEADERS);
        msg.appendInt(200);
        msg.appendBytes(null);

        msg.appendInt(0);

        ep.setType( JkHandler.HANDLE_SEND_PACKET );
        ep.getSource().invoke( msg, ep );
        //         msg.dump("out:" );

        msg.reset();
        msg.appendByte( AjpConstants.JK_AJP13_SEND_BODY_CHUNK);
        msg.appendInt( body.getLength() );
        msg.appendBytes( body );

        
        ep.getSource().invoke(msg, ep);

        msg.reset();
        msg.appendByte( AjpConstants.JK_AJP13_END_RESPONSE );
        msg.appendInt( 1 );
        
        ep.getSource().invoke(msg, ep );
        return OK;