DConnect url;
    public static void sendASCII(HttpServletRequest request,                                 HttpServletResponse response,                                 ReqState rs) throws PPTException, DODSException, DDSException, ParseException, IOException {        if (Debug.isSet("showResponse"))            System.out.println("Sending OPeNDAP ASCII Data For: " + rs.getDataset() +                    "    CE: '" + request.getQueryString() + "'");        String requestURL, ce;        DConnect url;        DataDDS dds;        if (request.getQueryString() == null) {            ce = "";        } else {            ce = "?" + request.getQueryString();        }        int suffixIndex = request.getRequestURL().toString().lastIndexOf(".");        requestURL = request.getRequestURL().substring(0, suffixIndex);        if (Debug.isSet("showResponse")) {            System.out.println("New Request URL Resource: '" + requestURL + "'");            System.out.println("New Request Constraint Expression: '" + ce + "'");        }        ServerVersion sv = new ServerVersion(rs.getXDODSServer());        if (Debug.isSet("asciiResponse")) {            System.out.println("    Major Server Version: " + sv.getMajor());            System.out.println("    Minor Server Version: " + sv.getMinor());        }        ByteArrayOutputStream os = new ByteArrayOutputStream();        BesAPI.getDODS(rs.getDataset(), rs.getConstraintExpression(), os);        ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());        dds = new DataDDS(sv, new asciiFactory());        dds.parse(new HeaderInputStream(is));        dds.readData(is, null);        if (Debug.isSet("asciiResponse")) System.out.println(" ASCII DDS: ");        if (Debug.isSet("asciiResponse")) dds.print(System.out);        PrintWriter pw = new PrintWriter(response.getOutputStream());        PrintWriter pwDebug = new PrintWriter(System.out);        //pw.println("<pre>");        dds.print(pw);        pw.println("---------------------------------------------");        String s = "";        Enumeration e = dds.getVariables();        while (e.hasMoreElements()) {            BaseType bt = (BaseType) e.nextElement();            if (Debug.isSet("asciiResponse")) ((toASCII) bt).toASCII(pwDebug, true, null, true);            //bt.toASCII(pw,addName,getNAme(),true);            ((toASCII) bt).toASCII(pw, true, null, true);        }        //pw.println("</pre>");        pw.flush();        if (Debug.isSet("asciiResponse")) pwDebug.flush();        if (Debug.isSet("asciiResponse")) System.out.println(" dodsASCII done");    }