A default servlet mapping has a mapping of only the / character. In WebLogic,
a call to the javax.servlet.http.HttpServletRequest.getServletPath method for a default servlet mapping
returns an empty string, and a call to the javax.servlet.http.HttpServletRequest.getPathInfo method
returns null.
In WebSphere traditional, a call to getServletPath for a default servlet mapping will return an empty string,
but a call to the getPathInfo method returns the / character.
Similarly, if you are migrating to Liberty and using the Servlet 3.0 or 3.1 feature implementations, a call to getServletPath
for a default servlet mapping will return an empty string, but a call to the getPathInfo method returns the / character.
However, if you use the Servlet 4.0 feature, a call to getServletPath will return the / character and a call to
getPathInfo will return null.
For example, consider the following code:
In WebLogic, this code will have the following output:
In WebSphere traditional and Liberty with Servlet 3.0 or 3.1, the code will have the following output:
In Liberty with Servlet 4.0, the code will have the following output:
If you are migrating to WebSphere traditional or to Liberty with the Servlet 3.0 or 3.1 implementations, ensure that
your code accounts for getPathInfo returning the / character rather than null.
If you are migrating to Liberty with the Servlet 4.0 implementation, ensure that your code accounts for
getServletPath returning the / character rather than an empty string.
For additional information, see: