response.setContentType("text/html"); response.setHeader("XDODS-Server", rs.getXDODSServer()); response.setHeader("XOPeNDAP-Server", rs.getXOPeNDAPServer()); response.setHeader("XDAP", rs.getXDAP(request)); response.setHeader("Content-Description", "dods_description");
    public static void sendINFO(HttpServletRequest request,                                HttpServletResponse response,                                ReqState rs)            throws DODSException, ParseException, PPTException, IOException {        if (Debug.isSet("showResponse"))            System.out.println("doGetINFO For: " + rs.getDataset());        response.setContentType("text/html");        response.setHeader("XDODS-Server", rs.getXDODSServer());        response.setHeader("XOPeNDAP-Server", rs.getXOPeNDAPServer());        response.setHeader("XDAP", rs.getXDAP(request));        response.setHeader("Content-Description", "dods_description");        String responseDoc;        ServerDDS myDDS;        DAS myDAS;        OPeNDAPClient oc = BesAPI.startClient();        BesAPI.configureTransaction(oc,rs.getDataset(), rs.getConstraintExpression());        ByteArrayOutputStream os = new ByteArrayOutputStream();        BesAPI.getDataProduct(oc,BesAPI.getAPINameForDDS(),os);        ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());        myDDS = new ServerDDS(new DefaultFactory());        myDDS.parse(is);        os = new ByteArrayOutputStream();        BesAPI.getDataProduct(oc,BesAPI.getAPINameForDAS(),os);        BesAPI.shutdownClient(oc);        is = new ByteArrayInputStream(os.toByteArray());        myDAS = new DAS();        myDAS.parse(is);        String infoDir = rs.getINFOCache();        responseDoc = loadOverrideDoc(infoDir, rs.getDataset());        PrintStream pw = new PrintStream(response.getOutputStream());        if (responseDoc != null) {            if (Debug.isSet("showResponse")) System.out.println("override document: " + responseDoc);            pw.print(responseDoc);        } else {            String user_html = get_user_supplied_docs(infoDir, rs.getServerClassName(), rs.getDataset());            String global_attrs = buildGlobalAttributes(myDAS, myDDS);            String variable_sum = buildVariableSummaries(myDAS, myDDS);            // Send the document back to the client.            pw.println("<html><head><title>Dataset Information</title>");            pw.println("<style type=\"text/css\">");            pw.println("<!-- ul {list-style-type: none;} -->");            pw.println("</style>");            pw.println("</head>");            pw.println("<body>");            pw.println("<h1><center>"+rs.getDataset()+"</center></h1>");            if (global_attrs.length() > 0) {                pw.println(global_attrs);                pw.println("<hr>");            }            pw.println(variable_sum);            pw.println("<hr>");            pw.println(user_html);            pw.println("</body></html>");            // Flush the output buffer.            pw.flush();        }    }