opendap/src/main/java/opendap/servlet/AbstractServlet.java
public void sendDODSError(HttpServletRequest request,
                            HttpServletResponse response,
                            String clientMsg,
                            String serverMsg)
          throws IOException, ServletException {

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

    ServletOutputStream Out = response.getOutputStream();

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

    de.print(Out);

    response.setStatus(HttpServletResponse.SC_OK);

    log.error(serverMsg);
  }
public void sendDODSError(HttpServletRequest request,
                            HttpServletResponse response,
                            String clientMsg,
                            String serverMsg)
          throws IOException, ServletException {

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

    ServletOutputStream Out = response.getOutputStream();

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

    de.print(Out);

    response.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 request   The client's <code> HttpServletRequest</code> request object.
@param response  The server's <code> HttpServletResponse</code> response 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.