- Once can call a servlet with an extra path:
http://server:port/servlet/HelloWorld/someextra/path.html
- Get this path with
public String HttpServletRequest.getPathInfo();
- Useful for pretending you are using static content,
backward compat., pretty URLs.
- To get the full (physical) path of the file use
public String HttpServletRequest.getPathTranslated();
- It could be that the path points to a real file, but in a
WAR so you can't read it.
- You can still pretend it is a regular file by opening it
as a URL with
public URL ServletContext.getResource(String uripath);
which you use like
URL url = getServletContext().getResource("/pathto/file.html");