opendap/dtswar/src/main/java/opendap/dts/DTSServlet.java
public void parseExceptionHandler(ParseException pe, HttpServletResponse response)
    {
        //log.error("DODSServlet.parseExceptionHandler", pe);

        if(Debug.isSet("showException")) {
            log.error(pe.toString());
            printThrowable(pe);
        }

        try {
            BufferedOutputStream eOut = new BufferedOutputStream(response.getOutputStream());
            response.setHeader("Content-Description", "dods-error");

            // This should probably be set to "plain" but this works, the
            // C++ slients don't barf as they would if I sent "plain" AND
            // the C++ don't expect compressed data if I do this...
            response.setHeader("Content-Encoding", "");
            // response.setContentType("text/plain");

            // Strip any double quotes out of the parser error message.
            // These get stuck in auto-magically by the javacc generated parser
            // code and they break our error parser (bummer!)
            String msg = pe.getMessage().replace('\"', '\'');

            DAP2Exception de2 = new DAP2Exception(opendap.dap.DAP2Exception.CANNOT_READ_FILE, msg);
            de2.print(eOut);
        } catch (IOException ioe) {
            log.error("Cannot respond to client! IO Error: " + ioe.getMessage());
        }

    }
public void parseExceptionHandler(ParseException pe, HttpServletResponse response)
    {
        //log.error("DODSServlet.parseExceptionHandler", pe);

        if(Debug.isSet("showException")) {
            log.error(pe.toString());
            printThrowable(pe);
        }

        try {
            BufferedOutputStream eOut = new BufferedOutputStream(response.getOutputStream());
            response.setHeader("Content-Description", "dods-error");

            // This should probably be set to "plain" but this works, the
            // C++ slients don't barf as they would if I sent "plain" AND
            // the C++ don't expect compressed data if I do this...
            response.setHeader("Content-Encoding", "");
            // response.setContentType("text/plain");

            // Strip any double quotes out of the parser error message.
            // These get stuck in auto-magically by the javacc generated parser
            // code and they break our error parser (bummer!)
            String msg = pe.getMessage().replace('\"', '\'');

            DAP2Exception de2 = new DAP2Exception(opendap.dap.DAP2Exception.CANNOT_READ_FILE, msg);
            de2.print(eOut);
        } catch (IOException ioe) {
            log.error("Cannot respond to client! IO Error: " + ioe.getMessage());
        }

    }
public void parseExceptionHandler ( ParseException pe , HttpServletResponse response ) { //log.error("DODSServlet.parseExceptionHandler", pe); if ( Debug . isSet ( "showException" ) ) { log . error ( pe . toString ( ) ) ; printThrowable ( pe ) ; } try { BufferedOutputStream eOut = new BufferedOutputStream ( response . getOutputStream ( ) ) ; response . setHeader ( "Content-Description" , "dods-error" ) ; // This should probably be set to "plain" but this works, the // C++ slients don't barf as they would if I sent "plain" AND // the C++ don't expect compressed data if I do this... response . setHeader ( "Content-Encoding" , "" ) ; // response.setContentType("text/plain"); // Strip any double quotes out of the parser error message. // These get stuck in auto-magically by the javacc generated parser // code and they break our error parser (bummer!) String msg = pe . getMessage ( ) . replace ( ' ' , ' ' ) ; DAP2Exception de2 = new DAP2Exception ( opendap . dap . DAP2Exception . CANNOT_READ_FILE , msg ) ; de2 . print ( eOut ) ; } catch ( IOException ioe ) { log . error ( "Cannot respond to client! IO Error: " + ioe . getMessage ( ) ) ; } }
Turns a ParseException into a OPeNDAP DAP2 error and sends it to the client.

@param pe       The <code>ParseException</code> that caused the problem.
@param response The <code>HttpServletResponse</code> for the client.
Turns a ParseException into a OPeNDAP DAP2 error and sends it to the client .