1 16 17 package org.apache.jk.common; 18 19 import java.io.IOException ; 20 21 import org.apache.jk.core.JkHandler; 22 import org.apache.jk.core.Msg; 23 import org.apache.jk.core.MsgContext; 24 import org.apache.jk.core.WorkerEnv; 25 import org.apache.tomcat.util.buf.MessageBytes; 26 27 28 31 public class WorkerDummy extends JkHandler 32 { 33 public WorkerDummy() 34 { 35 String msg="HelloWorld"; 36 byte b[]=msg.getBytes(); 37 body.setBytes(b, 0, b.length); 38 } 39 40 41 42 45 public void init() throws IOException { 46 headersMsgNote=wEnv.getNoteId( WorkerEnv.ENDPOINT_NOTE, "headerMsg" ); 47 } 48 49 MessageBytes body=MessageBytes.newInstance(); 50 private int headersMsgNote; 51 52 public int invoke( Msg in, MsgContext ep ) 53 throws IOException 54 { 55 MsgAjp msg=(MsgAjp)ep.getNote( headersMsgNote ); 56 if( msg==null ) { 57 msg=new MsgAjp(); 58 ep.setNote( headersMsgNote, msg ); 59 } 60 61 msg.reset(); 62 msg.appendByte(HandlerRequest.JK_AJP13_SEND_HEADERS); 63 msg.appendInt(200); 64 msg.appendBytes(null); 65 66 msg.appendInt(0); 67 68 ep.setType( JkHandler.HANDLE_SEND_PACKET ); 69 ep.getSource().invoke( msg, ep ); 70 72 msg.reset(); 73 msg.appendByte( HandlerRequest.JK_AJP13_SEND_BODY_CHUNK); 74 msg.appendInt( body.getLength() ); 75 msg.appendBytes( body ); 76 77 78 ep.getSource().invoke(msg, ep); 79 80 msg.reset(); 81 msg.appendByte( HandlerRequest.JK_AJP13_END_RESPONSE ); 82 msg.appendInt( 1 ); 83 84 ep.getSource().invoke(msg, ep ); 85 return OK; 86 } 87 88 private static final int dL=0; 89 } 90 91 | Popular Tags |