public void doGetDAS(ReqState rs) throws Exception { HttpServletResponse response = rs.getResponse(); GuardedDataset ds = null; try { ds = getDataset(rs); if (ds == null) return; response.setContentType("text/plain"); response.setHeader("XDODS-Server", getServerVersion()); response.setHeader("Content-Description", "dods-das"); OutputStream Out = new BufferedOutputStream(response.getOutputStream()); DAS myDAS = ds.getDAS(); myDAS.print(Out); } finally { // release lock if needed if (ds != null) ds.release(); } }
/** @param args command line arguments */ public static void main(String[] args) { DConnect2 dc; for (String url : args) { try { System.out.println(""); System.out.println(""); System.out.println("########################################################"); System.out.println("\nConnecting to " + url + "\n"); dc = new DConnect2(url); System.out.println("\n- - - - - - - - - - - - - - - - - - -"); System.out.println("Retrieving DDS:\n"); DDS dds = dc.getDDS(); dds.print(System.out); System.out.println("\n- - - - - - - - - - - - - - - - - - -"); System.out.println("Retrieving DAS:\n"); DAS das = dc.getDAS(); das.print(System.out); System.out.println("\n- - - - - - - - - - - - - - - - - - -"); System.out.println("Retrieving DATA:\n"); dds = dc.getData(""); dds.printVal(System.out, ""); System.out.println("\n- - - - - - - - - - - - - - - - - - -"); System.out.println("Retrieving DDX:\n"); dds = dc.getDDX(); dds.printXML(System.out); } catch (Throwable t) { t.printStackTrace(System.err); } } }