赶快收藏:public String getRealPath(String path)API的说明中文翻译


       public String getRealPath(String path);
       
       Returns a <code>String</code> containing the real path for a given virtual path.
       给一个虚拟路径之后,会返回一个字符串,该字符串包含真实的路径
       For example, the path "/index.html" returns the absolute file path on the server's filesystem would be served by a        

       举个例子,如果传入的path为/index.html 那么将返回服务于请求'http://host/contextPath/index.html'的服务器的文件系统中响应            该请求的文件的绝对文件路径
       request for "http://host/contextPath/index.html",
       where contextPath is the context path of this ServletContext..
       在这里环境路径就是这个ServletContext类的环境路径(也就是在controller中配置的路由)
       
     *   The real path returned will be in a form
     *   appropriate to the computer and operating system on
     *   which the servlet container is running, including the
     *   proper path separators.
         这个返回的真实路径将会是一种适合于计算机和servlet容器运行的操作系统的形式
         包括合适的路径分离器
         This method returns <code>null</code>
         该方法也会返回null
     *   if the servlet container cannot translate the virtual path
         如果servlet容器不能将虚拟路径翻译成真实路径话(由于某种原因,比如....)
     *   to a real path for any reason (such as when the content is
     *   being made available from a <code>.war</code> archive).
     *
     * 介绍一下参数path
     * @param path     a <code>String</code> specifying a virtual path(具体就是一个虚拟路径)
     *
     * 介绍一下返回值
     * @return         a <code>String</code> specifying the real path,
     *                  or null if the translation cannot be performed
     *            (具体就是一个真实路径,也可能是null如果翻译不能被执行的话)
     *
     *

猜你喜欢

转载自blog.csdn.net/weixin_42204641/article/details/81233176