opendap/dtswar/src/main/java/opendap/dts/DTSServlet.java
public void sendDODSError(ReqState rs,
                              String clientMsg,
                              String serverMsg)
            throws Exception
    {
        rs.getResponse().setContentType("text/plain");
        rs.getResponse().setHeader("XDODS-Server", getServerVersion());
        rs.getResponse().setHeader("Content-Description", "dods-error");
        // Commented because of a bug in the OPeNDAP C++ stuff...
        //response.setHeader("Content-Encoding", "none");

        ServletOutputStream Out = rs.getResponse().getOutputStream();

        DAP2Exception de = new DAP2Exception(opendap.dap.DAP2Exception.UNKNOWN_ERROR, clientMsg);

        de.print(Out);

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

        log.error(serverMsg);

    }
public void sendDODSError(ReqState rs,
                              String clientMsg,
                              String serverMsg)
            throws Exception
    {
        rs.getResponse().setContentType("text/plain");
        rs.getResponse().setHeader("XDODS-Server", getServerVersion());
        rs.getResponse().setHeader("Content-Description", "dods-error");
        // Commented because of a bug in the OPeNDAP C++ stuff...
        //response.setHeader("Content-Encoding", "none");

        ServletOutputStream Out = rs.getResponse().getOutputStream();

        DAP2Exception de = new DAP2Exception(opendap.dap.DAP2Exception.UNKNOWN_ERROR, clientMsg);

        de.print(Out);

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

        log.error(serverMsg);

    }
Sends a OPeNDAP DAP2 error (type UNKNOWN ERROR) to the client and displays a
message on the server console.

@param rs        The client's <code> ReqState</code> object.
@param clientMsg Error message <code>String</code> to send to the client.
@param serverMsg Error message <code>String</code> to display on the server console.