private void doResults ( HttpServletRequest req , HttpServletResponse resp ) throws IOException , JsonGenerationException , JsonMappingException { Map < String , Object > result = new HashMap < String , Object > ( ) ; String requestIds = req . getParameter ( "ids" ) ; if ( ! isEmpty ( requestIds ) ) { List < Map < String , Object > > requests = new ArrayList < Map < String , Object > > ( ) ; for ( String requestId : requestIds . split ( "," ) ) { requestId = requestId . trim ( ) ; @ SuppressWarnings ( "unchecked" ) Map < String , Object > requestData = ( Map < String , Object > ) ms . get ( String . format ( MiniProfilerFilter . MEMCACHE_KEY_FORMAT_STRING , requestId ) ) ; if ( requestData != null ) { Map < String , Object > request = new HashMap < String , Object > ( ) ; request . put ( "id" , requestId ) ; request . put ( "redirect" , requestData . get ( "redirect" ) ) ; request . put ( "requestURL" , requestData . get ( "requestURL" ) ) ; request . put ( "timestamp" , requestData . get ( "timestamp" ) ) ; request . put ( "profile" , requestData . get ( "profile" ) ) ; if ( requestData . containsKey ( "appstatsId" ) ) { Map < String , Object > appstatsMap = MiniProfilerAppstats . getAppstatsDataFor ( ( String ) requestData . get ( "appstatsId" ) , maxStackFrames ) ; request . put ( "appstats" , appstatsMap != null ? appstatsMap : null ) ; } else { request . put ( "appstats" , null ) ; } requests . add ( request ) ; } } result . put ( "ok" , true ) ; result . put ( "requests" , requests ) ; } else { result . put ( "ok" , false ) ; } resp . setContentType ( "application/json" ) ; resp . setHeader ( "Cache-Control" , "no-cache" ) ; ObjectMapper jsonMapper = new ObjectMapper ( ) ; jsonMapper . writeValue ( resp . getOutputStream ( ) , result ) ; }
Generate the results for a set of requests in JSON format .