tds/src/main/java/thredds/server/reify/DownloadController.java
@RequestMapping(value = "**", method = RequestMethod.GET)
    public void
    doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException
    {
        try {
            setup(req, res);
            String sresult = null;
            switch (this.params.command) {
            case DOWNLOAD:
                try {
                    String fulltargetpath = download();
                    if(this.params.fromform) {
                        sendForm("Download succeeded: result file: " + fulltargetpath);
                    } else {
                        Map<String, String> result = new HashMap<>();
                        result.put("download", fulltargetpath);
                        sresult = mapToString(result, true, "download");
                        sendOK(sresult);
                    }
                } catch (SendError se) {
                    if(this.params.fromform) {
                        // Send back the download form with error msg
                        sendForm("Download failed: " + se.getMessage());
                    } else
                        throw se;
                }
                break;
            case INQUIRE:
                sresult = inquire();
                // Send back the inquiry answers
                sendOK(sresult);
                break;
            case NONE: // Use form-based download
                // Send back the download form
                sendForm("No files downloaded");
                break;
            }
        } catch (SendError se) {
            sendError(se);
        } catch (Exception e) {
            String msg = getStackTrace(e);
            sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
        }
    }
@RequestMapping(value = "**", method = RequestMethod.GET)
    public void
    doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException
    {
        try {
            setup(req, res);
            String sresult = null;
            switch (this.params.command) {
            case DOWNLOAD:
                try {
                    String fulltargetpath = download();
                    if(this.params.fromform) {
                        sendForm("Download succeeded: result file: " + fulltargetpath);
                    } else {
                        Map<String, String> result = new HashMap<>();
                        result.put("download", fulltargetpath);
                        sresult = mapToString(result, true, "download");
                        sendOK(sresult);
                    }
                } catch (SendError se) {
                    if(this.params.fromform) {
                        // Send back the download form with error msg
                        sendForm("Download failed: " + se.getMessage());
                    } else
                        throw se;
                }
                break;
            case INQUIRE:
                sresult = inquire();
                // Send back the inquiry answers
                sendOK(sresult);
                break;
            case NONE: // Use form-based download
                // Send back the download form
                sendForm("No files downloaded");
                break;
            }
        } catch (SendError se) {
            sendError(se);
        } catch (Exception e) {
            String msg = getStackTrace(e);
            sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
        }
    }
@ RequestMapping ( value = "**" , method = RequestMethod . GET ) public void doGet ( HttpServletRequest req , HttpServletResponse res ) throws ServletException { try { setup ( req , res ) ; String sresult = null ; switch ( this . params . command ) { case DOWNLOAD : try { String fulltargetpath = download ( ) ; if ( this . params . fromform ) { sendForm ( "Download succeeded: result file: " + fulltargetpath ) ; } else { Map < String , String > result = new HashMap <> ( ) ; result . put ( "download" , fulltargetpath ) ; sresult = mapToString ( result , true , "download" ) ; sendOK ( sresult ) ; } } catch ( SendError se ) { if ( this . params . fromform ) { // Send back the download form with error msg sendForm ( "Download failed: " + se . getMessage ( ) ) ; } else throw se ; } break ; case INQUIRE : sresult = inquire ( ) ; // Send back the inquiry answers sendOK ( sresult ) ; break ; case NONE : // Use form-based download // Send back the download form sendForm ( "No files downloaded" ) ; break ; } } catch ( SendError se ) { sendError ( se ) ; } catch ( Exception e ) { String msg = getStackTrace ( e ) ; sendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , msg , e ) ; } }
Controller entry point(s)
Controller entry point ( s )