public void handle(HttpExchange exchange)
    throws IOException 
    {

        String httpMethod = exchange.getRequestMethod();
    
        if ( "Post".equalsIgnoreCase(httpMethod) ) {
            Headers respHeaders = exchange.getResponseHeaders();
	    String requestBody = readPostRequest(exchange);
            Map<String, String>
                parameters = parseRequestBody(requestBody);

            OutputStream respBody = exchange.getResponseBody(); 

            String[] nodes = null;
            String  urlPat = null;

            for( Map.Entry<String, String>
                entry : parameters.entrySet() ) 
            {
                if ( entry.getKey().equals("nodes") ) {
                    nodes = entry.getValue().split(",");
                }
                if ( entry.getKey().equals("urlPat") ) {
                    urlPat = entry.getValue();   
                } 
            }

            StringBuilder sb = new StringBuilder();
            sb.append("<html><body>OK<br/>\n");
            if ( nodes != null && urlPat != null ) {
                MetricsChecker checker = new MetricsChecker(nodes, urlPat, newSeqNumber());
                addChecker(checker);
                sb.append("request received - session sequence number: " 
                          + checker.getSeqNumber() 
                          + "<br/>\n"
                         );
                Thread t = new Thread(checker);
                t.start();
            }
	    sb.append("</body></html>\n");

            String resp = sb.toString();
	    exchange.sendResponseHeaders(200, resp.length());
	    respBody.write(resp.getBytes());
            respBody.close();
        }  
        else if ( "Get".equalsIgnoreCase(httpMethod) ) {

            URI requestedUri = exchange.getRequestURI();
            String query = requestedUri.getRawQuery();
            String[] parts = query.split("=");
        
            String key = parts[0];
            String val = parts[1];

            if ( !key.equals("seqNum") ) 
                return; 
 
            Long seqNum = Long.parseLong(val);

	    exchange.sendResponseHeaders(200, 0);
            OutputStream respBody = exchange.getResponseBody(); 
            MetricsChecker ck = checkerMap.get(seqNum);
	    if ( ck == null ) {
	        respBody.write(("invalid sequence number: " + val).getBytes());
            } else {         
	        respBody.write(ck.status().getBytes());
            }
            respBody.close();
        }
    }