ThreadWithAttributes twa = null;
if (Thread.currentThread() instanceof ThreadWithAttributes) {
twa = (ThreadWithAttributes) Thread.currentThread();
}
Object control=ep.getControl();
MessageBytes tmpMB=(MessageBytes)ep.getNote( tmpBufNote );
if( tmpMB==null ) {
tmpMB= MessageBytes.newInstance();
ep.setNote( tmpBufNote, tmpMB);
}
if( log.isLoggable(Level.FINEST) )
log.finest( "Handling " + type );
switch( type ) {
case AjpConstants.JK_AJP13_FORWARD_REQUEST:
try {
if (twa != null) {
twa.setCurrentStage(control, "JkDecode");
}
decodeRequest( msg, ep, tmpMB );
if (twa != null) {
twa.setCurrentStage(control, "JkService");
twa.setParam(control,
((Request)ep.getRequest()).unparsedURI());
}
} catch( Exception ex ) {
/* If we are here it is because we have a bad header or something like that */
log.log(Level.SEVERE, "Error decoding request ", ex );
msg.dump( "Incomming message");
Response res=ep.getRequest().getResponse();
if ( res==null ) {
res=new Response();
ep.getRequest().setResponse(res);
}
res.setMessage("Bad Request");
res.setStatus(400);
return ERROR;
}
if( requiredSecret != null ) {
String epSecret=(String)ep.getNote( secretNote );
if( epSecret==null || ! requiredSecret.equals( epSecret ) )
return ERROR;
}
/* XXX it should be computed from request, by workerEnv */
if(log.isLoggable(Level.FINEST) )
log.finest("Calling next " + next.getName() + " " +
next.getClass().getName());
int err= next.invoke( msg, ep );
if (twa != null) {
twa.setCurrentStage(control, "JkDone");
}
if( log.isLoggable(Level.FINEST) )
log.finest( "Invoke returned " + err );
return err;
case AjpConstants.JK_AJP13_SHUTDOWN:
String epSecret=null;
if( msg.getLen() > 3 ) {
// we have a secret
msg.getBytes( tmpMB );
epSecret=tmpMB.toString();
}
if( requiredSecret != null &&
requiredSecret.equals( epSecret ) ) {
if( log.isLoggable(Level.FINEST) )