tds/src/main/java/thredds/server/reify/LoadCommon.java
public void initOnce(HttpServletRequest req)
            throws SendError
    {
        if(once)
            return;
        once = true;
        log.info(getClass().getName() + " GET initialization");
        if(this.tdsContext == null)
            throw new SendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Cannot find TDS Context");
        // Get server host + port name
        StringBuilder buf = new StringBuilder();
        buf.append(req.getServerName());
        int port = req.getServerPort();
        if(port > 0) {
            buf.append(":");
            buf.append(port);
        }
        this.server = buf.toString();

        // Obtain servlet path info
        String tmp = HTTPUtil.canonicalpath(req.getContextPath());
        this.threddsname = HTTPUtil.nullify(HTTPUtil.relpath(tmp));
        tmp = HTTPUtil.canonicalpath(req.getServletPath());
        this.requestname = HTTPUtil.nullify(HTTPUtil.relpath(tmp));

        if(this.threddsname == null)
            this.threddsname = DEFAULTSERVLETNAME;

        // Get the upload dir
        File updir = tdsContext.getUploadDir();
        if(updir == null) {
            log.warn("No tds.upload.dir specified");
            this.uploaddir = null;
        } else
            this.uploaddir = HTTPUtil.canonicalpath(updir.getAbsolutePath());
        // Get the download dir
        File downdir = tdsContext.getDownloadDir();
        if(downdir == null) {
            log.warn("No tds.download.dir specified");
            this.downloaddir = null;
        } else
            this.downloaddir = HTTPUtil.canonicalpath(downdir.getAbsolutePath());

    }
public void initOnce(HttpServletRequest req)
            throws SendError
    {
        if(once)
            return;
        once = true;
        log.info(getClass().getName() + " GET initialization");
        if(this.tdsContext == null)
            throw new SendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Cannot find TDS Context");
        // Get server host + port name
        StringBuilder buf = new StringBuilder();
        buf.append(req.getServerName());
        int port = req.getServerPort();
        if(port > 0) {
            buf.append(":");
            buf.append(port);
        }
        this.server = buf.toString();

        // Obtain servlet path info
        String tmp = HTTPUtil.canonicalpath(req.getContextPath());
        this.threddsname = HTTPUtil.nullify(HTTPUtil.relpath(tmp));
        tmp = HTTPUtil.canonicalpath(req.getServletPath());
        this.requestname = HTTPUtil.nullify(HTTPUtil.relpath(tmp));

        if(this.threddsname == null)
            this.threddsname = DEFAULTSERVLETNAME;

        // Get the upload dir
        File updir = tdsContext.getUploadDir();
        if(updir == null) {
            log.warn("No tds.upload.dir specified");
            this.uploaddir = null;
        } else
            this.uploaddir = HTTPUtil.canonicalpath(updir.getAbsolutePath());
        // Get the download dir
        File downdir = tdsContext.getDownloadDir();
        if(downdir == null) {
            log.warn("No tds.download.dir specified");
            this.downloaddir = null;
        } else
            this.downloaddir = HTTPUtil.canonicalpath(downdir.getAbsolutePath());

    }
public void initOnce ( HttpServletRequest req ) throws SendError { if ( once ) return ; once = true ; log . info ( getClass ( ) . getName ( ) + " GET initialization" ) ; if ( this . tdsContext == null ) throw new SendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , "Cannot find TDS Context" ) ; // Get server host + port name StringBuilder buf = new StringBuilder ( ) ; buf . append ( req . getServerName ( ) ) ; int port = req . getServerPort ( ) ; if ( port > 0 ) { buf . append ( ":" ) ; buf . append ( port ) ; } this . server = buf . toString ( ) ; // Obtain servlet path info String tmp = HTTPUtil . canonicalpath ( req . getContextPath ( ) ) ; this . threddsname = HTTPUtil . nullify ( HTTPUtil . relpath ( tmp ) ) ; tmp = HTTPUtil . canonicalpath ( req . getServletPath ( ) ) ; this . requestname = HTTPUtil . nullify ( HTTPUtil . relpath ( tmp ) ) ; if ( this . threddsname == null ) this . threddsname = DEFAULTSERVLETNAME ; // Get the upload dir File updir = tdsContext . getUploadDir ( ) ; if ( updir == null ) { log . warn ( "No tds.upload.dir specified" ) ; this . uploaddir = null ; } else this . uploaddir = HTTPUtil . canonicalpath ( updir . getAbsolutePath ( ) ) ; // Get the download dir File downdir = tdsContext . getDownloadDir ( ) ; if ( downdir == null ) { log . warn ( "No tds.download.dir specified" ) ; this . downloaddir = null ; } else this . downloaddir = HTTPUtil . canonicalpath ( downdir . getAbsolutePath ( ) ) ; }
Invoked on first get so that everything is available,
especially Spring stuff.
Invoked on first get so that everything is available especially Spring stuff .