Path Translation Methods
There are two convenience methods in the API which allow the Developer to obtain the file system path equivalent to a particular path.
These methods are:
=> ServletContext.getRealPath
=> HttpServletRequest.getPathTranslated
The getRealPath method takes a String argument and returns a String representation of a file on the local file system to which a path corresponds. The getPathTranslated method computes the real path of the pathInfo of the request. In situations where the servlet container cannot determine a valid file path for these methods, such as when the Web application is executed from an archive, on a remote file system not accessible locally, or in a database, these methods must return null.
=> ServletContext.getRealPath
=> HttpServletRequest.getPathTranslated
The getRealPath method takes a String argument and returns a String representation of a file on the local file system to which a path corresponds. The getPathTranslated method computes the real path of the pathInfo of the request. In situations where the servlet container cannot determine a valid file path for these methods, such as when the Web application is executed from an archive, on a remote file system not accessible locally, or in a database, these methods must return null.
No comments:
Post a Comment