opendap/dtswar/src/main/java/opendap/dts/DTSServlet.java
public void doGetDDX(ReqState rs)
            throws Exception
    {
        if(Debug.isSet("showResponse")) {
            log.debug("doGetDDX for dataset: " + rs.getDataSet());
        }

        GuardedDataset ds = null;
        try {
            ds = getDataset(rs);
            if(null == ds) return;

            rs.getResponse().setContentType("text/plain");
            rs.getResponse().setHeader("XDODS-Server", getServerVersion());
            rs.getResponse().setHeader("Content-Description", "dods-ddx");
            // Commented because of a bug in the OPeNDAP C++ stuff...
            // rs.getResponse().setHeader("Content-Encoding", "plain");

            OutputStream Out = new BufferedOutputStream(rs.getResponse().getOutputStream());

            // Utilize the getDDS() method to get a parsed and populated DDS
            // for this server.
            ServerDDS myDDS = ds.getDDS();

            if(rs.getConstraintExpression().equals("")) { // No Constraint Expression?
                // Send the whole DDS
                myDDS.printXML(Out);
                Out.flush();
            } else { // Otherwise, send the constrained DDS

                // Instantiate the CEEvaluator and parse the constraint expression
                CEEvaluator ce = new CEEvaluator(myDDS);
                ce.parseConstraint(rs);

                // Send the constrained DDS back to the client
                PrintWriter pw = new PrintWriter(new OutputStreamWriter(Out, Util.UTF8));
                myDDS.printConstrainedXML(pw);
                pw.flush();
            }

            rs.getResponse().setStatus(HttpServletResponse.SC_OK);
            if(Debug.isSet("showResponse")) {
                if(rs.getConstraintExpression().equals("")) { // No Constraint Expression?
//          log.debug("Unconstrained DDX=\n");
//          myDDS.printXML(System.out);
                } else {
//          log.debug("Constrained DDX=\n");
//          myDDS.printConstrainedXML(System.out);
                }
            }
        } catch (ParseException pe) {
            parseExceptionHandler(pe, rs.getResponse());
        } catch (DAP2Exception de) {
            dap2ExceptionHandler(de, rs.getResponse());
        } catch (IOException pe) {
            IOExceptionHandler(pe, rs);
        } catch (Throwable t) {
            anyExceptionHandler(t, rs);
        } finally { // release lock if needed
            if(ds != null) ds.release();
        }

    }
public void doGetDDX(ReqState rs)
            throws Exception
    {
        if(Debug.isSet("showResponse")) {
            log.debug("doGetDDX for dataset: " + rs.getDataSet());
        }

        GuardedDataset ds = null;
        try {
            ds = getDataset(rs);
            if(null == ds) return;

            rs.getResponse().setContentType("text/plain");
            rs.getResponse().setHeader("XDODS-Server", getServerVersion());
            rs.getResponse().setHeader("Content-Description", "dods-ddx");
            // Commented because of a bug in the OPeNDAP C++ stuff...
            // rs.getResponse().setHeader("Content-Encoding", "plain");

            OutputStream Out = new BufferedOutputStream(rs.getResponse().getOutputStream());

            // Utilize the getDDS() method to get a parsed and populated DDS
            // for this server.
            ServerDDS myDDS = ds.getDDS();

            if(rs.getConstraintExpression().equals("")) { // No Constraint Expression?
                // Send the whole DDS
                myDDS.printXML(Out);
                Out.flush();
            } else { // Otherwise, send the constrained DDS

                // Instantiate the CEEvaluator and parse the constraint expression
                CEEvaluator ce = new CEEvaluator(myDDS);
                ce.parseConstraint(rs);

                // Send the constrained DDS back to the client
                PrintWriter pw = new PrintWriter(new OutputStreamWriter(Out, Util.UTF8));
                myDDS.printConstrainedXML(pw);
                pw.flush();
            }

            rs.getResponse().setStatus(HttpServletResponse.SC_OK);
            if(Debug.isSet("showResponse")) {
                if(rs.getConstraintExpression().equals("")) { // No Constraint Expression?
//          log.debug("Unconstrained DDX=\n");
//          myDDS.printXML(System.out);
                } else {
//          log.debug("Constrained DDX=\n");
//          myDDS.printConstrainedXML(System.out);
                }
            }
        } catch (ParseException pe) {
            parseExceptionHandler(pe, rs.getResponse());
        } catch (DAP2Exception de) {
            dap2ExceptionHandler(de, rs.getResponse());
        } catch (IOException pe) {
            IOExceptionHandler(pe, rs);
        } catch (Throwable t) {
            anyExceptionHandler(t, rs);
        } finally { // release lock if needed
            if(ds != null) ds.release();
        }

    }
Handler for the client's DDX request. Requires the getDDX() method
implemented by each server localization effort.
<p>
<p>Once the DDX has been parsed and constrained it is sent to the
requesting client.

@param rs The ReqState of this client request. Contains all kinds of
important stuff.
@see ReqState