@Override public RES next(REQ req){
  writeTraceLog(req,middlewareName);
  if (predicate.test(req)) {
    RES res=middleware.handle(req,next);
    writeTraceLog(res,middlewareName);
    return res;
  }
 else   if (next != null) {
    RES res=(RES)next.next(req);
    writeTraceLog(res,middlewareName);
    return res;
  }
 else {
    return null;
  }
}

@ Override public RES next ( REQ req ) { writeTraceLog ( req , middlewareName ) ; if ( predicate . test ( req ) ) { RES res = middleware . handle ( req , next ) ; writeTraceLog ( res , middlewareName ) ; return res ; } else if ( next != null ) { RES res = ( RES ) next . next ( req ) ; writeTraceLog ( res , middlewareName ) ; return res ; } else { return null ; } }
dispatches a request to the next chain of middleware .
