opendap/dtswar/src/main/java/opendap/dts/DTSServlet.java
public void doGetBLOB(ReqState rs)
            throws Exception
    {
        if(Debug.isSet("showResponse")) {
            log.debug("doGetBLOB For: " + rs.getDataSet());
        }
        GuardedDataset ds = null;
        try {
            ds = getDataset(rs);
            if(ds == null) return;

            rs.getResponse().setContentType("application/octet-stream");
            rs.getResponse().setHeader("XDODS-Server", getServerVersion());
            rs.getResponse().setHeader("Content-Description", "dods-blob");

            ServletOutputStream sOut = rs.getResponse().getOutputStream();
            OutputStream bOut;
            DeflaterOutputStream dOut = null;

            if(rs.getAcceptsCompressed() && allowDeflate) {
                rs.getResponse().setHeader("Content-Encoding", "deflate");
                dOut = new DeflaterOutputStream(sOut);
                bOut = new BufferedOutputStream(dOut);
            } else {
                // Commented out because of a bug in the OPeNDAP C++ stuff...
                //rs.getResponse().setHeader("Content-Encoding", "plain");
                bOut = new BufferedOutputStream(sOut);
            }

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

            // Instantiate the CEEvaluator and parse the constraint expression
            CEEvaluator ce = new CEEvaluator(myDDS,
                    new ClauseFactory(functionLibrary));
            ce.parseConstraint(rs.getConstraintExpression(), rs.getRequestURL().toString());

            // Send the binary data back to the client
            DataOutputStream sink = new DataOutputStream(bOut);

            int seqLength = 5;
            String sls = rs.getInitParameter("SequenceLength");
            if(sls != null) {
                seqLength = (Integer.valueOf(sls)).intValue();
            }

            testEngine te = new testEngine(seqLength);

            ce.send(myDDS.getEncodedName(), sink, te);
            sink.flush();

            // Finish up sending the compressed stuff, but don't
            // close the stream (who knows what the Servlet may expect!)
            if(rs.getAcceptsCompressed()) {
                if(bOut != null)
                    bOut.flush();
                if(dOut != null)
                    ((DeflaterOutputStream) dOut).finish();
            }

            //? if(null != dOut) dOut.finish();
            //? bOut.flush();

            rs.getResponse().setStatus(HttpServletResponse.SC_OK);

        } catch (ParseException pe) {
            parseExceptionHandler(pe, rs.getResponse());
        } catch (DAP2Exception de) {
            dap2ExceptionHandler(de, rs.getResponse());
        } catch (IOException ioe) {
            IOExceptionHandler(ioe, rs);
        } finally {  // release lock if needed
            if(ds != null) ds.release();
        }

    }
public void doGetBLOB(ReqState rs)
            throws Exception
    {
        if(Debug.isSet("showResponse")) {
            log.debug("doGetBLOB For: " + rs.getDataSet());
        }
        GuardedDataset ds = null;
        try {
            ds = getDataset(rs);
            if(ds == null) return;

            rs.getResponse().setContentType("application/octet-stream");
            rs.getResponse().setHeader("XDODS-Server", getServerVersion());
            rs.getResponse().setHeader("Content-Description", "dods-blob");

            ServletOutputStream sOut = rs.getResponse().getOutputStream();
            OutputStream bOut;
            DeflaterOutputStream dOut = null;

            if(rs.getAcceptsCompressed() && allowDeflate) {
                rs.getResponse().setHeader("Content-Encoding", "deflate");
                dOut = new DeflaterOutputStream(sOut);
                bOut = new BufferedOutputStream(dOut);
            } else {
                // Commented out because of a bug in the OPeNDAP C++ stuff...
                //rs.getResponse().setHeader("Content-Encoding", "plain");
                bOut = new BufferedOutputStream(sOut);
            }

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

            // Instantiate the CEEvaluator and parse the constraint expression
            CEEvaluator ce = new CEEvaluator(myDDS,
                    new ClauseFactory(functionLibrary));
            ce.parseConstraint(rs.getConstraintExpression(), rs.getRequestURL().toString());

            // Send the binary data back to the client
            DataOutputStream sink = new DataOutputStream(bOut);

            int seqLength = 5;
            String sls = rs.getInitParameter("SequenceLength");
            if(sls != null) {
                seqLength = (Integer.valueOf(sls)).intValue();
            }

            testEngine te = new testEngine(seqLength);

            ce.send(myDDS.getEncodedName(), sink, te);
            sink.flush();

            // Finish up sending the compressed stuff, but don't
            // close the stream (who knows what the Servlet may expect!)
            if(rs.getAcceptsCompressed()) {
                if(bOut != null)
                    bOut.flush();
                if(dOut != null)
                    ((DeflaterOutputStream) dOut).finish();
            }

            //? if(null != dOut) dOut.finish();
            //? bOut.flush();

            rs.getResponse().setStatus(HttpServletResponse.SC_OK);

        } catch (ParseException pe) {
            parseExceptionHandler(pe, rs.getResponse());
        } catch (DAP2Exception de) {
            dap2ExceptionHandler(de, rs.getResponse());
        } catch (IOException ioe) {
            IOExceptionHandler(ioe, rs);
        } finally {  // release lock if needed
            if(ds != null) ds.release();
        }

    }
public void doGetBLOB ( ReqState rs ) throws Exception { if ( Debug . isSet ( "showResponse" ) ) { log . debug ( "doGetBLOB For: " + rs . getDataSet ( ) ) ; } GuardedDataset ds = null ; try { ds = getDataset ( rs ) ; if ( ds == null ) return ; rs . getResponse ( ) . setContentType ( "application/octet-stream" ) ; rs . getResponse ( ) . setHeader ( "XDODS-Server" , getServerVersion ( ) ) ; rs . getResponse ( ) . setHeader ( "Content-Description" , "dods-blob" ) ; ServletOutputStream sOut = rs . getResponse ( ) . getOutputStream ( ) ; OutputStream bOut ; DeflaterOutputStream dOut = null ; if ( rs . getAcceptsCompressed ( ) && allowDeflate ) { rs . getResponse ( ) . setHeader ( "Content-Encoding" , "deflate" ) ; dOut = new DeflaterOutputStream ( sOut ) ; bOut = new BufferedOutputStream ( dOut ) ; } else { // Commented out because of a bug in the OPeNDAP C++ stuff... //rs.getResponse().setHeader("Content-Encoding", "plain"); bOut = new BufferedOutputStream ( sOut ) ; } // Utilize the getDDS() method to get // a parsed and populated DDS // for this server. ServerDDS myDDS = ds . getDDS ( ) ; cacheArrayShapes ( myDDS ) ; // Instantiate the CEEvaluator and parse the constraint expression CEEvaluator ce = new CEEvaluator ( myDDS , new ClauseFactory ( functionLibrary ) ) ; ce . parseConstraint ( rs . getConstraintExpression ( ) , rs . getRequestURL ( ) . toString ( ) ) ; // Send the binary data back to the client DataOutputStream sink = new DataOutputStream ( bOut ) ; int seqLength = 5 ; String sls = rs . getInitParameter ( "SequenceLength" ) ; if ( sls != null ) { seqLength = ( Integer . valueOf ( sls ) ) . intValue ( ) ; } testEngine te = new testEngine ( seqLength ) ; ce . send ( myDDS . getEncodedName ( ) , sink , te ) ; sink . flush ( ) ; // Finish up sending the compressed stuff, but don't // close the stream (who knows what the Servlet may expect!) if ( rs . getAcceptsCompressed ( ) ) { if ( bOut != null ) bOut . flush ( ) ; if ( dOut != null ) ( ( DeflaterOutputStream ) dOut ) . finish ( ) ; } //? if(null != dOut) dOut.finish(); //? bOut.flush(); rs . getResponse ( ) . setStatus ( HttpServletResponse . SC_OK ) ; } catch ( ParseException pe ) { parseExceptionHandler ( pe , rs . getResponse ( ) ) ; } catch ( DAP2Exception de ) { dap2ExceptionHandler ( de , rs . getResponse ( ) ) ; } catch ( IOException ioe ) { IOExceptionHandler ( ioe , rs ) ; } finally { // release lock if needed if ( ds != null ) ds . release ( ) ; } }
Handler for the client's data request. Requires the getDDS()
method implemented by each server localization effort.
<p>
<p>Once the DDS has been parsed, the data is read (using the class in the
localized server factory etc.), compared to the constraint expression,
and then sent to the client.

@param rs The ReqState of this client request. Contains all kinds of
important stuff.
@opendap.ddx.experimental
@see ReqState
Handler for the client s data request . Requires the getDDS () method implemented by each server localization effort . <p > <p > Once the DDS has been parsed the data is read ( using the class in the localized server factory etc . ) compared to the constraint expression and then sent to the client .